-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpare.cpp
More file actions
70 lines (59 loc) · 1.98 KB
/
Copy pathSpare.cpp
File metadata and controls
70 lines (59 loc) · 1.98 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
/*
This page is used for storing experimental code to possibly improve/clean up the original program.
WARNING!!! Code on this page is not expected to be good, good looking or even working.
Code on this page is also not compiled.
*/
switch(){
step1: //Diagonal down right movement
case xAxis< destinationX && yAxis< destinationY:
xAxis++;
yAxis++;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step2: //Diagonal up left movement
case xAxis> destinationX && yAxis> destinationY:
xAxis--;
yAxis--;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step3: //Diagonal down left movement
case xAxis> destinationX && yAxis< destinationY:
xAxis--;
yAxis++;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step4: //Diagonal up right movement
case xAxis< destinationX && yAxis> destinationY:
xAxis++;
yAxis--;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step5: //Right movement
case xAxis< destinationX:
xAxis++;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step6: //Left movement
case xAxis> destinationX:
xAxis--;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step7: //Up movement
case yAxis< destinationY:
yAxis++;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
step8: //Down movement
case yAxis> destinationY:
yAxis--;
moveCounter++;
pathMap[xAxis][yAxis]+= 1;
continue;
}