Hi,
I need to "get" some code for shuffling an Order of Attack for up to 37 on board characters.
I found a snippet called "Swap Array Items" at:
http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1Util_29/swap_array_items.html
It doesn't work, but then I'm like 6 months doing programming. The word, I believe is "Sophomore".
Here's my code:
REMSTART - My dillemma. Shuffle the order of attack of up to
37 Souls On Board. I found this piece of code at
http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1Util_29/swap_array_items.html
Remarks highlighted by "***" show my distress.
REMEND
REM - This file is shuffleatkord.dba
REM - Get all sob's (Souls On Board)
REM - TC's are Characters controlled by players
REM - EC's are Enemy Characters controlled by AI
REM - AC's are Army Characters controlled by AI
DATA "TC1","TC2","TC3","TC4","TC5","TC6","EC11","EC12","EC13","EC14"
DATA "EC15","EC16","EC17","EC18","EC19","EC20","EC21","EC22","AC31"
DATA "AC32","AC33","AC34","AC35","AC36","AC37","AC38","AC39"
DATA "AC40","AC41","AC42","AC43","AC44","AC45","AC46","AC47"
DATA "AC48","AC49","AC50"
DIM Array(37)
FOR I=0 to 36
READ Array(I)
NEXT I
FOR CHG=1 TO 11
DOOVER:
randomize timer()
IT1#=RND(37)
IT2#=RND(37)
REM - print is for testing the goto do()over IF
print IT1#;" ";IT2#
suspend for key
IF IT1#=IT2#
GOTO DOOVER
ENDIF
REM - *** The "Miracle" should happen here!!!
REM - *** How is this code "supposed" to be written?
SWAP ARRAY ITEMS Array(), Index 1, Index2
REM - *** I "Imagine" it should look like this:
SWAP ARRAY ITEMS Array(), IT1#, IT2#
REM - *** Of course "My theory" doesn't work!!!
NEXT CHG
RESTORE
FOR ATKORD=1 TO 11
READ Array(ATKORD)
NEXT CHG
PRINT Array(1);" ";Array(2);" ";Array(3)
PRINT Array(4);" ";Array(5);" ";Array(6)
PRINT Array(7);" ";Array(8);" ";Array(9)
PRINT Array(10);" ";Array(11)
SUSPEND FOR KEY
Thank you all, greatly,
Cafe Casita
Cafe Casita says YES