|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T f
Length: 599 (0x257)
Types: TextFile
Names: »fini.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Othello/fini.c«
/*
* fini.c
*
* count up score and display winner
*/
# include "reversi.h"
fini (board)
boardT board;
{
register int x,y;
register int wscore, bscore;
char sbuf[80];
wscore = bscore = 0;
for (x = 1; x <= SIZE; x++)
for (y = 1; y <= SIZE; y++)
if (board[x][y] == WHITE)
++wscore;
else if (board[x][y] == BLACK)
++bscore;
if (wscore > bscore)
sprintf (sbuf, "white wins %d to %d.", wscore, bscore);
else if (bscore > wscore)
sprintf (sbuf, "black wins %d to %d.", bscore, wscore);
else
sprintf (sbuf, "tie game %d to %d.", wscore, bscore);
dispError (sbuf);
}