-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconqmain.c
73 lines (61 loc) · 1.19 KB
/
conqmain.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#define GLOBAL_DEFINITION_OR_EXTERN /**/
#include "defs.h"
#include "structs.h"
#include "vars.h"
#include <stdio.h>
#include <curses.h>
main()
{
initscr();
printw("\n *** CONQUEST *** \n");
initconst();
initmach();
do {
inputplayer();
if (!game_over) {
inputmach();
move_ships();
battle();
if (production_year == 4 && turn < 100) {
invest();
}
up_year();
}
check_game_over();
}
while (!game_over);
endwin();
}
point(col,row)
{
move(row-1, col-1); // curses is 0-based
x_cursor = col;
y_cursor = row;
if ( (x_cursor < 20) && (y_cursor != 18) )
left_line[y_cursor] = true;
}
int
rnd(i)
int i;
{
int k;
k = lrand48() / 2;
k = (k % i) + 1;
return(k);
}
int
conq_round(x)
float x;
{
if ( x < 0.0)
return ((int)(x-.5));
else
return ((int)(x+.5));
}
int
min(a,b)
int a;
int b;
{
return a<b?a:b;
}