-
Notifications
You must be signed in to change notification settings - Fork 0
/
win.c
58 lines (51 loc) · 999 Bytes
/
win.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
#include <stdint.h>
#include <pic32mx.h>
#include "mipslab.h"
#include <stdio.h>
#include <stdlib.h>
void player1_win(){
display_string(2, "Player 1 wins!");
display_update();
PORTE = 0;
for(light_counter = 256; light_counter >= 1; light_counter/=2){
delay(150);
PORTESET = light_counter;
}
delay(100);
PORTE = 0;
delay(300);
PORTESET = 511;
delay(1000);
quit();
}
void player2_win(){
display_string(2, "Player 2 wins!");
display_update();
PORTE = 1;
for(light_counter = 2; light_counter < 256; light_counter*=2){
delay(150);
PORTESET = light_counter;
}
delay(100);
PORTE = 0;
delay(300);
PORTESET = 511;
delay(1000);
quit();
}
void ai_win(){
display_string(2, "AI wins");
display_update();
PORTE = 0;
for(light_counter = 256; light_counter >= 1; light_counter/=2){
delay(150);
PORTESET = light_counter;
}
delay(100);
PORTE = 0;
delay(300);
PORTESET = 511;
delay(1000);
clearDisplay();
quit_ai();
}