private void TicTacToeButton_Click(object sender, EventArgs e) { this.Hide(); Form TicTacToeForm = new TicTacToeForm(this); TicTacToeForm.Show(); }
public static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var 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", 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", 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); }
public TicTacToePresenter(TicTacToeForm ticTacToeForm) { _gameCanvases = EnumUtil.GetListOfEnumElement <CanvasType>("Matrix"); _ticTacToeForm = ticTacToeForm; _canvasContainer = new CanvasContainer(); _network = new ActivationNetwork(new SigmoidFunction(2), 100, 14, 2); new BackPropagationLearning(_network); _pen = new Pen(Color.Black, 5); _crossDesignator = new CrossDesignator(); _network = (ActivationNetwork)Network.Load("Net.bin"); _gameUtil = new GameUtil(); _computerPlayer = new ComputerPlayer(_gameUtil, _gameCanvases); _board = new GameBoard(_gameCanvases); _game = new Game(_gameUtil, _board, _computerPlayer); _ticTacToeForm.DrawAction += Draw; _ticTacToeForm.LearnAction += ExecuteLearnAction; _ticTacToeForm.CrossAction += ExecuteCrossAction; _ticTacToeForm.CircleAction += ExecuteCircleAction; _ticTacToeForm.ClearAction += ExecuteClearAction; _ticTacToeForm.CopyAction += ExecuteCopyAction; _ticTacToeForm.TestAction += ExecuteTestAction; _ticTacToeForm.NewGameAction += ExecuteNewGameAction; _ticTacToeForm.PlayAction += ExecutePlayAction; _ticTacToeForm.BackAction += ExecuteBackAction; _lastModifiedCanvas = CanvasType.Matrix11; _paintFactory = new PaintFactory(_pen, _crossDesignator); }
public TicTacToePresenter(TicTacToeForm form, IGameFacade gameFacade, IPaintFacade paintFacade, INeuralNetworkFacade networkFacade) { _form = form; _gameFacade = gameFacade; _paintFacade = paintFacade; _networkFacade = networkFacade; _form.StartPainting += StartPainting; _form.ContinuePainting += ContinuePainting; _form.StopPainting += StopPainting; }
/// <summary> /// Initializes a new instance of the <see cref="HumanPlayer"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="piece">The piece.</param> /// <param name="form">The form.</param> public HumanPlayer(string name, Pieces piece, TicTacToeForm form) : base(name, piece) { this.ticTacToeForm = form; }