Exemple #1
0
        private void RoboPlayerCallback(RoboPlayerPlugin plugin, RoboCard[] chosenCards, Exception ex)
        {
            RoboPlayer player = plugin.Player;

            if (player == null || !ActivePlayers.Contains(plugin))
            {
                return;
            }
            if (player.PlayerState != RoboPlayerState.Thinking || ex != null)
            {
                player.PlayerState = RoboPlayerState.Error;
            }
            else
            {
                if (player.EndRound(chosenCards))
                {
                    player.PlayerState = RoboPlayerState.Decided;
                }
                else
                {
                    player.PlayerState = RoboPlayerState.Error;
                }
            }

            Action playingCards = DoPlayingCards;

            playingCards.BeginInvoke(null, playingCards);
        }
Exemple #2
0
 public RoboPlayerResult(RoboPlayer player)
 {
     State        = player.PlayerState;
     RoundsPlayed = player.Round;
     CardsPlayed  = player.TotalPlayedCards;
     Time         = player.TotalTimeElapsed;
 }
Exemple #3
0
        private RoboBoard GetBoard(RoboBoard original, RoboPlayer actualPlayer, IEnumerable <RoboPlayer> players)
        {
            RoboBoard board = Board.CopyBoard();

            if (Interaction == RoboPlayerInteraction.Blocked)
            {
                foreach (RoboPlayer player in players)
                {
                    if (player == actualPlayer ||
                        board.GetField(player.Position).IsDestination ||
                        player.Position.IsDead)
                    {
                        continue;
                    }

                    board.Fields[player.Position.X, player.Position.Y] =
                        RoboField.CreateField(FieldType.WallDown | FieldType.WallUp | FieldType.WallLeft | FieldType.WallRight);
                }
            }

            return(board);
        }
Exemple #4
0
 public RoboPlayerPlugin FindActivePlugin(RoboPlayer roboplayer)
 {
     return(ActivePlayers.Where(plugin => plugin.Player.Equals(roboplayer)).FirstOrDefault());
 }