''Spec written by George Walme '' Universal Survey Center '' 212-391-5243 '' ''Just stretching my mind during a lunch break! '' ''While playing with a silly wooden game, I wondered ''if C-Survent would be capable of reproducing ''the game - this is what I came up with. ''Feel free to make modifications I would love to see ''what improvements can be made. ''version 1.0 - original ''version 1.1 - move counter & game over & timer added >purgesame ''>-printrep ~prepare compile [stack,45/80,"Stack IT!",specwidth=132,caseid=1.4,& -check_file,-db_file,-hard_copy_file,-qsp_file,-summary_file] {lastcol: 81 !GOTO} { Welcome to Stack It! Version 1.1 Warning...this is an addictive game and should not be played during working hours. Yeah right. Anyway... This program is modelled after a wooden game with 3 long pegs and 8 discs. The game starts with the discs all stacked on one peg, each disc consecutively bigger then the next. The object of the game is move the entire stack from column 1 to another column. The trick is you can only move one disc at a time and should NOT place a larger disc on top of a smaller disc. Because I didn't have a lot of time to play with the program, I didn't add any code to check if an invalid piece is moved, so don't cheat! P.S. There is a minimum of 255 moves to complete the game! Check the source code out, it's pretty cool! To exit the game, press X. !disp} {!auto_return} {char: 1/5.1 * !spc,9} {!gen,a,1/5,1} {counter: .5 !exp,z,0} {!spc,z,0} >repeat $a=11/08,& 12/07,12/08,12/09,& 13/06,13/07,...,13/10,& 14/05,14/06,...,14/11,& 15/04,15/05,...,15/12,& 16/03,16/04,...,16/13,& 17/02,17/03,...,17/14,& 18/01,18/02,...,18/15; {!gen,m,$a,char} >endrepeat {redraw: #of moves: \:counter: 1 2 3 \|11/1.15| \|21/1.15| \|31/1.15| \|12/1.15| \|22/1.15| \|32/1.15| \|13/1.15| \|23/1.15| \|33/1.15| \|14/1.15| \|24/1.15| \|34/1.15| \|15/1.15| \|25/1.15| \|35/1.15| \|16/1.15| \|26/1.15| \|36/1.15| \|17/1.15| \|27/1.15| \|37/1.15| \|18/1.15| \|28/1.15| \|38/1.15| !disp,2} {win1: !goto} >repeat $a=21/08,& 22/07,22/08,22/09,& 23/06,23/07,...,23/10,& 24/05,24/06,...,24/11,& 25/04,25/05,...,25/12,& 26/03,26/04,...,26/13,& 27/02,27/03,...,27/14,& 28/01,28/02,...,28/15; {!if not([$a$$]="*") !goto win2} >endrepeat {!goto won} {win2: !goto} >repeat $a=31/08,& 32/07,32/08,32/09,& 33/06,33/07,...,33/10,& 34/05,34/06,...,34/11,& 35/04,35/05,...,35/12,& 36/03,36/04,...,36/13,& 37/02,37/03,...,37/14,& 38/01,38/02,...,38/15; {!if not([$a$$]="*") !goto incrmnt} >endrepeat {won: !goto} {timer: .9 !spc,z,1} { ***** ***** *************** ***** ***** ***** ***** *************** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *************** *************** ***** *************** *************** ***** *** ***** *************** ***** ***** ***** *** ***** *************** ******* ***** ***** *** ***** ***** ***** ********* ***** ***** *** ***** ***** ***** ***** ********* *************** *************** ***** ******* *************** *************** ***** ***** Game Completed in \:counter: moves and took \:timer: seconds! !disp} {!goto bye} {incrmnt: [counter] alias=counter !exp,z,x([counter])+1} {!gen,b,1/10,2} {choice1: 1/10 \(14) >From Column: \_ !cat,n (1) 1 (2) 2 (3) 3 (X,skipto bye) X } {choice2: 1/11 \(15) To Column: \_ !cat,n (1) 1 (2) 2 (3) 3 (X,skipto bye) X } {!if x(1/10)=x(1/11) !reset redraw} {col1: .1 !exp,z,0} {col2: .1 !exp,z,0} {col3: .1 !exp,z,0} {chk1: !goto} >repeat $a=1,2,...,8; { [col1] alias=col1 !if 1$a/1.15^^nb !exp,z,$a} {!if 1$a/1.15^^nb !goto chk2} >endrepeat {chk2: !goto} >repeat $a=1,2,...,8; { [col2] alias=col2 !if 2$a/1.15^^nb !exp,z,$a} {!if 2$a/1.15^^nb !goto chk3} >endrepeat {chk3: !goto} >repeat $a=1,2,...,8; { [col3] alias=col3 !if 3$a/1.15^^nb !exp,z,$a} {!if 3$a/1.15^^nb !goto donechk} >endrepeat {donechk: !goto} { [col1] ''alias=col1 !if x([col1])>0 and choice2(1) !exp,z,x([col1])-1} { [col2] ''alias=col2 !if x([col2])>0 and choice2(2) !exp,z,x([col2])-1} { [col3] ''alias=col3 !if x([col3])>0 and choice2(3) !exp,z,x([col3])-1} {!if choice1(1) !goto do1} {!if choice1(2) !goto do2} {!if choice1(3) !goto do3} {do1: !goto} {!if choice2(2) !goto do1_2} {!if choice2(3) !goto do1_3} {do1_2: !goto} >repeat $z=1,2,3,4,5,6,7,8; >repeat $a=1,2,3,4,5,6,7,0;& $b=1,2,3,4,5,6,7,8; {!if col1=$z and col2=$a !gen,m,2$b/1,1$z/1,15} {!if col1=$z and col2=$a !gen,b,1$z/1,15} >endrepeat >endrepeat {!goto redraw} {do1_3: !goto} >repeat $z=1,2,3,4,5,6,7,8; >repeat $a=1,2,3,4,5,6,7,0;& $b=1,2,3,4,5,6,7,8; {!if col1=$z and col3=$a !gen,m,3$b/1,1$z/1,15} {!if col1=$z and col3=$a !gen,b,1$z/1,15} >endrepeat >endrepeat {!goto redraw} {do2: !goto} {!if choice2(1) !goto do2_1} {!if choice2(3) !goto do2_3} {do2_1: !goto} >repeat $z=1,2,3,4,5,6,7,8; >repeat $a=1,2,3,4,5,6,7,0;& $b=1,2,3,4,5,6,7,8; {!if col2=$z and col1=$a !gen,m,1$b/1,2$z/1,15} {!if col2=$z and col1=$a !gen,b,2$z/1,15} >endrepeat >endrepeat {!goto redraw} {do2_3: !goto} >repeat $z=1,2,3,4,5,6,7,8; >repeat $a=1,2,3,4,5,6,7,0;& $b=1,2,3,4,5,6,7,8; {!if col2=$z and col3=$a !gen,m,3$b/1,2$z/1,15} {!if col2=$z and col3=$a !gen,b,2$z/1,15} >endrepeat >endrepeat {!goto redraw} {do3: !goto} {!if choice2(1) !goto do3_1} {!if choice2(2) !goto do3_2} {do3_1: !goto} >repeat $z=1,2,3,4,5,6,7,8; >repeat $a=1,2,3,4,5,6,7,0;& $b=1,2,3,4,5,6,7,8; {!if col3=$z and col1=$a !gen,m,1$b/1,3$z/1,15} {!if col3=$z and col1=$a !gen,b,3$z/1,15} >endrepeat >endrepeat {!goto redraw} {do3_2: !goto} >repeat $z=1,2,3,4,5,6,7,8; >repeat $a=1,2,3,4,5,6,7,0;& $b=1,2,3,4,5,6,7,8; {!if col3=$z and col2=$a !gen,m,2$b/1,3$z/1,15} {!if col3=$z and col2=$a !gen,b,3$z/1,15} >endrepeat >endrepeat {!goto redraw} {bye: !spc,b} ~end