Exemple #1
0
        public override Move MakeMove(Board board)
        {
            ConnectFourMove move = Strategy.GenerateMove(board, this) as ConnectFourMove;

            Console.WriteLine($">> {Name} made a move: [Column {move.TargetColumn}] ");
            return(move);
        }
 public Move GenerateMove(Board board, Player player)
 {
     {
         var             possibleColumns = (board as ConnectFourBoard).OpenColumns.ToArray();
         var             rand            = new Random();
         int             chosen          = rand.Next(0, possibleColumns.Length);
         string          command         = possibleColumns[chosen].ToString();
         ConnectFourMove move            = new ConnectFourMove(command, player.Id);
         return(move);
     }
 }
Exemple #3
0
        public void AppendMove(string command)
        {
            int colorId = 1;

            if (MoveList.Count % 2 == 0)
            {
                colorId = 1;
            }
            else
            {
                colorId = 2;
            }
            ConnectFourMove move = new ConnectFourMove(command, colorId);

            MoveList.Add(move);
        }