#pragma output REGISTER_SP = 0xa000 #include #include #include #include #include "ansi.h" #define BOARD_WIDTH 40 #define BOARD_HEIGHT 20 #define BOT_COUNT 10 char board[BOARD_HEIGHT][BOARD_WIDTH]; int posX, posY; int robotX[BOT_COUNT]; int robotY[BOT_COUNT]; unsigned int robotCount; short seed; unsigned char color = 0; void displayStatus(char *text) { gotoxy(5, 22); clrline(); printf("%s", text); } void drawBoard() { int i; int j; for (i=0;i 0) { newX = robotX[i]-1; } else if (robotX[i] - posX < 0) { newX = robotX[i]+ 1; } else { newX = robotX[i]; } if (robotY[i] - posY > 0) { newY = robotY[i]-1; } else if (robotY[i] - posY < 0) { newY = robotY[i]+ 1; } else { newY = robotY[i]; } if (board[newY][newX] == 'X') { robotCount--; gotoxy(robotX[i] + 5, robotY[i] + 1); printf(" "); board[robotY[i]][robotX[i]] = ' '; robotY[i] = -1; robotX[i] = -1; } else if (board[newY][newX] == '+') { // destroy both robots; for (j=0;j