Author Topic: Maze Mirrors  (Read 3549 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Maze Mirrors
« on: February 15, 2018, 02:56:19 pm »
Code: QB64: [Select]
  1. _TITLE "1 Maze in 3 Reflectionss, press any key for next image..."
  2. ' 2017-10-19 (B+=MGA) Maze Mirrors.bas
  3.  
  4. CONST xmax = 800 'set screen width to this
  5. CONST ymax = 600 'set screen height to this
  6.  
  7. SCREEN _NEWIMAGE(xmax, ymax, 32) ' this sets the screen to the above settings
  8. _SCREENMOVE 360, 60
  9.  
  10. DEFINT A-Z
  11. CONST w = 14
  12. CONST h = 7
  13.  
  14. COMMON SHARED maze(), x2pixel!, xThk!, y2pixel!, yThk!
  15. DIM maze(w + 1, h + 1)
  16. x2pixel! = xmax / (w + 2)
  17. xThk! = .5 * x2pixel!
  18. y2pixel! = ymax / (h + 2)
  19. yThk! = .5 * y2pixel!
  20.  
  21. FOR y = 1 TO h 'read in data for maze
  22.     FOR x = 1 TO w
  23.         READ maze(x, y)
  24.     NEXT
  25.  
  26. COLOR _RGB(200, 200, 255)
  27.     drawMaze: ck
  28.     drawMazeHorizontalMirror: ck
  29.     drawMaze: ck
  30.     drawMazeVerticalMirror: ck
  31.     drawMaze: ck
  32.     drawMazeBothMirror: ck
  33.  
  34. SUB ck 'check key
  35.     SLEEP: CLS: IF _KEYDOWN(27) THEN END
  36.  
  37. SUB drawMaze
  38.     PRINT "Maze from array:"
  39.     FOR y = 1 TO h
  40.         FOR x = 1 TO w
  41.             IF maze(x, y) AND maze(x, y + 1) THEN
  42.                 LINE (x * x2pixel!, y * y2pixel!)-(x * x2pixel! + xThk!, (y + 1) * y2pixel! + yThk!), , BF
  43.             END IF
  44.             IF maze(x, y) AND maze(x + 1, y) THEN
  45.                 LINE (x * x2pixel!, y * y2pixel!)-((x + 1) * x2pixel! + xThk!, y * y2pixel! + yThk!), , BF
  46.             END IF
  47.         NEXT
  48.     NEXT
  49.  
  50. SUB drawMazeHorizontalMirror
  51.     PRINT "Maze upside down:"
  52.     FOR y = 1 TO h
  53.         FOR x = 1 TO w
  54.             IF maze(x, y) AND maze(x, y + 1) THEN
  55.                 LINE (x * x2pixel!, ymax - (y * y2pixel!))-(x * x2pixel! + xThk!, ymax - ((y + 1) * y2pixel! + yThk!)), , BF
  56.             END IF
  57.             IF maze(x, y) AND maze(x + 1, y) THEN
  58.                 LINE (x * x2pixel!, ymax - (y * y2pixel!))-((x + 1) * x2pixel! + xThk!, ymax - (y * y2pixel! + yThk!)), , BF
  59.             END IF
  60.         NEXT
  61.     NEXT
  62.  
  63. SUB drawMazeVerticalMirror
  64.     PRINT "Maze mirror (vertical):"
  65.     FOR y = 1 TO h
  66.         FOR x = 1 TO w
  67.             IF maze(x, y) AND maze(x, y + 1) THEN
  68.                 LINE (xmax - (x * x2pixel!), y * y2pixel!)-(xmax - (x * x2pixel! + xThk!), (y + 1) * y2pixel! + yThk!), , BF
  69.             END IF
  70.             IF maze(x, y) AND maze(x + 1, y) THEN
  71.                 LINE (xmax - (x * x2pixel!), y * y2pixel!)-(xmax - ((x + 1) * x2pixel! + xThk!), y * y2pixel! + yThk!), , BF
  72.             END IF
  73.         NEXT
  74.     NEXT
  75.  
  76. SUB drawMazeBothMirror
  77.     PRINT "Maze upside down and mirrored:"
  78.     FOR y = 1 TO h
  79.         FOR x = 1 TO w
  80.             IF maze(x, y) AND maze(x, y + 1) THEN
  81.                 LINE (xmax - (x * x2pixel!), ymax - (y * y2pixel!))-(xmax - (x * x2pixel! + xThk!), ymax - ((y + 1) * y2pixel! + yThk!)), , BF
  82.             END IF
  83.             IF maze(x, y) AND maze(x + 1, y) THEN
  84.                 LINE (xmax - (x * x2pixel!), ymax - (y * y2pixel!))-(xmax - ((x + 1) * x2pixel! + xThk!), ymax - (y * y2pixel! + yThk!)), , BF
  85.             END IF
  86.         NEXT
  87.     NEXT
  88.  
  89. 'maze
  90. DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1
  91. DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,1
  92. DATA 1,0,1,1,1,0,1,1,1,1,1,1,0,1
  93. DATA 1,0,0,0,1,0,0,0,0,0,0,0,0,1
  94. DATA 1,0,1,0,1,0,1,1,1,1,1,1,0,1
  95. DATA 1,0,1,0,0,0,0,0,0,0,0,1,0,1
  96. DATA 1,0,1,1,1,1,1,0,1,1,1,1,1,1
  97.  
  98.  
  99.  

This is old code from net but I wanted to check out screen shots here at org, besides I don't think this code got enough press coverage at net ;-))
« Last Edit: February 15, 2018, 04:06:22 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Maze Mirrors
« Reply #1 on: February 15, 2018, 02:59:36 pm »
Errors when I try to attach screen shots

First I tried three, then I just tried 1, I loose whole post. The start of this thread was 2nd attempt without attachments.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Maze Mirrors
« Reply #2 on: February 15, 2018, 03:08:01 pm »
Hi Odin,

What do you think?

Append: Vanished! just what you expect from a god...

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Maze Mirrors
« Reply #3 on: February 15, 2018, 08:54:59 pm »
OK Odin thinks I am, ha!

Try screen shots again...

Looking good odin! (Thumbs up icon here)
mm1.PNG
* mm1.PNG (Filesize: 12.48 KB, Dimensions: 801x627, Views: 408)
mm2.PNG
* mm2.PNG (Filesize: 12.69 KB, Dimensions: 803x627, Views: 419)
mm3.PNG
* mm3.PNG (Filesize: 14.17 KB, Dimensions: 799x626, Views: 414)
« Last Edit: February 15, 2018, 08:56:33 pm by bplus »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
Re: Maze Mirrors
« Reply #4 on: February 18, 2018, 03:08:11 pm »
Bplus, i think, Odin is inspired by Revolt of machines movie. There ODIN is international secret and security army network. :-D
« Last Edit: February 18, 2018, 03:11:15 pm by Petr »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Maze Mirrors
« Reply #5 on: February 18, 2018, 03:27:58 pm »
Dang, I thought Odin was the one who gives a Frigg.

hmm... that didn't sound right....

I had to look up Odin, I thought he was the one with a hammer, no he is husband of Frigg and a wanderer but many other things too bringer of Runes, health...

didn't see anything about "international secret and security army network." ISASAN?

I will keep my eyes pealed now. :D
« Last Edit: February 18, 2018, 03:32:55 pm by bplus »

Offline Donald Foster

  • Newbie
  • Posts: 63
Re: Maze Mirrors
« Reply #6 on: February 27, 2018, 10:42:19 am »
Hello all,

I like you cute maze. Brings back memories when I made my maze on the Tandy 2000 about 30 years. But it was a walk through maze showing a preview of what openings are just ahead of you. I even put florescent lighting in then ceiling. Maybe I remake one some day, but even bigger and harder to get through.

I found a maze similar to mine.
 
Donald
Maze.png
* Maze.png (Filesize: 5.16 KB, Dimensions: 259x194, Views: 420)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Maze Mirrors
« Reply #7 on: February 27, 2018, 01:02:04 pm »
Hi [banned user],

Hmm... 3d ping pong might not be for you???

Wait... is it here???

A quick search says, nada. Not At Dis Address

OK well I hope it's owner is here or gets here and brings that code with him! (please)