Code:
#include <stdio.h>
#include <8051.h>
void putchar(char c);
int c;
int hits;
int array_pointer;
int Battleship[5][5] = { {'0','0','1','1','1'}, {'1','0','0','0','0'}, {'1','0','1','1','0'}, {'0','0','0','0','0'}, {'1','1','1','1','1'}};
void main()
{
putchar;
printf("\x1b[2J",0); //Clears terminal screen
printf("%s\n\r",&"___________________________"); //Prints title block
printf("%s\n\r",&"---B-A-T-T-L-E-S-H-I-P-S---"); //Prints title block
printf("%s\n\n\n\n\r",&"___________________________"); //Prints title block
printf("%s\n\n\n\r",&"Press ENTER to begin..."); //Prints title block
printf("%s %s %s %s %s\n\r", "X", "X", "X", "X", "X");
printf("%s %s %s %s %s\n\r", "X", "X", "X", "X", "X");
printf("%s %s %s %s %s\n\r", "X", "X", "X", "X", "X");
printf("%s %s %s %s %s\n\r", "X", "X", "X", "X", "X");
printf("%s %s %s %s %s\n\r", "X", "X", "X", "X", "X");
}
void game()
{
hits = 12;
array_pointer = 0;
}
void putchar(char c)
{
while(! TI);
TI = 0;
SBUF =c;
}
I'm hoping to get the user to press enter to begin the game, where the grid of 'X' will apear, and where any other key does nothing.