Maze Generation Fail
#1

First off, I'm going to say I'm very close to having it complete.

Just when I thought I had it I noticed a few things:
  1. It only creates two outer walls.
  2. It causes an eternal loop, which I terminate.
  3. The output is incomplete (probably because I terminate the infinite loop).
  4. Not all sections are connected.
Here is the ouput:

Here is the entire script:
EDIT: I moved it to a github repository to make it easier to interact with your fixes. https://github.com/Crayder/Maze-Generator

Here is the console output (proof of the broken loop):
Quote:
Originally Posted by console
[|] =======================================
[|] | |
[|] | YSI version 3.09.0684 |
[|] | By Alex "******" Cole |
[|] | |
[|] =======================================
[|]
[|] Index[1] = Force Break
[|] Number of vehicle models: 0
Play with it if you want to help, I'd really appreciate it. I have no idea what the problem is. I thought I covered the walls bug, but obviously as show in the picture it's not fixed.

If this is fixed I plan on adding it to my Lego Box thing here.

EDIT: I should also mention, the larger the size, the more 'force break's there are. Also when the size is bigger index 2 is also forced broken many times.
Reply
#2

Interesting issue. Long story short, you have very specific conditions for loop to go further, but you select items randomly until all blocks are used. So, with each iteration of outer loop, you have lesser and lesser chance of actually hitting those conditions.

https://gist.github.com/Misiur/99d23545ebdefdde4f57

I didn't touch logic of your code, only that loop issue. If you have any questions regarding what the hell am I doing with those iterators, ask

Cool script!
Reply
#3

Interesting, but the outer walls at the bottom of the picture are still not walls. They should be wall objects. Also some sections still stick out there.

EDIT: It also still gets forced broken ("grid" is never printed either). (EDIT2: I lied, it sometimes calls it, not everytime)
Reply
#4

Hm, are you using crashdetect? If you have crash in 2d iterator, it means that your YSI is outdated (and loop won't ever finish)
Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Hm, are you using crashdetect? If you have crash in 2d iterator, it means that your YSI is outdated (and loop won't ever finish)
Which YSI version are you using? I'm using 3.1.
Reply
#6

4, but it shouldn't be an issue as it's basic y_iterate. If there isn't a crash I'm not sure what is wrong as I never get force breaks now.
Reply
#7

Ok, well anyways strings don't work in ternary do they? I get errors on the following lines of you script:

pawn Код:
strcat(grid, (CELL[X/2+1][Y/2+1][in] ? "M" : "_"));//(184) : error 001: expected token: "-string end-", but found "-identifier-"
strcat(grid, (CELL[X/2+1][Y/2+1][left] ? "M" : "_"));//(194) : error 001: expected token: "-string end-", but found "-identifier-"
strcat(grid, (CELL[X/2+1][Y/2+1][up] ? "M" : "_"));//(199) : error 001: expected token: "-string end-", but found "-identifier-"
You just forgot to wrap the strings in parenthesis.



Your code also runs into an infinite loop when using:
pawn Код:
#define xsize 64
#define ysize 48
It's not 'Index[1]' or 'Index[2]'.
Reply
#8

I need a way to loop through and store frontier cells. If I have a Iterator of frontier cells I can loop through them alone instead of the entire map.
Reply
#9

Strings work in ternary, but it's a known bug - I'm using Zeex's compiler, so sorry for that omission. When in doubt, wrap it in brackets:
pawn Код:
condition ? ("Tank") : ("Mudkip")
Reply
#10

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Strings work in ternary, but it's a known bug - I'm using Zeex's compiler, so sorry for that omission. When in doubt, wrap it in brackets:
pawn Код:
condition ? ("Tank") : ("Mudkip")
Yea I mentioned that above, I always wrap in parenthesis as a precaution.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)