-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
102 lines (88 loc) · 1.59 KB
/
Copy pathmain.cpp
File metadata and controls
102 lines (88 loc) · 1.59 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<iostream>
#include<graphics.h>
#include "Cube.h"
#include "colors.h"
#include "moves.h"
#include<time.h>
#include"cover.h"
using namespace std;
enum{
white,blue,red,green,orange,yellow
};
int main(){
coverPage();
startGame:
initwindow(640,480,"BOX");
initfile();
Cube c;
c.initPoints();
c.drawCube();
delay(500);
char ch;
float t=0;
while(ch!=27){
int flag=0;
setcolor(WHITE);
if(isSolved()){
outtextxy(0,0,"SOLVED!!");
}
toWords(t);
if(kbhit()){
ch=getch();
flag=1;
if(ch=='l'){
t=0;
shuffle();
}
if(ch=='d')
translate(c.curSide,Right,c.retSpin());
else if(ch=='a')
translate(c.curSide,Left,c.retSpin());
else if(ch=='x')
translate(c.curSide,Down,c.retSpin());
else if(ch=='w')
translate(c.curSide,Up,c.retSpin());
else if(ch=='s')
translate(c.curSide,Front,c.retSpin());
else if(ch=='D')
translate(c.curSide,iRight,c.retSpin());
else if(ch=='A')
translate(c.curSide,iLeft,c.retSpin());
else if(ch=='X')
translate(c.curSide,iDown,c.retSpin());
else if(ch=='W')
translate(c.curSide,iUp,c.retSpin());
else if(ch=='S')
translate(c.curSide,iFront,c.retSpin());
else if(ch=='~')
initfile();
}
if(mousex()>600){
flag=1;
c.rotate(1,0);
}
else if(mousex()<50){
flag=1;
c.rotate(-1,0);
}
if(mousey()>420){
flag=1;
c.rotate(0,-1);
}
else if(mousey()<60){
flag=1;
c.rotate(0,1);
}
if(flag){
cleardevice();
c.drawCube();
}
delay(100);
t+=0.1;
}
if(ch==27)
{cleardevice();
closegraph();
exitPage();
}
}