Hidy ho! A long while ago i posted
this thread aspiring to program a sort of
powder game with accurate gravity. Thanks to all of the wonderful replies, i understood the gravity portion. Unfortunately, my plans were cut short by a growing interest in robotics.
I have since returned to programming, and with a warm up pseudo-particle sim (
set display mode 1280,1024,32
`Rules
`R->G
`R->Y
`R->P
`G->B
`G->Y
`G->C
`B->R
`B->C
`B->P
`Y->C
`Y->G
`Y->R
`C->P
`C->G
`C->B
`P->Y
`P->B
`P->R
Dim Prtcl(15,14)
Dim Deadp(8)
`Value Map
`Prtcl(a,b)
`a: particle id
`b: attributes
` 1: Type
` 1: R
` 2: G
` 3: B
` 4: Y
` 5: C
` 6: P
` (See above for particle interactions)
` 2: Size
` 3: x Position
` 4: y Position
` 5-14: Bonds
` Number at location is ID of particle that is bonded to
`Replace below section with the values of your choice
Prtcl(1,1) = 1
Prtcl(1,2) = 30
Prtcl(1,3) = 300
Prtcl(1,4) = 100
Prtcl(1,5) = 2
Prtcl(1,6) = 3
Prtcl(2,1) = 3
Prtcl(2,2) = 30
Prtcl(2,3) = 200
Prtcl(2,4) = 200
Prtcl(2,5) = 1
Prtcl(2,6) = 3
Prtcl(2,7) = 4
Prtcl(2,8) = 6
Prtcl(3,1) = 2
Prtcl(3,2) = 30
Prtcl(3,3) = 400
Prtcl(3,4) = 200
Prtcl(3,5) = 1
Prtcl(3,6) = 2
Prtcl(3,7) = 5
Prtcl(3,8) = 7
Prtcl(4,1) = 1
Prtcl(4,2) = 30
Prtcl(4,3) = 100
Prtcl(4,4) = 300
Prtcl(4,5) = 2
Prtcl(4,6) = 6
Prtcl(5,1) = 1
Prtcl(5,2) = 30
Prtcl(5,3) = 500
Prtcl(5,4) = 300
Prtcl(5,5) = 3
Prtcl(5,6) = 7
Prtcl(6,1) = 2
Prtcl(6,2) = 30
Prtcl(6,3) = 200
Prtcl(6,4) = 400
Prtcl(6,5) = 2
Prtcl(6,6) = 4
Prtcl(6,7) = 7
Prtcl(6,8) = 8
Prtcl(7,1) = 3
Prtcl(7,2) = 30
Prtcl(7,3) = 400
Prtcl(7,4) = 400
Prtcl(7,5) = 3
Prtcl(7,6) = 5
Prtcl(7,7) = 6
Prtcl(7,8) = 8
Prtcl(8,1) = 1
Prtcl(8,2) = 30
Prtcl(8,3) = 300
Prtcl(8,4) = 500
Prtcl(8,5) = 6
Prtcl(8,6) = 7
`Replace the above section with the values of your choice
do
for cp = 1 to 8
if deadp(cp) = 1 then inc cp
for cb = 5 to 8
cpt = prtcl(cp,1)
bid = prtcl(cp,cb)
cbt = prtcl(bid,1)
if cpt = 1
if cbt = 1
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 2
prtcl(cp,2) = prtcl(cp,2) + 1
endif
if cbt = 3
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 5
prtcl(cp,2) = prtcl(cp,2) - 1
endif
endif
if cpt = 2
if cbt = 1
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 2
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 3
prtcl(cp,2) = prtcl(cp,2) + 1
endif
if cbt = 6
prtcl(cp,2) = prtcl(cp,2) - 1
endif
endif
if cpt = 3
if cbt = 1
prtcl(cp,2) = prtcl(cp,2) + 1
endif
if cbt = 2
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 3
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 4
prtcl(cp,2) = prtcl(cp,2) - 1
endif
endif
if cpt = 4
if cbt = 4
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 5
prtcl(cp,2) = prtcl(cp,2) + 1
endif
if cbt = 6
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 3
prtcl(cp,2) = prtcl(cp,2) - 1
endif
endif
if cpt = 5
if cbt = 4
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 5
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 6
prtcl(cp,2) = prtcl(cp,2) + 1
endif
if cbt = 1
prtcl(cp,2) = prtcl(cp,2) - 1
endif
endif
if cpt = 6
if cbt = 4
prtcl(cp,2) = prtcl(cp,2) + 1
endif
if cbt = 5
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 6
prtcl(cp,2) = prtcl(cp,2) - 1
endif
if cbt = 2
prtcl(cp,2) = prtcl(cp,2) - 1
endif
endif
next cb
next cp
for cp = 1 to 7
if deadp(cp) = 1 then inc cp
if prtcl(cp,2) = 0 then gosub killparticle
` if prtcl(cp,2) => 100 then gosub splitparticle
next cp
for cp = 1 to 8
if deadp(cp) = 1 then inc cp
if prtcl(cp,1) = 1 then ink rgb(255,0,0),0
if prtcl(cp,1) = 2 then ink rgb(0,255,0),0
if prtcl(cp,1) = 3 then ink rgb(0,0,255),0
if prtcl(cp,1) = 4 then ink rgb(128,128,0),0
if prtcl(cp,1) = 5 then ink rgb(0,128,128),0
if prtcl(cp,1) = 6 then ink rgb(128,0,128),0
circle prtcl(cp,3),prtcl(cp,4),prtcl(cp,2)/4
next cp
loop
killparticle:
for ca = 1 to 6
prtcl(cp,ca) = 0
next ca
deadp(cp) = 1
cls
return
<-- The code for anyone interested) completed, i am going to return to my previous ambition.
Now before i can start, i have one problem. As particles coalesces into larger chunks, the program will have to identify the particles that are joined. To do this i was thinking of have a section of the program check to see if two particles need to be joined, and if so, create an array of the relative locations of the particles in the chunk. Something like : Chunk_array(chunk_id,x,y).
If these "chunks" are to have any spin, i need to be able to rotate all the particles a cirtain amount without distorting the look. I, not being the best programmer in the world, have no clue how to do this. Help
?
Everything is more than the sum of its parts.