Latest Uploads
Extraterre ... .0.1 (zip)

dantheman363

Monty Teas ... Screenie 1

steve_ancell

Santa Clau ... ed his bag

waroffice

manic_platdude.png

spinal

Tetris Clone

steve_ancell

Super blues bros.

spinal

Forum Home

Atomino

UserMessage
Posted : Sunday, 24 October 2010, 11:11 | Permalink | Mark Here
Jayenkai


WW Entries : 103
FFS, Spinal, this is far too complex for the shoutbox!
People, use the forum!!

Right, IIRC, Atomino was about little atoms, each one had a preset number of pegs, and you needed to attach an atom to each peg without any leftover pegs.

...or, something, been a long long time!
*checks a Youtube vid to be sure*

It's REALLY easy to do this, and you're overthinking things with your idea for a flood fill.

ArrayS!!

First array is Atom(x,y), where 0 = nothing, 1=blue, 2=red, etc.

Pop a red on the grid, Atom(x,y)=2

Next, a Peg(x,y) array.

Peg is a binary number, where 1=A Peg Up is here, 2= A Peg Right is here, 4=A Peg Down is here, 8 = A Peg Left is here, and OR combinations are the various combinations thereof.

eg..
Array(5,5)=2;Peg(5,5)=6
display red atom, draw a right facing peg, and a down facing peg.



So, you've got your red atom at, say 5,5
No pegs yet.
We place a second red atom at 5,6

Peg(5,6-1) isn't yet using all 2 pegs, (bin$(peg(x,y)), count the 1's) so allow a connection here.. Peg(5,6-1)=Peg(5,6-1)+4, and Peg(5,6)=Peg(5,6)+0
Whereas is Peg(5,6-1) has no pegs left, you wouldn't add a connection.

Do it whenever you place a new atom, and it'll keep track whilst you go.
If you erase an atom, be sure to clear it's pegs!

You might also want to flick through all the atoms once every few frames, to be sure there are no connections that could be made.

-----
Posted : Wednesday, 27 October 2010, 13:51 | Permalink | Mark Here
spinal


You're correct, that part is not too hard, it was the next part that I was thinking of. Detecting if a bunch of atoms have been joined completely with each other... which I'm lost with.

bmp image -
http://socoder.net/uploads/124/atoms.rar

-->

-----

3DS - 1762-2660-3218
Posted : Wednesday, 27 October 2010, 14:07 | Permalink | Mark Here
Jayenkai


WW Entries : 103
Aaah, then that bits a Forward/Backward/Up/down check.
Done this one plenty, too, it's not too tricky..(ish)

HasAll(x,y)

first to flag 'em on.

for x=0 to wide
for y=0 to high
HasAll(x,y)=1
if Atom doesn't have all pegs, and atom>0 then HasAll(x,y)=0
next
next

Next to combine ajoined.

for y=high to 0 step -1
for x=wide to 0 step -1
if y>0 and atom is here then if "peg up" is on and HasAll(x,y-1)=0 and there's an atom there, then HasAll(x,y)=0
and below
and left
and right
next
next

then again to double check


for x=0 to wide ; note the order's the other way around
for y=0 to high
if y>0 and atom is here then if "peg up" is on and HasAll(x,y-1)=0 and there's an atom there, then HasAll(x,y)=0
and below
and left
and right
next
next

And once more for good luck...


for y=high to 0 step -1
for x=0 to wide
if y>0 and atom is here then if "peg up" is on and HasAll(x,y-1)=0 and there's an atom there, then HasAll(x,y)=0
and below
and left
and right
next
next

Then flick through, and if a whole bunch have HasAll, then they should be removable..

That should do it..

Maybe..
Worth a triple/quadruple check, maybe, just to be on the safe side

-----
Posted : Saturday, 30 October 2010, 07:07 | Permalink | Mark Here
spinal


Not really working its removing single 'full' atoms even when ajoining ones are not full...

-->

-----

3DS - 1762-2660-3218
Posted : Saturday, 30 October 2010, 09:03 | Permalink | Mark Here
spinal


In my head, the following solution should work, recursively checking each atom from the click point, then if the result is that all atoms are completely joined, clear then...

-->

But it's failing and as this is the first time I have ever attempted recursion for any reason, I have no idea where I going wrong

-----

3DS - 1762-2660-3218
Posted : Saturday, 30 October 2010, 15:43 | Permalink | Mark Here
spinal


made a little (very little) progress, it seems to be correctly checking the full molecules, but then doing nothing about them

-->

-----

3DS - 1762-2660-3218
Posted : Sunday, 31 October 2010, 08:10 | Permalink | Mark Here
Jayenkai


WW Entries : 103
Blimey, that's chaotic.

If you can follow my additions, here ya go!

-->

-----
Posted : Sunday, 31 October 2010, 08:14 | Permalink | Mark Here
Jayenkai


WW Entries : 103
You'll also want to check your "if Atom>Peg" thing, because Peg isn't a number 1-4, it's a binary number..
and there's a handful of other quirks in there, too.

Quick test, blue atom left, blue atom right, red atom inbetween = red atom only connects to the left, not the right..

-----
Posted : Sunday, 31 October 2010, 09:05 | Permalink | Mark Here
spinal


I'm not 100% sure...
sparkly(x,y) is recording which atoms are getting checked and then im lost how is it different from checked(x,y)?

atom>peg fix -- you're right, it works much better now
-->

-----

3DS - 1762-2660-3218
Posted : Sunday, 31 October 2010, 09:14 | Permalink | Mark Here
Jayenkai


WW Entries : 103
It probably was the same, I just wasn't quite sure what it was you were doing, so threw my own equivalent version in there, instead

-----
Posted : Sunday, 31 October 2010, 09:16 | Permalink | Mark Here
spinal


Anyway, your way works and mine doesn't... either way, thanx, I wouldn't have figured it out by myself.

-----

3DS - 1762-2660-3218
Latest Posts
Position in Mind
steve_ancell Tue 23:09
Shoutbox Topic - 78
spinal Tue 22:51
Fucking Pound Sign Unicode Bullshit Bollocks
Dabz Tue 13:00
Progress / Location Bars
dna Tue 08:55
Screen Burn of the Mind
rockford Tue 02:13
RoadRash!
Mog Mon 10:56
Noel's Graduation
rockford Mon 07:37
Development via GUI
waroffice Mon 02:48
Audio Rant
steve_ancell Sat 19:16
Wrong Partition!!!!?
spinal Sat 11:24
More

Latest Items
News : Newsletter #176
Jayenkai Sat 04:49
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
rockford Fri 13:14
Techy : AppleTV
Jayenkai Thu 09:40
Blog : Graphviz
steve_ancell Sat 14:17
Pets : Top-Down Shadow Hack
Jayenkai Tue 05:52
Snippet : JNKrunch v1.0
Jayenkai Sat 07:20
News : Newsletter #173
waroffice Fri 04:47
Blog : Material Loading
Cower Fri 02:08
Pets : I Done Won A Thing
shroom_monk Sun 11:31
Pets : Repurposing A Lexer
Cower Mon 22:06
Bah : Feeling a Little Angry
spinal Mon 11:26
News : Newsletter #170
Dabz Sat 00:34
Showcase : sbfgen
Cower Sat 16:57
More

Who's Online
steve_ancell
Tue, at 23:10
Dabz
Tue, at 23:06
spinal
Tue, at 22:51
rockford
Tue, at 22:01
shroom_monk
Tue, at 21:38
9572AD
Tue, at 21:32
Evil Roy Ferguson
Tue, at 21:30
therevillsgames
Tue, at 20:43
dna
Tue, at 19:44
CodersRule
Tue, at 18:49
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.