DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T f

⟦8aeae0c8f⟧ TextFile

    Length: 599 (0x257)
    Types: TextFile
    Names: »fini.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Othello/fini.c« 

TextFile

/*
 *	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);
}