Exemple #1
0
        public static double EvaluateBoard(int[,] board, GridGameParameters ggp, int player)
        {
            int sum = 0;
			for (int i = 0; i < 8; i++)
				for (int j = 0; j < 8; j++)
					sum += board[i,j] == player ? 1 : -1;
            return (sum + 64) / 128.0 * ggp.TieReward;
        }
Exemple #2
0
 public static double EvaluateBoard(int[,] board, GridGameParameters ggp, int player)
 {
     // It's tic-tac-toe. Go to the end of the game tree and stop being lazy.
     return ggp.TieReward; 
 }
Exemple #3
0
        public static double EvaluateBoard(int[,] board, GridGameParameters ggp, int player)
        {

            //find max in a column for player
            int max_in_a_row = 0;
            int num_in_a_row = 0;
            int current;
            for (int i = 0; i < board.GetLength(0); i++)
            {
                num_in_a_row = 0;
                for (int j = 0; j < board.GetLength(1); j++)
                {
                    current = board[i, j];
                    if (current == player)
                    {
                        num_in_a_row += 1;
                        if (num_in_a_row > max_in_a_row)
                            max_in_a_row = num_in_a_row;
                    }
                    else
                    {
                        num_in_a_row = 0;
                    }
                     
                }
            }

            return (max_in_a_row + 5) / 4.0;
        }