23 std::vector<flipMove> acts;
26 for (
unsigned int x = 0; x < acts.size(); x++)
30 neighbors.push_back(s);
37 for (
unsigned int x = 0; x < stateID.
width-2; x++)
39 for (
unsigned int y = 0; y < stateID.
width-2; y++)
54 for (
int x = 0; x < 3; x++)
65 std::vector<unsigned int> xloc(state2.
width*2);
66 std::vector<unsigned int> yloc(state2.
width*2);
69 for (
unsigned int x = 0; x < state2.
width; x++)
71 for (
unsigned int y = 0; y < 2; y++)
77 for (
unsigned int x = 0; x < state1.
width; x++)
79 for (
unsigned int y = 0; y < 2; y++)
81 if ((yloc[state1.
puzzle[x + y*state1.
width]] == y) &&
85 else if (yloc[state1.
puzzle[x + y*state1.
width]] == y)
87 int tmp = (xloc[state1.
puzzle[x + y*state1.
width]] - x)/4;
91 int tmp = ((xloc[state1.
puzzle[x + y*state1.
width]] - x)+1)/4;
95 int tmp = (xloc[state1.
puzzle[x + y*state1.
width]] - x)/2;
98 if ((tmp%2) != (yloc[state1.
puzzle[x + y*state1.
width]] - y))
116 return (state == goal);
121 uint64_t hashVal = 0;
122 for (
unsigned int x = 0; x < state.
puzzle.size(); x++)
124 hashVal = hashVal*state.
puzzle.size() + state.
puzzle[x];
142 glEnable(GL_LINE_SMOOTH);
148 for (
int y = 0; y < 2; y++)
150 for (
int x = 0; x <
width; x++)
153 glColor3f(0.0, 1.0, 0.0);
154 glTranslatef(x*2.0/w-1.0+1/(2*w), (1+y)*2.0/h-1.0-1/(2*h), -0.001);
155 glScalef(1.0/(w*fscale), 1.0/(h*fscale), 1);
156 glRotatef(180, 0.0, 0.0, 1.0);
157 glRotatef(180, 0.0, 1.0, 0.0);
168 for (
int y = 0; y <= 2; y++)
170 for (
int x = 0; x <=
width; x++)
172 glVertex3f(x*2.0/w-1.0, -1, -0.001);
173 glVertex3f(x*2.0/w-1.0, 1, -0.001);
174 glVertex3f(-1, (y)*2.0/h-1.0, -0.001);
175 glVertex3f(1, (y)*2.0/h-1.0, -0.001);