Ejemplo n.º 1
0
        private async void Next(Move move, IPlayer player)
        {
            RemoveMarkers();
            if (move != null)
            {
                board.AddPawn(move.Row, move.Col, move.Color);
                await board.Flip(move.PositionsToFlip);
            }
            var state = board.State();

            if (Update != null)
            {
                Update(this, new GameUpdateArgs {
                    Cells = state, Player = player
                });
            }
            var moves = GetValidMoves(player.Color, state);

            if (moves.Count > 0 || GetValidMoves(-player.Color, state).Count > 0)
            {
                if (ShowMarkers)
                {
                    AddMarkers(moves.Select(x => new Position {
                        Row = x.Row, Col = x.Col
                    }));
                }
                player.Play(moves, state);
            }
            else
            {
                EndGame();
            }
        }