forked from bluemonkmn/Chess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Creating Players and Running the Game
43 lines (33 loc) · 1.57 KB
/
Creating Players and Running the Game
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
TicTacToeForm f = new TicTacToeForm();
// Create the game players
// Players can be either human or computer players
// It does not matter which piece 'X' or 'O' player 1 or two have
// but they must be different
// Create a human player
Player p1 = new HumanPlayer("Joe", Board.Pieces.X, f);
// Create a computer player
// You can create varying degrees of difficulty by creating computer
// players that build bigger game trees
// uncomment desired player and comment all other player 2s
// create a computer player with the default game tree search depth
Player p2 = new ComputerPlayer("HAL", Board.Pieces.O);
// Create a computer player that only looks ahead 1 move
// i.e only considers their immediate move and not any subsequent moves
// by their opponent.
// this is a very poor player
// Player p2 = new ComputerPlayer(Board.Pieces.X, f, 1);
// Creates an advanced computer player that looks ahead 5 moves
// Player p2 = new ComputerPlayer("Advanced HAL", Board.Pieces.X, 5);
f.AddPlayer(p1);
f.AddPlayer(p2);
Application.Run(f);
}
}