delete pipe character

このコミットが含まれているのは:
ninya9k 2023-11-15 07:03:20 +00:00
コミット d7f2f88615
1個のファイルの変更9行の追加9行の削除

18
uttt.c
ファイルの表示

@ -255,12 +255,12 @@ void ut_cursdraw(const struct ut_state *state)
}
void ut_sockdraw(const struct ut_state *state, int fd)
{
ut_dprintf(fd, "| Turn: %c Play board: %d\n", (int)state->player, state->playBoard);
ut_dprintf(fd, "Turn: %c Play board: %d\n", (int)state->player, state->playBoard);
char dtiles[DTILES_Y][DTILES_X];
ut_drawTiles(ut_tmvch, dtiles, state, true);
for(int r = 0; r < DTILES_Y; r++)
{
ut_dprintf(fd, "| %.*s\n", DTILES_X, dtiles[r]);
ut_dprintf(fd, "%.*s\n", DTILES_X, dtiles[r]);
}
}
@ -514,15 +514,15 @@ int ut_network_game(struct ut_state *state, int sock, char player, bool readable
ut_show_boards(state);
ut_show(state, sock, true);
if (state->player == player) {
if (readable) {ut_dprintf(sock, "| Waiting for game partner ...\n");}
if (readable) {ut_dprintf(sock, "Waiting for game partner ...\n");}
bool ok = getpos(state, &x, &y);
if (!ok) {continue;}
ut_dprintf(sock, "%d,%d\n", x, y);
} else {
printf("Waiting for game partner ...\n");
if (readable) {
ut_dprintf(sock, "|\n"); // aligns game board each turn
ut_dprintf(sock, "| Place token %c in position x,y: ", ut_turn(player));
// line feed aligns game board each turn
ut_dprintf(sock, "\nPlace token %c in position x,y: ", ut_turn(player));
}
int err = ut_sockgetpos(state, sock, &x, &y);
if (err == -1) {
@ -538,22 +538,22 @@ int ut_network_game(struct ut_state *state, int sock, char player, bool readable
}
int err = ut_move(state, state, y, x);
if (err) {continue;}
ut_dprintf(sock, "|\n");
ut_dprintf(sock, "\n");
char w = ut_winner((char *)state->boards, 0, 3);
if(w)
{
if(w == ' ')
{
printf("\nDraw!\n");
if (readable) {ut_dprintf(sock, "|\n|Draw!\n");}
if (readable) {ut_dprintf(sock, "\nDraw!\n");}
close(sock);
if (readable) {ut_dprintf(sock, "|\n|Draw!\n");}
if (readable) {ut_dprintf(sock, "\nDraw!\n");}
close(sock);
}
else
{
printf("\n%c wins!\n", (int)w);
if (readable) {ut_dprintf(sock, "|\n|%c wins!\n", (int)w);}
if (readable) {ut_dprintf(sock, "\n%c wins!\n", (int)w);}
close(sock);
}
break;