Game within a game. A simple recreation of Think-A-Dot.

Started by Bearstonaut, Sat 28/05/2011 18:13:24

Previous topic - Next topic

Bearstonaut

Disregard.  I'm an idiot.

Bearstonaut

Quote from: Bearstonaut on Sat 28/05/2011 18:13:24
Hi experts.

I'm at the finish line for a 6-month 40-room project, and one of my final puzzles will be a recreation of the classic game "Think-A-Dot".  I was very excited at how well it was going, but hit an outcome I cannot explain and need a fresh set of eyes.

To see what Think-A-Dot looks like, check out this recreation here:

http://scratch.mit.edu/projects/kevin_and_abe/48878
or
http://www.webster.edu/~lovedo/thinkadot/think_a_dot.html

The premise is simple enough.  Think-a-Dot has an upright frame with three openings at the top, into which you can drop a marble. The marble travels through and drops out the bottom. There are eight dots on the front of the frame, in rows of three, two, and three, and they are yellow or blue. They indicate the state of a flip-flop gate inside the frame. If a marble reaches a gate, it is deflected either left or right depending on the state of the gate, and as the marble passes, the gate will flip over to the other state.

In my game, the gates are marked A1, A2, A3 in the first row.  B1 and B2 in the second row.  C1, C2 and C3 in the third row.  The marble drop positions are labelled Drop1, Drop2 and Drop3 respectively.

If the gate is colored BLUE or Graphic 443, the marble is to go left.
If the gate is colored YELLOW or Graphic 444, the marble is to go right.

Now I started to code the possible outcomes for a marble being dropped in the first slot position as follows...

function Drop1_Interact()
{
if (A1.Graphic==443){
 A1.Graphic=444;
   if (C1.Graphic==443){
   C1.Graphic=444;}
   else if (C1.Graphic==444){
   C1.Graphic=443;}
}
else if (A1.Graphic==444){
 A1.Graphic=443;
   if (B1.Graphic==443){
       B1.Graphic=444;
       if (C1.Graphic==443){
         C1.Graphic=444;}
       else if (C1.Graphic==444){
         C1.Graphic=443;}      
   }      
   else if (B1.Graphic==444){
     B1.Graphic=443;
       if (C2.Graphic==443){
       C2.Graphic=444;}
       else if (C2.Graphic==444){
       C2.Graphic=443;}
   }
}
}

The game initializes with all of the buttons BLUE.  Now, I would have thought that dropping the marble in Drop1 would have an outcome of A1 and C1 turning YELLOW.  In practice, however, which this code, A1 and C1 stay BLUE and B1 turns yellow.

I am wracking my brain to see where this code goes wrong.  Do any of you have any bright ideas?  If any of this is unclear, let me know and I'll try to provide more information.

Thank you, in advance.


Please disregard this post.  I'm an idiot that forgot to delete a piece of old code that effectively borked the outcome.

Snake

Even though you may feel like an idiot, you are not an idiot. You simply overlooked some old code. I wish I had half the brain everyone around here has when it comes to coding. Don't be so hard on yourself and good luck with this project!

:D
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

SMF spam blocked by CleanTalk