public BenderBotState(BenderBot bot) { this.CoordX = bot.coordX; this.CoordY = bot.coordY; this.Direction = bot.direction; this.InvertedMode = bot.invertedMode; this.BreakerMode = bot.breakerMode; }
static void Main(string[] args) { BenderBot bot; TownMap townMap; string movesHistory = ""; bool gameIsRunning = true; string[] inputs = Console.ReadLine().Split(' '); int lines = int.Parse(inputs[0]); int collumns = int.Parse(inputs[1]); // populating map int startCoordX = 0; int startCoordY = 0; townMap = new TownMap(collumns, lines); for (int i = 0; i < lines; i++) { string row = Console.ReadLine(); for (int j = 0; j < collumns; j++) { char tile = row[j]; townMap.Tiles[j, i] = tile; if (tile == '@') { startCoordX = j; startCoordY = i; } } } //Console.Error.WriteLine("Bot started: " + startCoordX + " " + startCoordY); bot = new BenderBot(startCoordX, startCoordY, townMap); // main loop while (gameIsRunning) { string latestMove = bot.Move(); if (latestMove == "LOOP") { movesHistory = latestMove; gameIsRunning = false; } else { movesHistory += latestMove + System.Environment.NewLine; } gameIsRunning = gameIsRunning && !bot.Dead; } Console.WriteLine(movesHistory); }