Maze Generation Fail -
Crayder - 08.03.2015
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:
- It only creates two outer walls.
- It causes an eternal loop, which I terminate.
- The output is incomplete (probably because I terminate the infinite loop).
- 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.
Re: Maze Generation Fail -
Misiur - 08.03.2015
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!
Re: Maze Generation Fail -
Crayder - 08.03.2015
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)
Re: Maze Generation Fail -
Misiur - 08.03.2015
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)
Re: Maze Generation Fail -
Crayder - 08.03.2015
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.
Re: Maze Generation Fail -
Misiur - 08.03.2015
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.
Re: Maze Generation Fail -
Crayder - 08.03.2015
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]'.
Re: Maze Generation Fail -
Crayder - 09.03.2015
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.
Re: Maze Generation Fail -
Misiur - 09.03.2015
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")
Re: Maze Generation Fail -
Crayder - 09.03.2015
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.