aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: d80f5f35bf029b17bb0b8eae4cc810aff5c11e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "7w.h"
#include <stdlib.h>
#include <stdio.h>
#include <curses.h>

void halt() {
	endwin();
	exit(0);
}

void haltError(char *message, int num) {
	endwin();
	printf("Something has gone wrong, very wrong.\n");
	printf(message);
	printf("\n");
	printf("Number associated with this error: %d\n", num);
	exit(1);
}

void main_routine() {
	int player = 0;
	while (1) {
		if (data_isai(player))
			ai_turn(player);
		else
			player_turn(player);
		if (++player == data_numplayers()) {
			data_endturn();
			player = 0;
		}
	}
}

int main() {
	io_init();
	cards_init();
	int *setupdat = pregame();
	data_init(setupdat[7]);
	int i;
	for (i = 0; i < 7; i++) {
		if (setupdat[i])
			data_setai(i);
	}
	main_routine();
	halt();
}
bgstack15