-
Notifications
You must be signed in to change notification settings - Fork 1
/
hex.h
52 lines (40 loc) · 988 Bytes
/
hex.h
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
bagger hex( bagger bagged, int d, int N) {
/*
this function is called by hop(), minihop(), and laser()
its purpose is to move along hexagonal tiles
to update bagged.s.
I don't pass bagged.s by reference because I sometimes want to have multiple s's.
bagged.s is the state of Emi as defined in hop.h
d is a number 1 through 6 that defines which direction to alter bagged.s...
1 is up, 2 is NE, 3 is SE, 4 is down, 5 is SW, and 6 is NW
N is the number of alteration to be made in that direction (negative N
makes alterations as if d were the opposite direction)
(c) 2019 Bradley Knockel
*/
switch(d){
case 1:
bagged.s[1] += -2*N;
break;
case 2:
bagged.s[1] += -N;
bagged.s[2] += N;
break;
case 3:
bagged.s[1] += N;
bagged.s[2] += N;
break;
case 4:
bagged.s[1] += 2*N;
break;
case 5:
bagged.s[1] += N;
bagged.s[2] += -N;
break;
case 6:
bagged.s[1] += -N;
bagged.s[2] += -N;
break;
}
bagged.s[0] = (lSize[1] * bagged.s[1] + bagged.s[2])/2 ;
return bagged;
}