public int Move(int position) { if (CurrentStatus.IsTerminal || CurrentStatus.Board[position] != 0) { return(-1); } CurrentStatus = CurrentStatus.Move(position); TileState[] lastBoard = (TileState[])CurrentStatus.Board.Clone(); if (!CurrentStatus.IsTerminal) { CurrentStatus = (MCGameStatus)BestMove(CurrentStatus.Player == TileState.X, 1000); } for (int i = 0; i < lastBoard.Length; i++) { if (lastBoard[i] != CurrentStatus.Board[i]) { return(i); } } //you suck at progromming return(-1); }
public MCGameTree(bool humanFirst = true) { CurrentStatus = new MCGameStatus(); if (!humanFirst) { CurrentStatus = (MCGameStatus)BestMove(true, 1000); } }
public MCGameStatus Move(int move) { if (moves == null) { moves = GenerateMoves(); } MCGameStatus status = moves.FirstOrDefault(x => x.Board[move] == Player); if (status == null) { return(this); } return(status); }