xref: /csrg-svn/games/hangman/setup.c (revision 39843)
133111Sbostic /*
234781Sbostic  * Copyright (c) 1983 Regents of the University of California.
333111Sbostic  * All rights reserved.
433111Sbostic  *
533111Sbostic  * Redistribution and use in source and binary forms are permitted
634781Sbostic  * provided that the above copyright notice and this paragraph are
734781Sbostic  * duplicated in all such forms and that any documentation,
834781Sbostic  * advertising materials, and other materials related to such
934781Sbostic  * distribution and use acknowledge that the software was developed
1034781Sbostic  * by the University of California, Berkeley.  The name of the
1134781Sbostic  * University may not be used to endorse or promote products derived
1234781Sbostic  * from this software without specific prior written permission.
1334781Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1434781Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1534781Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1633111Sbostic  */
1733111Sbostic 
1833111Sbostic #ifndef lint
19*39843Sbostic static char sccsid[] = "@(#)setup.c	5.3 (Berkeley) 01/02/90";
2033111Sbostic #endif /* not lint */
2133111Sbostic 
2233111Sbostic # include	"hangman.h"
2333111Sbostic 
2433111Sbostic /*
2533111Sbostic  * setup:
2633111Sbostic  *	Set up the strings on the screen.
2733111Sbostic  */
2833111Sbostic setup()
2933111Sbostic {
3033111Sbostic 	register char		**sp;
3133111Sbostic 	static struct stat	sbuf;
3233111Sbostic 
3333111Sbostic 	noecho();
3433111Sbostic 	crmode();
3533111Sbostic 
3633111Sbostic 	mvaddstr(PROMPTY, PROMPTX, "Guess:");
3733111Sbostic 	mvaddstr(GUESSY, GUESSX, "Guessed:");
3833111Sbostic 	mvaddstr(NUMBERY, NUMBERX, "Word #:");
3933111Sbostic 	mvaddstr(AVGY, AVGX, "Current Average:");
4033111Sbostic 	mvaddstr(AVGY + 1, AVGX, "Overall Average:");
4133111Sbostic 	mvaddstr(KNOWNY, KNOWNX, "Word: ");
4233111Sbostic 
4333111Sbostic 	for (sp = Noose_pict; *sp != NULL; sp++) {
4433111Sbostic 		move(sp - Noose_pict, 0);
4533111Sbostic 		addstr(*sp);
4633111Sbostic 	}
4733111Sbostic 
4833111Sbostic 	srand(time(NULL) + getpid());
49*39843Sbostic 	if ((Dict = fopen(_PATH_DICT, "r")) == NULL) {
50*39843Sbostic 		perror(_PATH_DICT);
5133111Sbostic 		endwin();
5233111Sbostic 		exit(1);
5333111Sbostic 	}
5433111Sbostic 	fstat(fileno(Dict), &sbuf);
5533111Sbostic 	Dict_size = sbuf.st_size;
5633111Sbostic }
57