using System; namespace BoardGame { class Program { static void Main(string[] args) { int[] numbers = new int[500]; char[,] letterGrid = new char[10, 22]; // (x,y) int i = 0; for (i = 0; i < 500; i++) { numbers[i] = 0; } for (i = 0; i < 500; i++) { numbers[i] = numbers[i] + 10; } int x = 2; int y = 5; letterGrid[x, y] = 'p'; for (y = 0; y < 22; y++) { for (x = 0; x < 10; x++) { letterGrid[x, y] = 'p'; } } Board gameBoard = new Board(10, 15, '_'); gameBoard.Display(); bool isValid; isValid = gameBoard.SetValue(2, 4, '@'); if (isValid) { Console.WriteLine("Player token placed"); } gameBoard.Display(); // Board changed, so display again!! // What is at position 2, 4 ? char playerToken; isValid = gameBoard.GetValue(2, 4, out playerToken); // I forgot during the lecture that this code // will also be useful for generating random numbers // and moving the player around the board Console.WriteLine("Dice Demo #################"); DiceDemo(); Console.ReadKey(); // Pause } static void DiceDemo() { Board gameBoard = new Board(10, 15, '_'); PlayerPosition player1Pos = new PlayerPosition(gameBoard.GetWidth(), gameBoard.GetHeight()); Console.WriteLine("Player start at bottom left x=0, y=0"); gameBoard.SetValue(player1Pos.GetX(), player1Pos.GetY(), '#'); gameBoard.Display(); System.Threading.Thread.Sleep(250); for (int i = 0; i < 7; i++) // Move 7 times { // Clear current player location gameBoard.SetValue(player1Pos.GetX(), player1Pos.GetY(), '_'); player1Pos.ThrowDice(); Console.WriteLine("Placing char at {0},{1}", player1Pos.GetX(), player1Pos.GetY()); gameBoard.SetValue(player1Pos.GetX(), player1Pos.GetY(), '#'); gameBoard.Display(); System.Threading.Thread.Sleep(2000); } } } }