Example #1
0
        public async Task MakeMove(Player player, HandSymbol move)
        {
            try
            {
                var playerMove = new PlayerMove
                {
                    Move      = move,
                    PlayerId  = player.Id,
                    SessionId = GameSessionId
                };
                var result = await HttpService.Post("/move")
                             .AddBody(string.Empty, JsonConvert.SerializeObject(playerMove))
                             .ExecuteAsync <GameSession>();

                CurrentMoves.Clear();
                result.CurrentPlayerMoves.ForEach(CurrentMoves.Add);
            }
            catch (System.Exception e)
            {
                await MessageService.ShowError(e.Message);
            }
        }
Example #2
0
 public static bool CheckWin(HandSymbol player1, HandSymbol player2)
 {
     return(WinMovements.Where((pair, i) => pair.Key == player1 && pair.Value == player2).Any());
 }