Rev 7142 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7142 | siemargl | 1 | #include |
2 | #include |
||
3 | #include |
||
7185 | siemargl | 4 | |
7142 | siemargl | 5 | #ifndef WINDOWS |
7185 | siemargl | 6 | #ifndef KOS32 |
7142 | siemargl | 7 | #include |
8 | #include |
||
9 | #include |
||
10 | #endif |
||
7185 | siemargl | 11 | #endif |
7142 | siemargl | 12 | |
13 | void randomize(void) { |
||
14 | srand((int)time(NULL)); |
||
15 | } |
||
16 | |||
7185 | siemargl | 17 | #if !defined(KOS32) && !defined(__TINYC__) |
7142 | siemargl | 18 | int max(int a, int b) { |
19 | if (a > b) return a; |
||
20 | return b; |
||
21 | } |
||
22 | |||
23 | int min(int a, int b) { |
||
24 | if (a < b) return a; |
||
25 | return b; |
||
26 | } |
||
7185 | siemargl | 27 | #endif |
28 | |||
7142 | siemargl | 29 | #ifndef WINDOWS |
7185 | siemargl | 30 | #ifndef KOS32 |
7142 | siemargl | 31 | int // |
32 | getch// |
||
33 | (void) { |
||
34 | char chbuf[1]; |
||
35 | struct termios oldstate, newstate; |
||
36 | fflush(stdout); |
||
37 | tcgetattr(0, &oldstate); |
||
38 | newstate = oldstate; |
||
39 | newstate.c_lflag &= ~ICANON; |
||
40 | newstate.c_lflag &= ~ECHO; |
||
41 | tcsetattr(0, TCSANOW, &newstate); |
||
42 | read(0, &chbuf, 1); |
||
43 | tcsetattr(0, TCSANOW, &oldstate); |
||
44 | return chbuf[0]; |
||
45 | } |
||
7185 | siemargl | 46 | #endif |
7142 | siemargl | 47 | #endif> |