public Board(string filename) { gameBoard = new Case[40]; StreamReader sr = new StreamReader(filename); string stock = sr.ReadLine(); string[] stock2 = new string[11]; int[] rents = new int[6]; for (int i = 0; i < 40; i++) { stock = sr.ReadLine(); stock2 = stock.Split(';'); if (stock2[1] == "Ville") { for (int j = 0; j < 6; j++) { rents[j] = int.Parse(stock2[j + 5]); } gameBoard[i] = new CityCase(stock2[0], stock2[2], int.Parse(stock2[3]), int.Parse(stock2[4]), rents); } else { if (!stock2[0].Equals("Parc Gratuit")) { gameBoard[i] = new ActionCase(stock2[0], stock2[2]); } else { gameBoard[i] = new FreeParking(stock2[0], stock2[2]); } } } this.dices = new Dice[2]; this.dices[0] = new Dice(); this.dices[1] = new Dice(); this.activePlayer = 0; this.state = ""; this.myView = new GameView(this); this.myController = new GameController(this); this.players = new List <Player>(); }
static void Main(string[] args) { Beginning Beginning = new Beginning("Beginning"); House HouseAtanasovi = new House("Atanasovi", 500, 50); Station StationFilipovo = new Station("Filipovo", 1000, 500); House HousePetrovi = new House("Petrovi", 500, 50); FreeParking FirstFreeParking = new FreeParking("First parking"); House HouseDimitrovi = new House("Dimitrovi", 500, 50); Station StationTrakia = new Station("Trakia", 1000, 500); House HouseIvanovi = new House("", 500, 50); FreeParking SecondFreeParking = new FreeParking("Second parking"); House HouseAngelovi = new House("Angelovi", 500, 50); Station StationTsentralna = new Station("Tsentralna", 1000, 500); House HouseMarinovi = new House("Marinovi", 500, 50); FreeParking ThirthFreeParking = new FreeParking("Thirt parking"); House HouseBiserovi = new House("Biserovi", 500, 50); Station StationIzgrev = new Station("Izgrev", 1000, 500); House HousePavlovi = new House("Pavlovi", 500, 50); Player PlayerOne = new Player("Virginia", 1500, 0); //List<Player> players = new List<Player>(); //players.Add(PlayerOne); List <Field> board = new List <Field>(); board.Add(Beginning); board.Add(HouseAtanasovi); board.Add(StationFilipovo); board.Add(HousePetrovi); board.Add(FirstFreeParking); board.Add(HouseDimitrovi); board.Add(StationTrakia); board.Add(HouseIvanovi); board.Add(SecondFreeParking); board.Add(HouseAngelovi); board.Add(StationTsentralna); board.Add(HouseMarinovi); board.Add(ThirthFreeParking); board.Add(HouseBiserovi); board.Add(StationIzgrev); board.Add(HousePavlovi); Random dice = new Random(); PlayerOne.Move(dice.Next(1, 7)); Field currentPosition = board[PlayerOne.Position]; Console.WriteLine($"{PlayerOne.NamePlayer} is moving on the position: {board[PlayerOne.Position].FieldName}"); /* * object[,] board = new object[4, 5]{ * {Beginning,HouseAtanasovi, StationFilipovo, HousePetrovi, FirstFreeParking}, * { FirstFreeParking,HouseDimitrovi, StationTrakia, HouseIvanovi, SecondFreeParking}, * { SecondFreeParking,HouseAngelovi, StationTsentralna, HouseMarinovi, ThirthFreeParking}, * { ThirthFreeParking,HouseBiserovi, StationIzgrev, HousePavlovi, Beginning}, * }; */ }