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

⟦2283010a8⟧ TextFile

    Length: 1103 (0x44f)
    Types: TextFile
    Names: »demo.c«

Derivation

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

TextFile

#include "challenge.h"

do_demo()
{
    int finished, player = COMPUTER;
    int card, card1;

    finished = FALSE;
    while(!finished) {
	move(COMMAND_LINE, COMMAND_POS);
	clrtoeol();
	if(player == COMPUTER) {
	    printw("thinking....");
	} else {
	    printw("also thinking....");
	}
	move(COMMENT_LINE, 1);
	clrtoeol();
	refresh();
	demo = player;
	card = strategy(player);
	if(card != PASS) {
	    move(COMMAND_LINE - 1, 1);
	    clrtoeol();
	    if(card <= PICK_UP) {
		finished = do_move(player, card);
	    } else {
		finished = TRUE;
		break;
	    }
	    move(COMMAND_LINE - 1, 1);
	    clrtoeol();
	    if(player == COMPUTER) {
		printw("computer");
	    } else {
		printw("human replacement");
	    }
	    if(card != PICK_UP) {
		printw(" plays ");
		display_full(top);
	    } else {
		printw(" picks up");
	    }
	}
	if(!finished) {
	    interchange(&player);
	}
    }
    if(card <= PICK_UP) {
	printw(", and wins");
    } else {
	printw("game is a draw");
    }
    if(player == COMPUTER) {
	computer_score += 2;
    } else {
	human_score += 2;
    }
    /* NOTE: no case for WIN! */
}