title: Rock Paper Scissors javascript using matrix
body: <p>Hello everyone I am new here and am currently taking a javascript course at my university for my software development degree. I am running into an issue in my rock paper scissors lizard spock final project. My professor has given us QUnit Tests that can check our code but I am not very good at understanding how the errors show me whats wrong as I don't really understand how to get this code to work. So far I have created some objects and gave them properties and methods. i also created a matrix to capture and retain the variations of win conditions. however I don't understand how to create my final method I need: getWinner. In our rubric it states the following: </p>
  
  <p>"Method that will evaluate who won the game. Should update the wins, losses, and rate of each player. Should also set the "winner" property to the name of the winning player."</p>
  
  <p>Here is my game.js file that I am working on. At the bottom is where I am stumped with how to start this getWinner function. I have something started but its not responding to my unit tests. I can post the code if need be as well. As well as my other file which is another object.</p>
  
  <pre><code>var Game = function(){
  this.running = false;
  this.name = "RPSLS";
  this.players = [];
      this.addPlayer = function(name){
          var player = new Player(name);
          this.players.push(player);
          return player;
      };
      this.getPlayer = function(number){
          var player_number = number - 1;
          return this.players[player_number];
      };
      this.setHand = function(number, hand){
          var p = this.getPlayer(number);
          p.hand = hand;
      };
  
      this.matrix = {
          rock: {
              scissors: true,
              lizard: true
              },
  
          paper: {
              rock: true,
              spock: true
              },
  
          scissors: {
              paper: true,
              lizard: true
              },
  
          lizard: {
              spock: true,
              paper: true
              },
  
          spock: {
              rock: true,
              scissors: true
  
              }
  
      };
  
  
      this.getWinner = function(){
              var player1 = this.getPlayer();
              var player2 = this.getPlayer();
              if ( this.matrix [ player1 ] == [ player2 ] ) {
  
              } else if ( this.matrix [player1] [player2] ) {};
          }
  </code></pre>
  
  <p>};</p>
  
  <p>Thank you for reading through this and trying to help.</p>