Source

RockPaperScissors / RockPaperScissors / RockPaperScissors.cs

Full commit
Kevin Berridge c3af1d3 








Kevin Berridge f27bfc8 
Kevin Berridge c3af1d3 


Kevin Berridge f27bfc8 


Kevin Berridge c3af1d3 
Kevin Berridge f27bfc8 


Kevin Berridge c3af1d3 
Kevin Berridge f27bfc8 


Kevin Berridge c3af1d3 





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RockPaperScissors
{
  public class RockPaperScissors
  {
    public Player Play( Move player1Move, Move player2Move )
    {
      switch ( player1Move )
      {
        case Move.Rock:
          if ( player2Move == Move.Scissors ) return Player.First;
          else if ( player2Move == Move.Rock ) return Player.Draw;
          else return Player.Second;
        case Move.Scissors:
          if ( player2Move == Move.Paper ) return Player.First;
          else if ( player2Move == Move.Scissors ) return Player.Draw;
          else return Player.Second;
        case Move.Paper:
          if ( player2Move == Move.Rock ) return Player.First;
          else if ( player2Move == Move.Paper ) return Player.Draw;
          else return Player.Second;
        default:
          throw new NotSupportedException( "No matches" );
      }
    }
  }
}