private void constructWorld(string worldPath) { //Reading Board Properties StreamReader f = new StreamReader(worldPath); string[] boardProps = f.ReadLine().Split(' '); int numRows = Convert.ToInt32(boardProps[0]); int numCols = Convert.ToInt32(boardProps[1]); int cellSize = cellSize = BOARD_SIZE / (numCols > numRows ? numCols : numRows); //Reading Karel Properties string[] karelParams = f.ReadLine().Split(' '); int row = Convert.ToInt32(karelParams[0]); int col = Convert.ToInt32(karelParams[1]); int beeperBag = Convert.ToInt32(karelParams[2]); if (beeperBag == -1) { beeperBag = int.MaxValue; } //Instantiating Karel and the Board. karel = new ExtendedKarel(row, col, beeperBag, cellSize); this.board = new KarelBoard(numRows, numCols, BOARD_SIZE, cellSize, karel, worldPath); karel.setBoard(board); this.Controls.Add(board); }
protected internal void setBoard(KarelBoard board) { this.board = board; }