Made ui_vt100 able to be used without askColumn between every updateBoard
This commit is contained in:
parent
e31258e26c
commit
a5fcaa00d7
1 changed files with 9 additions and 9 deletions
18
ui_vt100.c
18
ui_vt100.c
|
|
@ -65,14 +65,13 @@ void initBoard( const board_t board ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBoard(
|
void updateBoard(
|
||||||
const wins_t wins,
|
|
||||||
const board_t board,
|
const board_t board,
|
||||||
const columnsint_t column
|
const columnsint_t column
|
||||||
){
|
){
|
||||||
rowsint_t height = board.height [ column ];
|
rowsint_t height = board.height [ column ];
|
||||||
printf(
|
printf(
|
||||||
"\033[%dA\033[%dC%c\033[%dB",
|
"\033[%dA\033[%dC%c\033[%dB",
|
||||||
height + 3,
|
height + 2,
|
||||||
column * 3 + 4,
|
column * 3 + 4,
|
||||||
'0' + !!( board.player ),
|
'0' + !!( board.player ),
|
||||||
height + 1
|
height + 1
|
||||||
|
|
@ -85,11 +84,11 @@ void updateBoard(
|
||||||
"" WININT_FORMAT " │" WININT_FORMAT "\033[2B\033[8D"
|
"" WININT_FORMAT " │" WININT_FORMAT "\033[2B\033[8D"
|
||||||
"" WININT_FORMAT " │" WININT_FORMAT "\033[2B"
|
"" WININT_FORMAT " │" WININT_FORMAT "\033[2B"
|
||||||
,( 3 * board.columns + 6 ) + SCOREBOARD_WIDTH - 8
|
,( 3 * board.columns + 6 ) + SCOREBOARD_WIDTH - 8
|
||||||
,wins.count0.vertical, wins.count1.vertical
|
,board.count0.vertical, board.count1.vertical
|
||||||
,wins.count0.horizontal, wins.count1.horizontal
|
,board.count0.horizontal, board.count1.horizontal
|
||||||
,wins.count0.diagonalUp, wins.count1.diagonalUp
|
,board.count0.diagonalUp, board.count1.diagonalUp
|
||||||
,wins.count0.diagonalDown, wins.count1.diagonalDown
|
,board.count0.diagonalDown, board.count1.diagonalDown
|
||||||
,wins.count0.total, wins.count1.total
|
,board.count0.total, board.count1.total
|
||||||
);
|
);
|
||||||
printf( "\033[2K\n" );
|
printf( "\033[2K\n" );
|
||||||
}
|
}
|
||||||
|
|
@ -112,9 +111,10 @@ columnsint_t askColumn(
|
||||||
if( column < FIRST_NUMBER ) return QUITCOLUMN;
|
if( column < FIRST_NUMBER ) return QUITCOLUMN;
|
||||||
column -= FIRST_NUMBER;
|
column -= FIRST_NUMBER;
|
||||||
if( column < board.columns )
|
if( column < board.columns )
|
||||||
if( board.height [ column ] < board.rows )
|
if( board.height [ column ] < board.rows ){
|
||||||
|
printf( "\033[A" );
|
||||||
return column;
|
return column;
|
||||||
else printf( "\033[2Apls enter a column that ain't full" );
|
} else printf( "\033[2Apls enter a column that ain't full" );
|
||||||
else
|
else
|
||||||
printf( "\033[2Apls enter valid column" );
|
printf( "\033[2Apls enter valid column" );
|
||||||
printf( "\033[K\n" );
|
printf( "\033[K\n" );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue