Latest Uploads
Mutant Mon ... (Blitz3D)

steve_ancell

Mutant Mon ... r package.

steve_ancell

image-13-0 ... -01-38.jpg

Jayenkai

Mutant Monty Remake

steve_ancell

hai.jpg

CodersRule

SillyAddition.png

Jayenkai

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
Mutant Monty update.
Hotshot Tue 16:08
Android Dev Test Doohickey
Jayenkai Tue 09:58
Aminal Xing Knew Leef
Jayenkai Tue 04:25
Spark
dna Mon 17:24
HoboTile
steve_ancell Sun 10:07
Hoover
steve_ancell Sat 21:53
Scrabble Rabble
Jayenkai Fri 08:13
Not Fit for Purpose
Jayenkai Thu 20:29
Happy Birthday, Krakatomato
steve_ancell Thu 18:03
How Deep is Your Code?
Hotshot Thu 14:35
More

Latest Items
Blog : Snow Worklog
Cower Mon 12:23
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
steve_ancell Sat 19:12
Showcase : MLG : Microscopic Lifeform Genocide
rockford Wed 09:24
News : Newsletter #176
Jayenkai Sat 04:49
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
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
More

Who's Online
Jayenkai
Tue, at 16:32
Hotshot
Tue, at 16:32
CodersRule
Tue, at 16:24
dna
Tue, at 16:15
therevillsgames
Tue, at 16:01
steve_ancell
Tue, at 15:46
shroom_monk
Tue, at 15:29
HoboBen
Tue, at 15:17
rockford
Tue, at 14:20
spinal
Tue, at 13:55
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.