I assume that SIM.3D is ok, to use right? (http://smilebasicsource.com/page?pid=1053 Key = HEAEP3). I have been playing with that one a little bit.
What about code you find and port over from the internet. Something like say https://www.youtube.com/watch?v=Y37-gB83HKE Javidx9's maze generation algorithm for example? Good? Bad?
By the way, if anyone is interested, the code I ported over and a screen shot is right below. Anyone else a fan?
OPTION STRICT VAR SCREEN_W = 400 VAR SCREEN_H = 240 VAR CONSOLE_W = 200 'DIFFERENT NUMBERS FOR VAR CONSOLE_H = 120 'INTEGER CHARACTER SIZE VAR CHAR_W = SCREEN_W / CONSOLE_W VAR CHAR_H = SCREEN_H / CONSOLE_H VAR MAZE_W, MAZE_H, MAZE[0], VISITED_CELLS VAR CELL_PATH_N = &H01 VAR CELL_PATH_E = &H02 VAR CELL_PATH_S = &H04 VAR CELL_PATH_W = &H08 VAR CELL_VISITED = &H10 '16 VAR PATH_W = 3 'UNLIKE THE VIDEO I WILL JUST PUSH 'TWO ENTRIES PER XY PAIR. JUST NEED TO 'REMEMBER TO POP AND PUSH IN REVERSE ORDER 'PUSH X,Y THEN POP Y,X VAR STACK[0] 'Maze algorithm adapted from the video '"Programming Mazes" by javidx9 on Youtube 'https://www.youtube.com/watch?v=Y37-gB83HKE ' MAIN END DEF MAIN VAR B, GAME_OVER = FALSE, T1, T2, DT VAR PAGE_DRAW = 0, PAGE_SHOW = 1 ACLS GPAGE PAGE_SHOW, PAGE_DRAW ON_USER_CREATE T2 = MILLISEC - 16 WHILE !GAME_OVER T1 = T2 T2 = MILLISEC DT = T2 - T1 B = BUTTON() ON_USER_UPDATE DT, B IF (B AND #X) != 0 THEN GAME_OVER = TRUE SWAP PAGE_SHOW, PAGE_DRAW GPAGE PAGE_SHOW, PAGE_DRAW 'VSYNC WEND END DEF ON_USER_CREATE VAR I MAZE_W = 50 MAZE_H = 30 'Allocate maze 'Remove if too many WHILE LEN(MAZE) > (MAZE_W * MAZE_H) I = POP(MAZE) WEND 'Add if too small WHILE LEN(MAZE) < (MAZE_W * MAZE_H) PUSH MAZE, 0 WEND 'Now zero everything out FOR I = 0 TO (MAZE_W * MAZE_H) - 1 MAZE[I] = 0 NEXT I 'Clear out the stack WHILE LEN(STACK) > 0 I = POP(STACK) WEND 'Add the starting position PUSH STACK, 0 'Start at 0, 0 PUSH STACK, 0 'Mark it visited MAZE[0] = CELL_VISITED VISITED_CELLS = 1 END DEF ON_USER_UPDATE DT, B VAR I, J, PX, PY, X, Y, CLR VAR NEIGHBORS[0] VAR NORTH = 1 VAR EAST = 2 VAR SOUTH = 3 VAR WEST = 4 VAR NEXT_DIR 'Do Maze Algorithm IF VISITED_CELLS < (MAZE_W * MAZE_H) THEN 'Peek top of stack for current x, y Y = STACK[LEN(STACK) - 1] X = STACK[LEN(STACK) - 2] 'Step 1: Create a set of unvisited neighbors ' 'North neighbor IF Y > 0 THEN IF (MAZE[((Y - 1) * MAZE_W) + X] AND CELL_VISITED) == 0 THEN PUSH NEIGHBORS, NORTH ENDIF ENDIF 'East neighbor IF X < MAZE_W - 1 THEN IF (MAZE[(Y * MAZE_W) + X + 1] AND CELL_VISITED) == 0 THEN PUSH NEIGHBORS, EAST ENDIF ENDIF 'South neighbor IF Y < MAZE_H - 1 THEN IF (MAZE[((Y + 1) * MAZE_W) + X] AND CELL_VISITED) == 0 THEN PUSH NEIGHBORS, SOUTH ENDIF ENDIF 'West neighbor IF X > 0 THEN IF (MAZE[(Y * MAZE_W) + X - 1] AND CELL_VISITED) == 0 THEN PUSH NEIGHBORS, WEST ENDIF ENDIF IF LEN(NEIGHBORS) > 0 THEN 'Choose one available neighbor at random NEXT_DIR = NEIGHBORS[RND(LEN(NEIGHBORS))] 'Create a path between the neighbor and 'the current cell IF NEXT_DIR == NORTH THEN MAZE[Y * MAZE_W + X] = (MAZE[Y * MAZE_W + X] OR CELL_PATH_N) MAZE[(Y - 1) * MAZE_W + X] = (MAZE[(Y - 1) * MAZE_W + X] OR CELL_PATH_S) PUSH STACK, X PUSH STACK, Y - 1 ELSEIF NEXT_DIR == EAST THEN MAZE[Y * MAZE_W + X] = (MAZE[Y * MAZE_W + X] OR CELL_PATH_E) MAZE[Y * MAZE_W + X + 1] = (MAZE[Y * MAZE_W + X + 1] OR CELL_PATH_W) PUSH STACK, X + 1 PUSH STACK, Y ELSEIF NEXT_DIR == SOUTH THEN MAZE[Y * MAZE_W + X] = (MAZE[Y * MAZE_W + X] OR CELL_PATH_S) MAZE[(Y + 1) * MAZE_W + X] = (MAZE[(Y + 1) * MAZE_W + X] OR CELL_PATH_N) PUSH STACK, X PUSH STACK, Y + 1 ELSEIF NEXT_DIR == WEST THEN MAZE[Y * MAZE_W + X] = (MAZE[Y * MAZE_W + X] OR CELL_PATH_W) MAZE[Y * MAZE_W + X - 1] = (MAZE[Y * MAZE_W + X - 1] OR CELL_PATH_E) PUSH STACK, X - 1 PUSH STACK, Y ELSE ENDIF 'New cell 'Mark new cell visited and increase count 'Peek top of stack for current x, y Y = STACK[LEN(STACK) - 1] X = STACK[LEN(STACK) - 2] 'Mark it visited MAZE[Y * MAZE_W + X] = (MAZE[Y * MAZE_W + X] OR CELL_VISITED) VISITED_CELLS = VISITED_CELLS + 1 ELSE Y = POP(STACK) X = POP(STACK) ENDIF ENDIF 'IF VISITED_CELLS < MAZE_W * MAZE_H THEN RETURN GCLS FOR J = 0 TO MAZE_H - 1 FOR I = 0 TO MAZE_W - 1 IF MAZE[J * MAZE_W + I] AND CELL_VISITED THEN CLR = #WHITE ELSE CLR = #BLUE ENDIF IF I == X && J == Y AND VISITED_CELLS < MAZE_W * MAZE_H THEN CLR = #LIME ENDIF DRAW_CELL I * (PATH_W + 1), J * (PATH_W + 1), CLR 'South wall IF (MAZE[J * MAZE_W + I] AND CELL_PATH_S) != 0 THEN CLR = #WHITE ELSE CLR = #BLACK ENDIF FOR PX = 0 TO PATH_W - 1 DRAW_PIXEL I * (PATH_W + 1) + PX, J * (PATH_W + 1) + PATH_W, CLR NEXT PX 'East wall IF (MAZE[J * MAZE_W + I] AND CELL_PATH_E) != 0 THEN CLR = #WHITE ELSE CLR = #BLACK ENDIF FOR PY = 0 TO PATH_W - 1 DRAW_PIXEL I * (PATH_W + 1) + PATH_W, J * (PATH_W + 1) + PY, CLR NEXT PX NEXT I NEXT J END DEF DRAW_PIXEL X, Y, CLR GFILL X * CHAR_W, Y * CHAR_H, (X + 1) * CHAR_W - 1, (Y + 1) * CHAR_H - 1, CLR END DEF DRAW_CELL X, Y, CLR GFILL X * CHAR_W, Y * CHAR_H, (X + 1 + PATH_W) * CHAR_W - CHAR_W - 1, (Y + 1 + PATH_W) * CHAR_H - CHAR_H - 1, CLR END