-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.h
More file actions
58 lines (51 loc) · 860 Bytes
/
Copy pathgame.h
File metadata and controls
58 lines (51 loc) · 860 Bytes
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
int temp;
static unsigned char transfer;
static unsigned int check_number;
void idle(){
while(START==0) //Wait for user to start
;
}
void start_game(){
P1 = 0;
START_O = 1;
for(temp=0;temp<game_number;temp++){
P1 = xbyte[randbyte[temp]];
delay(1000);
P1 = 0;
}
P1 = 0;
game_number++;
check_number = game_number - 1;
P2 = game_number;
START_O = 0;
}
int check_game(unsigned int transfer, int temp){
if(transfer==xbyte[randbyte[temp]]){
P2 = 0x16;
CORRECT = 1;
return 1;
}else{
P1 = ~transfer;
P2 = xbyte[randbyte[temp]];
game_number = 1;
GAMEOVER = 1;
CORRECT = 0;
return 0;
}
}
void get(){
CORRECT = 0;
GAMEOVER = 0;
for(temp=0;temp<check_number;temp++){
while(P0==0xFF)
;
transfer = ~P0;
P1 = ~P0;
delay(1000);
while(P0!=0xFF)
;
if(check_game(transfer, temp) == 0){
break;
}
}
}