Fixed a typo

This commit is contained in:
AnnaSnoeijs 2025-06-06 21:31:59 +02:00
parent 1855c2e1cf
commit b05a803cd8
6 changed files with 42 additions and 42 deletions

View file

@ -23,16 +23,16 @@
#define BOARD_WIDTH_CHARS ( 3 * BOARD_WIDTH + 6 )
#define SCOREBOARD_OFFSET 5
#define SCOREBOARD_WIDTH 27
#define SCOREBOARD_HEIGTH 9
#define SCOREBOARD_HEIGHT 9
void initBoard( void ){
for( int i = SCOREBOARD_HEIGTH - ( BOARD_HEIGTH + 2 ); i > 0; i-- )
for( int i = SCOREBOARD_HEIGHT - ( BOARD_HEIGTH + 2 ); i > 0; i-- )
putchar( '\n' );
printf( "\n " );
for( int column = 0; column < BOARD_WIDTH; column++ )
printf( "%2d ", column + FIRST_NUMBER );
putchar( '\n' );
for( int row = BOARD_HEIGTH - 1; row > -1; row-- ){
for( int row = BOARD_HEIGHT - 1; row > -1; row-- ){
// begin row
printf( "%2d " , row + FIRST_NUMBER );
for( int column = 0; column < BOARD_WIDTH; column++ )
@ -48,7 +48,7 @@ void initBoard( void ){
for( int column = 0; column < BOARD_WIDTH; column++ )
printf( "%2d ", column + FIRST_NUMBER );
#define SCOREBOARD_LINE_END "\033[B\033["XSTR(SCOREBOARD_WIDTH)"D"
printf("\033["XSTR(SCOREBOARD_OFFSET)"C\033["XSTR(SCOREBOARD_HEIGTH)"A"
printf("\033["XSTR(SCOREBOARD_OFFSET)"C\033["XSTR(SCOREBOARD_HEIGHT)"A"
"┌───────────────┬────┬────┐"SCOREBOARD_LINE_END
"│ player │ 0 │ 1 │"SCOREBOARD_LINE_END
"├───────────────┼────┼────┤"SCOREBOARD_LINE_END
@ -70,25 +70,25 @@ void updateBoard(
const board_t board,
const int column
){
int heigth = board.heigth [ column ];
int height = board.heigth [ column ];
#ifndef ONLYPUT
switch( move ){
case PUT: // Only print the put one
#endif /* ! ONLYPUT */
printf(
"\033[%dA\033[%dC%c\033[%dB",
heigth + 3,
height + 3,
column * 3 + 4,
'0' + !!( board.player ),
heigth + 1
height + 1
);
#ifndef ONLYPUT
break;
default: // Print all the pieces in the column and the air above
printf( "\033[%dA", heigth + 4 );
if( heigth < BOARD_HEIGTH ) printf( "\033[%dC ", column * 3 + 4 );
printf( "\033[%dA", height + 4 );
if( height < BOARD_HEIGHT ) printf( "\033[%dC ", column * 3 + 4 );
else printf( "\033[%dC", column * 3 + 5 );
for( int row = heigth; row --> 0; )
for( int row = height; row --> 0; )
printf(
"\033[B\033[D%c",
'0' + !!( board.column [ column ] & ( 1 << row ) )
@ -138,13 +138,13 @@ int askColumn(
switch( move ){
case PUT:
#endif /* ! ONLYPUT */
if( board.heigth [ column ] < BOARD_HEIGTH )
if( board.height [ column ] < BOARD_HEIGHT )
return column;
else printf( "\033[2Apls enter a column that ain't full" );
#ifndef ONLYPUT
break;
case POP:
if( board.heigth [ column ] != 0 )
if( board.height [ column ] != 0 )
return column;
else printf( "\033[2Apls enter a column that ain't empty" );
}
@ -166,4 +166,4 @@ move_t askMove( void ){
#undef BOARD_WIDTH_CHARS
#undef SCOREBOARD_OFFSET
#undef SCOREBOARD_WIDTH
#undef SCOREBOARD_HEIGTH
#undef SCOREBOARD_HEIGHT