Hi there!
The two pieces of code in the programme produce exactly the same result, both draw 28 boxes on the screen, but which is easier to understand?
The comparison is by way of the method used to determine the position of the boxes.
Code 1 is the way I originally wrote the piece, and Code 2 was written after studying TDK's Alternative Way To Deal A Pack Of Cards.
remstart
=======================================================
By comparison
***********************
Author: gearce - June 2007
***********************
CODE 1
=======================================================
remend
` This command will hide the mouse pointer
hide mouse
` Set ink colour
ink rgb(0,255,0),1
` Set boxes drawn counter
boxesdrawn=0
` Until 28 boxes have been drawn
repeat
` Increment boxes drawn
inc boxesdrawn
if boxesdrawn=1 or boxesdrawn=8 or boxesdrawn=15 or boxesdrawn=22
across=-35
endif
if boxesdrawn>=1 and boxesdrawn<=7 then inc across,80:down=20
if boxesdrawn>=8 and boxesdrawn<=14 then inc across,80:down=125
if boxesdrawn>=15 and boxesdrawn<=21 then inc across,80:down=230
if boxesdrawn>=22 and boxesdrawn<=28 then inc across,80:down=335
wait 50
` Draw box
box across,down,across+71,down+96
until boxesdrawn=28
` A short wait before proceeding
wait 1000
remstart
=======================================================
By comparison
***********************
Author: gearce - June 2007
***********************
CODE 2
=======================================================
remend
` This command will hide the mouse pointer
hide mouse
` Set ink colour
ink rgb(255,0,0),1
` Set boxes drawn counter
boxesdrawn=0
` Set across and down coordinates
across=-35:down=20
` Until 28 boxes have been drawn
repeat
` Increment boxes drawn
inc boxesdrawn
` Increment across coordinate
inc across,80
` Draw box
box across,down,across+71,down+96
` Increment check counter
inc check
` If check counter equals 7,
` set across and down coordinates
if check=7
across=-35:inc down,105
check=0
endif
` A short wait before proceeding
wait 50
until boxesdrawn=28
` Wait for key press
suspend for key
If you wish to keep the programme, first create a folder on your computer (e.g. By Comparison). Next, highlight the text, right click, copy and paste into DB Classic and save in the folder.
gearce
(GRC)
LANG MEY YER LUM REEK