![]() ![]() probebly buged with cell count near and below 100. Local $PBar_iD = 0, $PBar_fScale = $iTotalCells / 100, $PBar_iNext = $iUnvisitedCells, $PBar_iStep = 2 PBAR SETUP - using $iUnvisitedCells, max to zero, needs to be scaled. Local $aCells This is where the maze will be stored It will store witch walls are intact Local $iCurrentCell = Random ( 0, $iTotalCells - 1, 1 ) set random start point/cell Make all walls be intact by filling the cells array with 1111Īrray _filler ( $aCells, '1111' ) Local $aVisitedCells Īrray _filler ( $aVisitedCells, False ) #cs Second is Colum Local $iUnvisitedCells = $iTotalCells Number of cell that are unvisited Local $sNeighbours = '' Local $sNeighbourOk Local $iRndDirection Local $aCurrentCellRowColum setup cell array. Second is Colum Local $iCurrentCellStackNumber = 0 Current subscript number to write to in $aCellstack Local $aCurrentCellStack USed as a temp storage of a bit of cellstack. ![]() Solve _Maze _ImgDraw ( $aiSize, $aCurrentPath, $sBaseName ) Return SetError (, , 0 ) EndFunc = Func Generate _Maze ( Const ByRef $aiSize ) Local Const $iTotalCells = $aiSize * $aiSize Local $iMoveToCell What cell to move to Local $aCellstack This stores with sequnce the cell got generated in. like: $sBaseName = 'Maze_(' & String ( $iRndSeed ) & ')' Local $aiSize = $aiSize Equals Number of Rows in each colum and $aiSize equals number of Colums Generate the maze it will be stored in $aCells Local $aCells = _ This is where the maze will be stored It will store witch walls are intactĭraw _Maze _Image ( $aiSize, $aCells, $sBaseName ) Local $aCurrentPath = Solve _Maze ( $aiSize, $aCells ) ![]() (as exit 0 will also register as forced exit) Exit Func _MAIN _ ( $sBaseName, $iMazeX, $iMazeY, $iRndSeed = Default ) $iRndSeed = RND _SeedTimed ( $iRndSeed ) ConsoleWrite ( '$iRndSeed = ' & $iRndSeed & ) Could be used to be add to maze name. #ce = #region Decleres and includes Add the needed includes #include #include "3" Downloaded from ~ #include "GUI_3" personal Progress bar UDF #endregion Decleres and includes _MAIN _ ( "Maze", 15, 15, 1234567890 ) If Then Exit allouw for normal exit in case there is no error. Added Random seed feedback (console only) Added leading type characters to variable names. Turned all root code into appropiate aeperate functions. General reformat of maze-generator code posted. (has value shift) EndIf SRandom ( $iSeed ) Return $iSeed EndFuncĮxpand collapse popup ~ #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y ~ #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #cs if Not IsNumber ( $iSeed ) Then $iSeed = int ( Mod ( Int ( TimerInit ( ) ), $INT32u ) - ( $INT31u ), 1 ) wraps to. ![]() or dim $iUsedSeed = RND _SeedTimed ( 1234567890 ) uses given seed. use dim $iUsedSeed = RND _SeedTimed ( ) return used random seed value. (needs maze size dimensions to of course to complete the reproducibility.) back to debugging >_<Īnyway, here's something that might be of some use in relation to slapping a ID on a particular maze. right, broke something again while trying to reformat the OP's code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |