Category : OS/2 Files
Archive   : REXEXMPL.ZIP
Filename : REXXMAZE.CMD

 
Output of file : REXXMAZE.CMD contained in archive : REXEXMPL.ZIP
/* Draws a maze using the IBM PC graphics characters */
/* */
/* Written by James L. Dean */
/* 406 40th Street */
/* New Orleans, LA 70124-1532 */
/* */
CLS
TRUE='1'
FALSE='0'
SAY ' Maze Generator'
SAY ' '
SAY ' '
SAY ' '
num_columns=0
DO WHILE ((num_columns < 2) | (num_columns > 39))
CALL CHAROUT,'Number of columns (2 to 39)? '
num_columns=LINEIN()
IF VERIFY(num_columns,'0123456789') \= 0 THEN
DO
num_columns=0
SAY 'Error: the number of columns must be numeric!'
END
ELSE
DO
IF ((num_columns < 2) | (num_columns > 39)) THEN
SAY 'Error: the number of columns must be between 2 and 39, inclusively!'
END
END
x_max=2*num_columns
SAY ' '
num_rows=0
DO WHILE ((num_rows < 2) | (num_rows > 20))
CALL CHAROUT,'Number of rows (2 to 20)? '
num_rows=LINEIN()
IF VERIFY(num_rows,'0123456789') \= 0 THEN
DO
num_rows=0
SAY 'Error: the number of rows must be numeric!'
END
ELSE
DO
IF ((num_rows < 2) | (num_rows > 20)) THEN
SAY 'Error: the number of rows must be between 2 and 20, inclusively!'
END
END
y_max=2*num_rows
SAY ' '
CALL CHAROUT,'Random number seed? '
seed=LINEIN()
r_n_index_1=1
DO WHILE ((r_n_index_1 <= 8) & (r_n_index_1 <= LENGTH(seed)))
r_n.r_n_index_1=1+C2D(SUBSTR(seed,r_n_index_1,1))//29
r_n_index_1=r_n_index_1+1
END
DO WHILE (r_n_index_1 <= 8)
r_n.r_n_index_1=13
r_n_index_1=r_n_index_1+1
END
delta_x.1.1=-1
delta_y.1.1=0
delta_x.2.1=0
delta_y.2.1=1
delta_x.3.1=1
delta_y.3.1=0
delta_x.4.1=0
delta_y.4.1=-1
delta_index_2=0
delta_index_1a=1
DO WHILE (delta_index_1a <= 4)
delta_index_1b=1
DO WHILE (delta_index_1b <= 4)
IF delta_index_1a \= delta_index_1b THEN
DO
delta_index_1c=1
DO WHILE (delta_index_1c <= 4)
IF ((delta_index_1a \= delta_index_1c) & (delta_index_1b \= delta_index_1c)) THEN
DO
delta_index_1d=1
DO WHILE (delta_index_1d <= 4)
IF ((delta_index_1a \= delta_index_1d) & (delta_index_1b \= delta_index_1d) & (delta_index_1c \= delta_index_1d)) THEN
DO
delta_index_2=delta_index_2+1
delta_x.delta_index_1a.delta_index_2=delta_x.1.1
delta_y.delta_index_1a.delta_index_2=delta_y.1.1
delta_x.delta_index_1b.delta_index_2=delta_x.2.1
delta_y.delta_index_1b.delta_index_2=delta_y.2.1
delta_x.delta_index_1c.delta_index_2=delta_x.3.1
delta_y.delta_index_1c.delta_index_2=delta_y.3.1
delta_x.delta_index_1d.delta_index_2=delta_x.4.1
delta_y.delta_index_1d.delta_index_2=delta_y.4.1
END
delta_index_1d=delta_index_1d+1
END
END
delta_index_1c=delta_index_1c+1
END
END
delta_index_1b=delta_index_1b+1
END
delta_index_1a=delta_index_1a+1
END
x_out=0
DO WHILE (x_out <= x_max)
y_out=0
DO WHILE (y_out <= y_max)
page.y_out.x_out='W'
y_out=y_out+1
END
x_out=x_out+1
END
sum=0
digit_num=1
DO WHILE (digit_num <= 3)
digit=r_n.1
r_n_index_1=1
r_n_index_2=2
DO WHILE (r_n_index_2 <= 8)
tem_int_1=r_n.r_n_index_2
r_n.r_n_index_1=tem_int_1
digit=digit+tem_int_1
IF digit > 29 THEN
digit=digit-29
r_n_index_1=r_n_index_2
r_n_index_2=r_n_index_2+1
END
r_n.8=digit
sum=29*sum+digit
digit_num=digit_num+1
END
x=2*(sum//num_columns)+1
sum=0
digit_num=1
DO WHILE (digit_num <= 3)
digit=r_n.1
r_n_index_1=1
r_n_index_2=2
DO WHILE (r_n_index_2 <= 8)
tem_int_1=r_n.r_n_index_2
r_n.r_n_index_1=tem_int_1
digit=digit+tem_int_1
IF digit > 29 THEN
digit=digit-29
r_n_index_1=r_n_index_2
r_n_index_2=r_n_index_2+1
END
r_n.8=digit
sum=29*sum+digit
digit_num=digit_num+1
END
y=2*(sum//num_rows)+1
page.y.x=' '
stack_head=0
finished=FALSE
DO WHILE (\ finished)
delta_index_1=1
too_big=TRUE
DO WHILE (too_big)
delta_index_2=r_n.1
r_n_index_1=1
r_n_index_2=2
DO WHILE (r_n_index_2 <= 8)
tem_int_1=r_n.r_n_index_2
r_n.r_n_index_1=tem_int_1
delta_index_2=delta_index_2+tem_int_1
IF delta_index_2 > 29 THEN
delta_index_2=delta_index_2-29
r_n_index_1=r_n_index_2
r_n_index_2=r_n_index_2+1
END
r_n.8=delta_index_2
IF delta_index_2 <= 24 THEN
too_big=FALSE
END
passage_found=FALSE
search_complete=FALSE
DO WHILE (\ search_complete)
DO WHILE ((delta_index_1 <= 4) & (\ passage_found))
x_next=x+2*delta_x.delta_index_1.delta_index_2
IF x_next <= 0 THEN
delta_index_1=delta_index_1+1
ELSE
IF x_next >= x_max THEN
delta_index_1=delta_index_1+1
ELSE
DO
y_next=y+2*delta_y.delta_index_1.delta_index_2
IF y_next <= 0 THEN
delta_index_1=delta_index_1+1
ELSE
IF y_next >= y_max THEN
delta_index_1=delta_index_1+1
ELSE
IF page.y_next.x_next = 'W' THEN
passage_found=TRUE
ELSE
delta_index_1=delta_index_1+1
END
END
IF (\ passage_found) THEN
DO
delta_index_1=stack.index_1.stack_head
delta_index_2=stack.index_2.stack_head
x=x-2*delta_x.delta_index_1.delta_index_2
y=y-2*delta_y.delta_index_1.delta_index_2
stack_head=stack_head-1
delta_index_1=delta_index_1+1
END
IF ((passage_found) | (stack_head = 0)) THEN
search_complete=TRUE
END
IF passage_found THEN
DO
stack_head=stack_head+1
stack.index_1.stack_head=delta_index_1
stack.index_2.stack_head=delta_index_2
page.y_next.x_next=' '
IF x = x_next THEN
DO
y_wall_1=(y+y_next)%2
page.y_wall_1.x_next=' '
END
ELSE
DO
x_wall_1=(x+x_next)%2
page.y_next.x_wall_1=' '
END
x=x_next
y=y_next
END
IF stack_head = 0 THEN
finished=TRUE
END
page.0.1=' '
x_minus_1=x_max-1
page.y_max.x_minus_1=' '
CLS
line='b3'x
x=1
DO WHILE (x < x_max)
IF page.0.x = 'W' THEN
line=line||'c4'x
ELSE
line=line||' '
x=x+1
IF x < x_max THEN
DO
IF page.1.x = 'W' THEN
line=line||'c2'x
ELSE
line=line||'c4'x
x=x+1
END
END
line=line||'bf'x
SAY line
line=''
y=2
DO WHILE (y < y_max)
IF page.y.1 = 'W' THEN
line=line||'c3'x
ELSE
line=line||'b3'x
x=1
DO WHILE (x < x_max)
IF page.y.x = 'W' THEN
line=line||'c4'x
ELSE
line=line||' '
x=x+1
IF x < x_max THEN
DO
x_minus_1=x-1
x_plus_1=x+1
y_minus_1=y-1
y_plus_1=y+1
IF page.y.x_minus_1 = 'W' THEN
IF page.y_minus_1.x = 'W' THEN
IF page.y_plus_1.x = 'W' THEN
IF page.y.x_plus_1 = 'W' THEN
line=line||'c5'x
ELSE
line=line||'b4'x
ELSE
IF page.y.x_plus_1 = 'W' THEN
line=line||'c1'x
ELSE
line=line||'d9'x
ELSE
IF page.y_plus_1.x = 'W' THEN
IF page.y.x_plus_1 = 'W' THEN
line=line||'c2'x
ELSE
line=line||'bf'x
ELSE
line=line||'c4'x
ELSE
IF page.y_minus_1.x = 'W' THEN
IF page.y_plus_1.x = 'W' THEN
IF page.y.x_plus_1 = 'W' THEN
line=line||'c3'x
ELSE
line=line||'b3'x
ELSE
IF page.y.x_plus_1 = 'W' THEN
line=line||'c0'x
ELSE
line=line||'b3'x
ELSE
IF page.y_plus_1.x = 'W' THEN
IF page.y.x_plus_1 = 'W' THEN
line=line||'da'x
ELSE
line=line||'b3'x
ELSE
IF page.y.x_plus_1 = 'W' THEN
line=line||'c4'x
ELSE
line=line||' '
x=x_plus_1
END
END
x_minus_1=x_max-1
IF page.y.x_minus_1 = 'W' THEN
line=line||'b4'x
ELSE
line=line||'b3'x
y=y+2
SAY line
line=''
END
line=line||'c0'x
x=1
DO WHILE (x < x_max)
IF page.y_max.x = 'W' THEN
line=line||'c4'x
ELSE
line=line||' '
x=x+1
IF x < x_max THEN
DO
y_minus_1=y_max-1
IF page.y_minus_1.x = 'W' THEN
line=line||'c1'x
ELSE
line=line||'c4'x
x=x+1
END
END
line=line||'b3'x
SAY line


  3 Responses to “Category : OS/2 Files
Archive   : REXEXMPL.ZIP
Filename : REXXMAZE.CMD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/