public void Initialize() { ServiceProviderMock = new Mock <IServiceProvider>(); GameMock = new Mock <IGame>(); TicTacToeFactory = new TicTacToeFactory(ServiceProviderMock.Object); }
private void InitializeTicTacToeGame() { this.ticTacToeGame = TicTacToeFactory.Create(Team.Zero); ticTacToeGame.ScoreChanged += OnScoreChanged; ticTacToeGame.TeamAndLineWon += OnTeamAndLineWon; ticTacToeGame.TeamChanged += OnTeamChanged; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var ticTacToe = TicTacToeFactory.Create(Team.Zero); var mainWindow = new MainWindow(ticTacToe); mainWindow.ShowDialog(); }
public void WhenIStartANewGameWithTheFollowingMoves(string movesString) { Invoke(() => { var moves = ToMoves(movesString); Game = TicTacToeFactory.NewGame(moves); }); }
public void GivenIStartANewGameWithTheFollowingMoves(Table table) { Invoke(() => { var moves = ToMoves(table); Game = TicTacToeFactory.NewGame(moves); }); }
private static void PlayTicTacToe() { TicTacToeFactory factory = new TicTacToeFactory(); IGameLogic logic = factory.CreateLogic(); MiniMaxAlgorithm alg = new MiniMaxAlgorithm(5, factory); IGameState state = new TicTacToeState(); while (true) { IGameMove move = alg.FindBestMove(state, GamePlayer.PlayerMax); if (null != move) { state = logic.MakeMove(move, state); } else { break; } PrintState((TicTacToeState)state); if (logic.IsFinished(state)) { break; } Int32 x = Int32.Parse(Console.ReadLine()); Int32 y = Int32.Parse(Console.ReadLine()); state = logic.MakeMove(new TicTacToeMove { X = x, Y = y, Symbol = TicTacToeFieldState.Circle }, state); if (logic.IsFinished(state)) { break; } } PrintState((TicTacToeState)state); }
public static MatchState CreateNewMatch(GameType matchType, Guid firstPlayerId) { return(new MatchState { id = Guid.NewGuid(), gameType = matchType, operationState = GameOperationState.WaitingForPlayers, gameStartTime = DateTime.Now, playerTurnId = firstPlayerId, players = new List <Guid> { firstPlayerId, }, inGameState = TicTacToeFactory.CreateNewTicTacToe(firstPlayerId) }); }
public MainWindow() : this(TicTacToeFactory.Create(Team.Zero)) { }
public void GivenIHaveADatabaseBuilder() { Invoke(() => DatabaseBuilder = TicTacToeFactory.NewDatabaseBuilder()); }
public void GivenIStartANewGameInTheFollowingState(Table table) { Invoke(() => Game = TicTacToeFactory.NewGame(ToPlausibleMoveListFromBoardState(table))); }
public void GivenIStartANewGame() { Invoke(() => Game = TicTacToeFactory.NewGame()); }
public void GivenIHaveTheArtificialIntelligence(string ai) { ArtificialIntelligence = TicTacToeFactory.NewArtificialIntelligence(ai); }