xref: /csrg-svn/games/hangman/setup.c (revision 47859)
1*47859Sbostic /*-
2*47859Sbostic  * Copyright (c) 1983 The Regents of the University of California.
333111Sbostic  * All rights reserved.
433111Sbostic  *
5*47859Sbostic  * %sccs.include.redist.c%
633111Sbostic  */
733111Sbostic 
833111Sbostic #ifndef lint
9*47859Sbostic static char sccsid[] = "@(#)setup.c	5.4 (Berkeley) 04/08/91";
1033111Sbostic #endif /* not lint */
1133111Sbostic 
1233111Sbostic # include	"hangman.h"
1333111Sbostic 
1433111Sbostic /*
1533111Sbostic  * setup:
1633111Sbostic  *	Set up the strings on the screen.
1733111Sbostic  */
1833111Sbostic setup()
1933111Sbostic {
2033111Sbostic 	register char		**sp;
2133111Sbostic 	static struct stat	sbuf;
2233111Sbostic 
2333111Sbostic 	noecho();
2433111Sbostic 	crmode();
2533111Sbostic 
2633111Sbostic 	mvaddstr(PROMPTY, PROMPTX, "Guess:");
2733111Sbostic 	mvaddstr(GUESSY, GUESSX, "Guessed:");
2833111Sbostic 	mvaddstr(NUMBERY, NUMBERX, "Word #:");
2933111Sbostic 	mvaddstr(AVGY, AVGX, "Current Average:");
3033111Sbostic 	mvaddstr(AVGY + 1, AVGX, "Overall Average:");
3133111Sbostic 	mvaddstr(KNOWNY, KNOWNX, "Word: ");
3233111Sbostic 
3333111Sbostic 	for (sp = Noose_pict; *sp != NULL; sp++) {
3433111Sbostic 		move(sp - Noose_pict, 0);
3533111Sbostic 		addstr(*sp);
3633111Sbostic 	}
3733111Sbostic 
3833111Sbostic 	srand(time(NULL) + getpid());
3939843Sbostic 	if ((Dict = fopen(_PATH_DICT, "r")) == NULL) {
4039843Sbostic 		perror(_PATH_DICT);
4133111Sbostic 		endwin();
4233111Sbostic 		exit(1);
4333111Sbostic 	}
4433111Sbostic 	fstat(fileno(Dict), &sbuf);
4533111Sbostic 	Dict_size = sbuf.st_size;
4633111Sbostic }
47