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 d

⟦bafd5dbb4⟧ TextFile

    Length: 2953 (0xb89)
    Types: TextFile
    Names: »doloop.c«

Derivation

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

TextFile

/*
 * $Header: doloop.c,v 3.0 88/03/10 12:07:19 hale Locked $
 */

/*

        Copyright 1987      Greg Hale

Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation.  No representations are made about the
suitability of this software for any purpose.  It is
provided "as is" without express or implied warranty.

*/


#include "go.h"

extern int mesflg, demflg, loadflg;


DoLoop()
{
	char c;
	c = GetAKey0();
	if (mesflg) domesg(c);
	else if ((c=='e') || (!chkmve(c) && !disable)) {
		switch (c) {
			WHEN REDRAW: touchwin(stdscr);
				clear();
				PrintBoard(&board);


			WHEN 'e':
				SetStat(EXIT);
				SEND(MEXIT);
			
			WHEN 'S':
				dosave();
			WHEN '#':
				if (loadflg) doload();
				else Beep();

			WHEN 'q': if (AreWe(SCORE)) {
					SEND(MQUIT);
					disable = 1;
					}
			WHEN 't': if (AreWe(SCORE)) dotally();

			WHEN 'c': if (AreWe(SCORE)) {
				docancel();
				SEND(MCANCEL);
				}

			WHEN 'C': 
				if (demflg && AreWe(HANDICAP)) {
					SEND(MCLEAR);
					doclear();
				}

			WHEN 'm':
				mesflg++;
				
			WHEN 'R':
				SEND(MRESIGN);
				doresign(true);

			WHEN 's': if(AreWe(HANDICAP)) {
					SEND(MSWITCH);
					doswitch();
				} else if (AreWe(PLAY)) {
					SEND(MSCORE);
					ClrStat(PLAY);
					doscore();
				}

			WHEN '/': if (AreWe(PLAY)) {
					ShowLast();
				    } else Beep();
			WHEN 'p': if (AreWe(PLAY) && myturn) {
					curplr = !curplr;
					SEND(MPASS);
				} else if (AreWe(HANDICAP)) {
					SEND(MPLAY);
					doplay();
				}
			WHEN '?': help(); PrintBoard(&board);

			WHEN '1': DoHand(cx,cy,0);
			WHEN '2': DoHand(cx,cy,1);


			WHEN ' ':
				if (AreWe(HANDICAP))
					if (demflg)
						dodemo(cx,cy,1);
					else
						sethand(cx,cy,!b(cx,cy));
				else if (AreWe(SCORE))
					doscorehit(cx,cy);
				else if (AreWe(PLAY) && myturn)
					putpiece(cx,cy,curplr,true);
			OTHERWISE: ;
		}
	}
}
/*
 * $Log:	doloop.c,v $
 * Revision 3.0  88/03/10  12:07:19  hale
 * Added save games, a few changes to the I/O,
 * added load and clear options.  Not thouroughly tested, though, and
 * I think a few bugs are in the load code.  A library of sample problems
 * has been started and saved with the working directory.
 * 
 * Revision 1.4  88/02/19  13:48:21  hale
 * Added io changes for loading games.
 * Load game is cleaned up.  Variable board
 * sizes and formats available in save game
 * as well as printed comments.
 * 
 * Revision 1.3  88/02/14  00:22:46  hale
 * Added load file option during game to restore game to starting
 * state.  Also, clear board operation.  Restoring game puts current
 * player in sync.  With the demo mode, this is invaluable.
 * 
 * Revision 1.2  88/02/13  12:46:27  hale
 * added several commands for save game and resign.
 * 
 */