Beispiel #1
0
        // *********************************************************************************************************************
        // draw current board
        static void drawBoard(boardState[,] gameBoard)
        {
            Console.WriteLine("1 = You");
              Console.WriteLine("2 = Opponent");
              Console.WriteLine("Y = YourWall");
              Console.WriteLine("O = OpponentWall");
              Console.WriteLine("");

              Console.WriteLine("################################");
              for (int y = 0; y < 30; y++)
              {
            string row = "#";

            for (int x = 0; x < 30; x++)
            {
              switch (gameBoard[x, y])
              {
            case boardState.Clear: row += " "; break;
            case boardState.You: row += "1"; break;
            case boardState.Opponent: row += "2"; break;
            case boardState.YourWall: row += "Y"; break;
            case boardState.OpponentWall: row += "O"; break;
              }
            }
            Console.WriteLine(row + "#");
              }

              Console.WriteLine("################################");
        }
Beispiel #2
0
 void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         whiteboardState = boardState.OFF;
         characterSwap.SetActive(true);
         characterSwap.GetComponent <SwitchTimer>().enabled = true;
     }
 }
Beispiel #3
0
 void OnTriggerStay(Collider other)
 {
     Debug.Log("Entered Trigger");
     if (other.tag == "Player")
     {
         whiteboardState = boardState.ON;
         characterSwap.GetComponent <SwitchTimer>().enabled = false;
         characterSwap.SetActive(false);
     }
 }
        public OuterBoard()
        {
            Name = "OuterBoard";
            boardState value = boardState.Open;

            arrInnerBoards = new InnerBoard[9]; //Create boards

            for (int i = 0; i < arrInnerBoards.Length; i++)
            {
                arrInnerBoards[i] = new InnerBoard();
            }
        }
Beispiel #5
0
        // *********************************************************************************************************************
        static boardState[,] loadGameBoard(string gameStateFile)
        {
            boardState[,] gameBoard = new boardState[30, 30];

              TextReader gameStateInput = new StreamReader(gameStateFile);

              while (gameStateInput.Peek() > 0)
              {
            // read data
            string data = gameStateInput.ReadLine();

            // split data
            string[] values = data.Split(' ');

            byte x = byte.Parse(values[0]);
            byte y = byte.Parse(values[1]);

            switch (values[2].ToUpper())
            {
              case "CLEAR": gameBoard[x, y] = boardState.Clear; break;
              case "YOU":
            You[0] = x;
            You[1] = y;
            gameBoard[x, y] = boardState.You;
            break;
              case "OPPONENT":
            Opponent[0] = x;
            Opponent[1] = y;
            gameBoard[x, y] = boardState.Opponent;
            break;
              case "YOURWALL": gameBoard[x, y] = boardState.YourWall; break;
              case "OPPONENTWALL": gameBoard[x, y] = boardState.OpponentWall; break;
            }
              }

              gameStateInput.Close();

              return gameBoard;
        }
Beispiel #6
0
        // *********************************************************************************************************************
        static void saveGameBoard(boardState[,] gameBoard, string gameStateFile)
        {
            // write game.state
              TextWriter gameStateOutput = new StreamWriter(gameStateFile);

              for (int x = 0; x < 30; x++)
            for (int y = 0; y < 30; y++)
            {
              boardState state = gameBoard[x, y];
              string dt = x.ToString() + " " + y.ToString() + " " + state.ToString();
              gameStateOutput.WriteLine(dt);
            }

              gameStateOutput.Close();
        }
Beispiel #7
0
 List <(int x, int y)> jumps = new RuleDraughts().GetPositions(current_x, current_y, boardState, boardSize);
Beispiel #8
0
 List <(int x, int y)> steps = new RuleSteps().GetPositions(current_x, current_y, boardState, boardSize);
Beispiel #9
0
        //private enum boardState {Open, XWin, OWin, Draw };

        public InnerBoard()
        {
            Name         = "Inner Board";
            arrInnerGrid = new string[9];
            boardState value = boardState.Open;
        }
Beispiel #10
0
 SkipInvalidMoves(GetTheroreticalAttacksIncludingInvalid(location, piece, team, boardState, promos, includeBlocking));
Beispiel #11
0
 // Use this for initialization
 void Start()
 {
     whiteboardState = boardState.OFF;
 }