Variations on a maze

From Maze

(Difference between revisions)
Jump to: navigation, search
Line 28:Line 28:
We can, of course, construct an orthogonal maze instead in a variety of other ways. One way is to address a set of four or more horizontal character elements a top-wall, bottom-wall, left-wall and right-wall. There are two styles of these characters (thick and thin) available in the Commodore 64 ASCII character set. However, these four character types never appear continuously in the table, so the elegant method of using a simple RND offset must be replaced with something more verbose -- for example, selecting between 180, 181, 183 and 184 using two random offsets.
We can, of course, construct an orthogonal maze instead in a variety of other ways. One way is to address a set of four or more horizontal character elements a top-wall, bottom-wall, left-wall and right-wall. There are two styles of these characters (thick and thin) available in the Commodore 64 ASCII character set. However, these four character types never appear continuously in the table, so the elegant method of using a simple RND offset must be replaced with something more verbose -- for example, selecting between 180, 181, 183 and 184 using two random offsets.
−
10 PRINT CHR$(181+(INT(RND(1))*2)+(RND(1))); : GOTO 10
+
10 PRINT CHR$(181+(.5+INT(RND(1))*2)+(RND(1))); : GOTO 10
−
 
−
(code currently has problems -- INT not returning anything on c64?)
 

Revision as of 19:20, 24 July 2010

View this revision of Variations on a maze.

Personal tools