ReactOS 0.4.15-dev-7788-g1ad9096
maze.c
Go to the documentation of this file.
1/******************************************************************************
2 * [ maze ] ...
3 *
4 * modified: [ 03-08-15 ] Ge van Geldorp <ge@gse.nl>
5 * ported to ReactOS
6 * modified: [ 94-10-8 ] Ge van Geldorp <Ge.vanGeldorp@lr.tudelft.nl>
7 * ported to MS Windows
8 * modified: [ 3-7-93 ] Jamie Zawinski <jwz@lucid.com>
9 * added the XRoger logo, cleaned up resources, made
10 * grid size a parameter.
11 * modified: [ 3-3-93 ] Jim Randell <jmr@mddjmr.fc.hp.com>
12 * Added the colour stuff and integrated it with jwz's
13 * screenhack stuff. There's still some work that could
14 * be done on this, particularly allowing a resource to
15 * specify how big the squares are.
16 * modified: [ 10-4-88 ] Richard Hess ...!uunet!cimshop!rhess
17 * [ Revised primary execution loop within main()...
18 * [ Extended X event handler, check_events()...
19 * modified: [ 1-29-88 ] Dave Lemke lemke@sun.com
20 * [ Hacked for X11...
21 * [ Note the word "hacked" -- this is extremely ugly, but at
22 * [ least it does the job. NOT a good programming example
23 * [ for X.
24 * original: [ 6/21/85 ] Martin Weiss Sun Microsystems [ SunView ]
25 *
26 ******************************************************************************
27 Copyright 1988 by Sun Microsystems, Inc. Mountain View, CA.
28
29 All Rights Reserved
30
31 Permission to use, copy, modify, and distribute this software and its
32 documentation for any purpose and without fee is hereby granted,
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in
35 supporting documentation, and that the names of Sun or MIT not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific prior written permission. Sun and M.I.T.
38 make no representations about the suitability of this software for
39 any purpose. It is provided "as is" without any express or implied warranty.
40
41 SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 PURPOSE. IN NO EVENT SHALL SUN BE LIABLE FOR ANY SPECIAL, INDIRECT
44 OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
45 OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
46 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
47 OR PERFORMANCE OF THIS SOFTWARE.
48 *****************************************************************************/
49
50#define STRICT
51
52#include <windows.h> /* required for all Windows applications */
53#include <scrnsave.h>
54#include <tchar.h>
55#include <stdlib.h>
56#include <commctrl.h>
57#include <string.h>
58#include <time.h>
59#include "resource.h"
60
61#define APPNAME _T("Maze")
62
64static int choose_door();
65static long backup();
66static void draw_wall();
67static void draw_solid_square(int, int, int, HDC, HBRUSH);
68static void enter_square(int, HDC, HBRUSH);
69
70extern HINSTANCE hMainInstance; /* current instance */
75
77
78#define MAX_MAZE_SIZE_X ((unsigned long) 1000) // Dynamic detection?
79#define MAX_MAZE_SIZE_Y ((unsigned long) 1000) // Dynamic detection?
80
81#define MOVE_LIST_SIZE (MAX_MAZE_SIZE_X * MAX_MAZE_SIZE_Y)
82
83#define WALL_TOP 0x8000
84#define WALL_RIGHT 0x4000
85#define WALL_BOTTOM 0x2000
86#define WALL_LEFT 0x1000
87
88#define DOOR_IN_TOP 0x800
89#define DOOR_IN_RIGHT 0x400
90#define DOOR_IN_BOTTOM 0x200
91#define DOOR_IN_LEFT 0x100
92#define DOOR_IN_ANY 0xF00
93
94#define DOOR_OUT_TOP 0x80
95#define DOOR_OUT_RIGHT 0x40
96#define DOOR_OUT_BOTTOM 0x20
97#define DOOR_OUT_LEFT 0x10
98
99#define START_SQUARE 0x2
100#define END_SQUARE 0x1
101
102#define border_x (0)
103#define border_y (0)
104
105#define get_random(x) (rand() % (x))
106
107static unsigned short maze[MAX_MAZE_SIZE_X][MAX_MAZE_SIZE_Y];
108
109static struct {
110 unsigned int x;
111 unsigned int y;
112 unsigned int dir;
114
116static long sqnum, path_length;
117static int cur_sq_x, cur_sq_y;
120static int bw;
121static int state = 1, pathi = 0;
122static LPCWSTR registryPath = _T("Software\\Microsoft\\ScreenSavers\\mazescr");
123
124static void SetDefaults()
125{
126 size = 10;
127 pre_solve_delay = 5000;
128 post_solve_delay = 5000;
129 solve_delay = 1;
130}
131
132static void ReadRegistry()
133{
134 LONG result;
135 HKEY skey;
136 DWORD valuetype, valuesize, val_size, val_presd, val_postsd, val_sd;
137
138 SetDefaults();
139
141 if(result != ERROR_SUCCESS)
142 return;
143
144 valuesize = sizeof(DWORD);
145
146 result = RegQueryValueEx(skey, _T("size"), NULL, &valuetype, (LPBYTE)&val_size, &valuesize);
147 if(result == ERROR_SUCCESS)
148 size = val_size;
149 result = RegQueryValueEx(skey, _T("pre_solve_delay"), NULL, &valuetype, (LPBYTE)&val_presd, &valuesize);
150 if(result == ERROR_SUCCESS)
151 pre_solve_delay = val_presd;
152 result = RegQueryValueEx(skey, _T("post_solve_delay"), NULL, &valuetype, (LPBYTE)&val_postsd, &valuesize);
153 if(result == ERROR_SUCCESS)
154 post_solve_delay = val_postsd;
155 result = RegQueryValueEx(skey, _T("solve_delay"), NULL, &valuetype, (LPBYTE)&val_sd, &valuesize);
156 if(result == ERROR_SUCCESS)
157 solve_delay = val_sd;
158
159 RegCloseKey(skey);
160}
161
162static void WriteRegistry()
163{
164 LONG result;
165 HKEY skey;
166 DWORD disp;
167
169 if(result != ERROR_SUCCESS)
170 return;
171
172 RegSetValueEx(skey, _T("size"), 0, REG_DWORD, (LPBYTE)&size, sizeof(size));
173 RegSetValueEx(skey, _T("pre_solve_delay"), 0, REG_DWORD, (LPBYTE)&pre_solve_delay, sizeof(pre_solve_delay));
174 RegSetValueEx(skey, _T("post_solve_delay"), 0, REG_DWORD, (LPBYTE)&post_solve_delay, sizeof(post_solve_delay));
175 RegSetValueEx(skey, _T("solve_delay"), 0, REG_DWORD, (LPBYTE)&solve_delay, sizeof(solve_delay));
176
177 RegCloseKey(skey);
178}
179
181int width, height;
182{
189}
190
191static void initialize_maze() /* draw the surrounding wall and start/end squares */
192{
193 register int i, j, wall;
194
195 /* initialize all squares */
196 for (i = 0; i < maze_size_x; i++) {
197 for (j = 0; j < maze_size_y; j++) {
198 maze[i][j] = 0;
199 }
200 }
201
202 /* top wall */
203 for (i = 0; i < maze_size_x; i++) {
204 maze[i][0] |= WALL_TOP;
205 }
206
207 /* right wall */
208 for (j = 0; j < maze_size_y; j++) {
209 maze[maze_size_x - 1][j] |= WALL_RIGHT;
210 }
211
212 /* bottom wall */
213 for (i = 0; i < maze_size_x; i++) {
214 maze[i][maze_size_y - 1] |= WALL_BOTTOM;
215 }
216
217 /* left wall */
218 for (j = 0; j < maze_size_y; j++) {
219 maze[0][j] |= WALL_LEFT;
220 }
221
222 /* set start square */
223 wall = get_random(4);
224 switch (wall) {
225 case 0:
227 j = 0;
228 break;
229 case 1:
230 i = maze_size_x - 1;
232 break;
233 case 2:
235 j = maze_size_y - 1;
236 break;
237 case 3:
238 i = 0;
240 break;
241 }
242 maze[i][j] |= START_SQUARE;
243 maze[i][j] |= (DOOR_IN_TOP >> wall);
244 maze[i][j] &= ~(WALL_TOP >> wall);
245 cur_sq_x = i;
246 cur_sq_y = j;
247 start_x = i;
248 start_y = j;
249 start_dir = wall;
250 sqnum = 0;
251
252 /* set end square */
253 wall = (wall + 2) % 4;
254 switch (wall) {
255 case 0:
257 j = 0;
258 break;
259 case 1:
260 i = maze_size_x - 1;
262 break;
263 case 2:
265 j = maze_size_y - 1;
266 break;
267 case 3:
268 i = 0;
270 break;
271 }
272 maze[i][j] |= END_SQUARE;
273 maze[i][j] |= (DOOR_OUT_TOP >> wall);
274 maze[i][j] &= ~(WALL_TOP >> wall);
275 end_x = i;
276 end_y = j;
277 end_dir = wall;
278}
279
280static void create_maze(HWND hWnd) /* create a maze layout given the initialized maze */
281{
282 register int i, newdoor = 0;
283
284 do {
287 move_list[sqnum].dir = newdoor;
288 while ((newdoor = choose_door(hDC)) == -1) { /* pick a door */
289 if (backup() == -1) { /* no more doors ... backup */
290 return; /* done ... return */
291 }
292 }
293
294 /* mark the out door */
295 maze[cur_sq_x][cur_sq_y] |= (DOOR_OUT_TOP >> newdoor);
296
297 switch (newdoor) {
298 case 0: cur_sq_y--;
299 break;
300 case 1: cur_sq_x++;
301 break;
302 case 2: cur_sq_y++;
303 break;
304 case 3: cur_sq_x--;
305 break;
306 }
307 sqnum++;
308
309 /* mark the in door */
310 maze[cur_sq_x][cur_sq_y] |= (DOOR_IN_TOP >> ((newdoor + 2) % 4));
311
312 /* if end square set path length and save path */
315 for (i = 0; i < path_length; i++) {
316 save_path[i].x = move_list[i].x;
317 save_path[i].y = move_list[i].y;
318 save_path[i].dir = move_list[i].dir;
319 }
320 }
321 } while (1);
322}
323
324static int choose_door(HDC hDC) /* pick a new path */
325{
326 int candidates[3];
327 register int num_candidates;
328
329 num_candidates = 0;
330
331 /* top wall */
333 goto rightwall;
335 goto rightwall;
337 goto rightwall;
338 if (maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY) {
342 goto rightwall;
343 }
344 candidates[num_candidates++] = 0;
345
346rightwall:
347 /* right wall */
349 goto bottomwall;
351 goto bottomwall;
353 goto bottomwall;
354 if (maze[cur_sq_x + 1][cur_sq_y] & DOOR_IN_ANY) {
358 goto bottomwall;
359 }
360 candidates[num_candidates++] = 1;
361
362bottomwall:
363 /* bottom wall */
365 goto leftwall;
367 goto leftwall;
369 goto leftwall;
370 if (maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY) {
374 goto leftwall;
375 }
376 candidates[num_candidates++] = 2;
377
378leftwall:
379 /* left wall */
381 goto donewall;
383 goto donewall;
385 goto donewall;
386 if (maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY) {
390 goto donewall;
391 }
392 candidates[num_candidates++] = 3;
393
394donewall:
395 if (num_candidates == 0)
396 return -1;
397 if (num_candidates == 1)
398 return candidates[0];
399 return candidates[get_random(num_candidates)];
400
401}
402
403static long backup() /* back up a move */
404{
405 sqnum--;
406 if (0 <= sqnum) {
409 }
410 return sqnum;
411}
412
413static void draw_solid_square(i, j, dir, hDC, hBrush) /* draw a solid square in a square */
414register int i, j, dir;
415HDC hDC;
416HBRUSH hBrush;
417{
418 RECT rc;
419
420 switch (dir) {
421 case 0:
422 rc.left = border_x + bw + grid_width * i;
423 rc.right = rc.left + grid_width - (bw + bw);
424 rc.top = border_y - bw + grid_height * j;
425 rc.bottom = rc.top + grid_height;
426 break;
427 case 1:
428 rc.left = border_x + bw + grid_width * i;
429 rc.right = rc.left + grid_width;
430 rc.top = border_y + bw + grid_height * j;
431 rc.bottom = rc.top + grid_height - (bw + bw);
432 break;
433 case 2:
434 rc.left = border_x + bw + grid_width * i;
435 rc.right = rc.left + grid_width - (bw + bw);
436 rc.top = border_y + bw + grid_height * j;
437 rc.bottom = rc.top + grid_height;
438 break;
439 case 3:
440 rc.left = border_x - bw + grid_width * i;
441 rc.right = rc.left + grid_width;
442 rc.top = border_y + bw + grid_height * j;
443 rc.bottom = rc.top + grid_height - (bw + bw);
444 break;
445 }
446 (void) FillRect(hDC, &rc, hBrush);
447}
448
449static void draw_maze_border(HWND hWnd) /* draw the maze outline */
450{
451 register int i, j;
452 HBRUSH hBrush;
453
455
456 for (i = 0; i < maze_size_x; i++) {
457 if (maze[i][0] & WALL_TOP) {
459 (void) LineTo(hDC, border_x + grid_width * (i + 1) - 1, border_y);
460 }
461 if ((maze[i][maze_size_y - 1] & WALL_BOTTOM)) {
463 (void) LineTo(hDC, border_x + grid_width * (i + 1) - 1, border_y + grid_height * (maze_size_y) -1);
464 }
465 }
466 for (j = 0; j < maze_size_y; j++) {
467 if (maze[maze_size_x - 1][j] & WALL_RIGHT) {
470 }
471 if (maze[0][j] & WALL_LEFT) {
473 (void) LineTo(hDC, border_x, border_y + grid_height * (j + 1) - 1);
474 }
475 }
476
477 hBrush = GetStockObject(WHITE_BRUSH);
480}
481
482static void draw_wall(i, j, dir, hDC) /* draw a single wall */
483register int i, j, dir;
484HDC hDC;
485{
487
488 switch (dir) {
489 case 0:
492 break;
493 case 1:
495 (void) LineTo(hDC, border_x + grid_width * (i + 1), border_y + grid_height * (j + 1));
496 break;
497 case 2:
499 (void) LineTo(hDC, border_x + grid_width * (i + 1), border_y + grid_height * (j + 1));
500 break;
501 case 3:
504 break;
505 }
506}
507
508static void begin_solve_maze(HWND hWnd) /* solve it with graphical feedback */
509{
510 /* plug up the surrounding wall */
512 maze[end_x][end_y] |= (WALL_TOP >> end_dir);
513
514 /* initialize search path */
515 pathi = 0;
516 path[pathi].x = end_x;
517 path[pathi].y = end_y;
518 path[pathi].dir = -1;
519}
520
521static int solve_maze(HWND hWnd) /* solve it with graphical feedback */
522{
523 int ret;
524 int action_done;
525
526 do {
527 action_done = 1;
528 if (++path[pathi].dir >= 4) {
529 pathi--;
530 draw_solid_square((int) (path[pathi].x), (int) (path[pathi].y), (int) (path[pathi].dir), hDC, hBrushDead);
531 ret = 0;
532 }
533 else if (!(maze[path[pathi].x][path[pathi].y] & (WALL_TOP >> path[pathi].dir)) &&
534 ((pathi == 0) || ((path[pathi].dir != (int) (path[pathi - 1].dir + 2) % 4)))) {
536 pathi++;
537 if (maze[path[pathi].x][path[pathi].y] & START_SQUARE) {
538
539 ret = 1;
540 }
541 else {
542 ret = 0;
543 }
544 }
545 else {
546 action_done = 0;
547 }
548 } while (!action_done);
549 return ret;
550}
551
552static void enter_square(int n, HDC hDC, HBRUSH hBrush) /* move into a neighboring square */
553{
554 draw_solid_square((int) path[n].x, (int) path[n].y, (int) path[n].dir, hDC, hBrush);
555
556 path[n + 1].dir = -1;
557 switch (path[n].dir) {
558 case 0: path[n + 1].x = path[n].x;
559 path[n + 1].y = path[n].y - 1;
560 break;
561 case 1: path[n + 1].x = path[n].x + 1;
562 path[n + 1].y = path[n].y;
563 break;
564 case 2: path[n + 1].x = path[n].x;
565 path[n + 1].y = path[n].y + 1;
566 break;
567 case 3: path[n + 1].x = path[n].x - 1;
568 path[n + 1].y = path[n].y;
569 break;
570 }
571}
572
573static void start_timer(HWND hWnd, int iTimeout)
574{
575 SetTimer(hWnd, 1, iTimeout, NULL);
576}
577
578static BOOL OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
579{
580 srand((unsigned) time(NULL));
581
582 ReadRegistry();
583
584 if (size < 2) {
585 size = 7 + (rand() % 30);
586 }
588 bw = (size > 6 ? 3 : (size - 1) / 2);
589
590#if 0
591 /* FIXME Pattern brushes not yet implemented in ReactOS */
592 {
593 static long grayPattern [] = {
594 0x55555555,
595 0xaaaaaaaa,
596 0x55555555,
597 0xaaaaaaaa,
598 0x55555555,
599 0xaaaaaaaa,
600 0x55555555,
601 0xaaaaaaaa
602 };
603 static RGBQUAD argbq [] = {
604 { 0, 0, 255, 0 },
605 { 255, 255, 255, 0 }
606 };
608
609 pbmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(argbq) + sizeof(grayPattern));
616 (void) memcpy(pbmi->bmiColors, argbq, sizeof(argbq));
617 (void) memcpy(pbmi->bmiColors + 2, grayPattern, sizeof(grayPattern));
619 // hBrushDead = CreateHatchBrush(HS_DIAGCROSS, RGB(255, 0, 0));
620 free(pbmi);
621 }
622#else
623 hBrushDead = CreateSolidBrush(RGB(255, 0, 0));
624#endif
625 hBrushLiving = CreateSolidBrush(RGB(0, 255, 0));
626 hPenWall = CreatePen(PS_SOLID, 3, RGB(150, 150, 150));
627
628 hDC = GetDC(hWnd);
629
630 start_timer(hWnd, 1);
631
632 return TRUE;
633}
634
636{
637 switch(message){
638 case WM_COMMAND:
639 switch(LOWORD(wparam)){
640 case IDOK:
642 return TRUE;
643 }
644 }
645 return FALSE;
646}
647
649{
652
655
658
661}
662
664 HWND hWnd, // window handle
665 UINT message, // type of message
666 WPARAM wParam, // additional information
667 LPARAM lParam) // additional information
668{
669 switch (message)
670 {
671 case WM_CREATE:
673 break;
674 case WM_SIZE:
676 break;
677 case WM_TIMER:
678 switch (state)
679 {
680 case 2:
682
683 state = 3;
684
686 break;
687 case 3:
688 if (!solve_maze(hWnd))
689 {
691 }
692 else
693 {
694 state = 1;
696 }
697 break;
698 default:
700
703
705
706 state = 2;
707
709 break;
710 }
711 break;
712 case WM_DESTROY: // message: window being destroyed
716 break;
717 default: // Passes it on if unprocessed
719 }
720 return 0;
721}
722
724{
725 switch (message)
726 {
727 case WM_INITDIALOG:
728 ReadRegistry();
729 //Set slider ranges
734 //Set current values to slider
739 //Set current values to texts
744 return TRUE;
745 case WM_COMMAND:
746 switch (LOWORD(wparam))
747 {
748 case IDOK:
751 return TRUE;
752 case IDCANCEL:
754 break;
755 case IDABOUT:
757 break;
758 }
759 case WM_HSCROLL:
761 return TRUE;
762 }
763 return FALSE;
764}
765
767{
768 return TRUE;
769}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
static unsigned short maze[MAX_MAZE_SIZE_X][MAX_MAZE_SIZE_Y]
Definition: maze.c:107
#define DOOR_OUT_LEFT
Definition: maze.c:97
static int bw
Definition: maze.c:120
static int solve_delay
Definition: maze.c:76
#define DOOR_IN_BOTTOM
Definition: maze.c:90
static struct @1549 save_path[MOVE_LIST_SIZE]
static void start_timer(HWND hWnd, int iTimeout)
Definition: maze.c:573
static int choose_door()
static void set_maze_sizes(int width, int height)
Definition: maze.c:180
static void SetDefaults()
Definition: maze.c:124
static int start_x
Definition: maze.c:118
static void enter_square(int, HDC, HBRUSH)
Definition: maze.c:552
#define MAX_MAZE_SIZE_X
Definition: maze.c:78
INT_PTR CALLBACK AboutProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: maze.c:635
static BOOL OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
Definition: maze.c:578
static int maze_size_y
Definition: maze.c:115
static int size
Definition: maze.c:76
#define MAX_MAZE_SIZE_Y
Definition: maze.c:79
static void ReadSettings(HWND hWnd)
Definition: maze.c:648
#define DOOR_IN_LEFT
Definition: maze.c:91
#define MOVE_LIST_SIZE
Definition: maze.c:81
#define START_SQUARE
Definition: maze.c:99
#define DOOR_IN_ANY
Definition: maze.c:92
static void ReadRegistry()
Definition: maze.c:132
static void WriteRegistry()
Definition: maze.c:162
unsigned int x
Definition: maze.c:110
HBRUSH hBrushLiving
Definition: maze.c:72
static int post_solve_delay
Definition: maze.c:76
static int cur_sq_y
Definition: maze.c:117
HBRUSH hBrushDead
Definition: maze.c:71
HINSTANCE hMainInstance
Definition: scrnsave.c:26
HDC hDC
Definition: maze.c:74
#define DOOR_OUT_RIGHT
Definition: maze.c:95
#define WALL_LEFT
Definition: maze.c:86
static struct @1549 move_list[MOVE_LIST_SIZE]
#define DOOR_IN_RIGHT
Definition: maze.c:89
static long sqnum
Definition: maze.c:116
static int start_dir
Definition: maze.c:118
static void initialize_maze()
Definition: maze.c:191
static LPCWSTR registryPath
Definition: maze.c:122
static int start_y
Definition: maze.c:118
static int state
Definition: maze.c:121
static int grid_width
Definition: maze.c:119
#define WALL_RIGHT
Definition: maze.c:84
static int grid_height
Definition: maze.c:119
static long path_length
Definition: maze.c:116
static int end_dir
Definition: maze.c:118
#define DOOR_IN_TOP
Definition: maze.c:88
static int pathi
Definition: maze.c:121
#define DOOR_OUT_TOP
Definition: maze.c:94
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam)
Definition: maze.c:663
static int cur_sq_x
Definition: maze.c:117
#define END_SQUARE
Definition: maze.c:100
HPEN hPenWall
Definition: maze.c:73
static void draw_maze_border(HWND hWnd)
Definition: maze.c:449
static int pre_solve_delay
Definition: maze.c:76
static void draw_solid_square(int, int, int, HDC, HBRUSH)
Definition: maze.c:413
unsigned int y
Definition: maze.c:111
static void draw_wall()
#define WALL_TOP
Definition: maze.c:83
unsigned int dir
Definition: maze.c:112
BOOL WINAPI RegisterDialogClasses(HANDLE hmodule)
Definition: maze.c:766
BOOL WINAPI ScreenSaverConfigureDialog(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: maze.c:723
static int maze_size_x
Definition: maze.c:115
#define DOOR_OUT_BOTTOM
Definition: maze.c:96
#define WALL_BOTTOM
Definition: maze.c:85
static int end_x
Definition: maze.c:118
static long backup()
Definition: maze.c:403
#define border_x
Definition: maze.c:102
#define border_y
Definition: maze.c:103
static int end_y
Definition: maze.c:118
#define get_random(x)
Definition: maze.c:105
HWND hWnd
Definition: settings.c:17
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
static void create_maze()
Definition: maze.c:235
static void begin_solve_maze()
Definition: maze.c:487
static int solve_maze()
Definition: maze.c:537
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
#define BI_RGB
Definition: precomp.h:47
#define RGB(r, g, b)
Definition: precomp.h:62
ULONG RGBQUAD
Definition: precomp.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLdouble n
Definition: glext.h:7729
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IDD_DLG_ABOUT
Definition: resource.h:11
#define IDABOUT
Definition: resource.h:5
#define IDC_TEXT_PRESD
Definition: resource.h:12
#define IDC_SLIDER_PRESD
Definition: resource.h:8
#define IDC_SLIDER_SIZE
Definition: resource.h:7
#define IDC_TEXT_SD
Definition: resource.h:14
#define IDC_TEXT_SIZE
Definition: resource.h:11
#define IDC_SLIDER_SD
Definition: resource.h:10
#define IDC_TEXT_POSTSD
Definition: resource.h:13
#define IDC_SLIDER_POSTSD
Definition: resource.h:9
static HDC
Definition: imagelist.c:92
static HMODULE hmodule
Definition: rasapi.c:29
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define DWORD
Definition: nt_native.h:44
_In_ HBITMAP _In_ UINT _In_ UINT _Inout_ LPBITMAPINFO pbmi
Definition: ntgdi.h:2780
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
#define TBM_GETPOS
Definition: commctrl.h:2031
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define TBM_SETPOS
Definition: commctrl.h:2036
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:92
#define REG_DWORD
Definition: sdbapi.c:596
Definition: tftpd.h:60
USHORT biBitCount
Definition: precomp.h:37
ULONG biCompression
Definition: precomp.h:38
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
RGBQUAD bmiColors[1]
Definition: wingdi.h:1477
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
int ret
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define WHITE_BRUSH
Definition: wingdi.h:902
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateDIBPatternBrushPt(_In_ const VOID *pvPackedDIB, _In_ UINT uUsage)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define RegQueryValueEx
Definition: winreg.h:524
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define WM_HSCROLL
Definition: winuser.h:1743
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define IDCANCEL
Definition: winuser.h:831
#define WM_CREATE
Definition: winuser.h:1608
#define WM_SIZE
Definition: winuser.h:1611
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
#define IDOK
Definition: winuser.h:830
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define WM_TIMER
Definition: winuser.h:1742
#define SendMessage
Definition: winuser.h:5843
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_DESTROY
Definition: winuser.h:1609
#define SendDlgItemMessage
Definition: winuser.h:5842
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5761
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185