public IEnumerable <(Move <ConnectFourToken>, IMinimaxGame <ConnectFourToken>)> GetChildGameStates() { for (int i = 1; i <= Width; i++) { Move <ConnectFourToken> move = new Move <ConnectFourToken>(CurrentPlayer, new Coordinate(i, 1)); if (IsMoveAllowed(move)) { IMinimaxGame <ConnectFourToken> clone = Clone(); clone.TryMove(move); yield return(move, clone); } } }
public IEnumerable <(Move <TicTacToeToken>, IMinimaxGame <TicTacToeToken>)> GetChildGameStates() { for (int x = 1; x <= Width; x++) { for (int y = 1; y <= Height; y++) { Move <TicTacToeToken> move = new Move <TicTacToeToken>(CurrentPlayer, new Coordinate(x, y)); if (IsMoveAllowed(move)) { IMinimaxGame <TicTacToeToken> clone = (IMinimaxGame <TicTacToeToken>)Clone(); if (!clone.TryMove(move)) { throw new InvalidOperationException(); } yield return(move, clone); } } } }