[SOLVED} Looking for Solution to Sodoku Problem

faile486

  • Posts: 15
I'm trying to create a Sodoku game, and I'm running into an issue with programming the solutions.

If I were programming this in another language, I'd make each block a variable and set each variable to the user input. The solution would be an array.

I'm having a hard time coming up with a way to do this in Stencyl.

Right now, each block of the Sodoku grid is an actor, with an attached behavior for user input and a blinking cursor.

Any help would be greatly appreciated!

« Last Edit: April 06, 2017, 08:18:46 am by faile486 »

LIBERADO

  • *
  • Posts: 2720
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

faile486

  • Posts: 15
I have a list set up now that triggers on scene creation that contains the solution. I want to compare the list with the user input when I click a button, but it says that the behavior doesn't exist.  After reading a bit, it looks like actor and scene behaviors can't interact?

stefan

  • *
  • Posts: 2263
They can with blocks like:
For [actor] get [attribute] from behavior [behavior]
For this scene get [attribute] from behavior [behavior]

You can even trugger custom events like this:
For [actor] trigger [event] in behavior [behavior]
For this scene trigger [event] in behavior [behavior]

faile486

  • Posts: 15
The block: for [self] get [_puzzle1solution] from behavior [Solution] but I get an error saying the behavior doesn't exist?

Adobe Flash Player Error:
Error #1009: Cannot access a property or method of a null object reference

Stencyl Log Error:
com.stencyl.behavior.BehaviorManager#getAttribute(135): Warning: Behavior does not exist - Solution

Solution is triggering on creation, does it disappear after it finishes running?

stefan

  • *
  • Posts: 2263
Make sure to first instantiate a list attribute before using it. In this case, before "add 1 to..." set puzzle1Sollution to create new list. Also, in the second screenshot is refering to "self" which is now saying get _puzzle1solution from self, which isnt correct, since you want to get the list attribute from your scene behavior. So instead, use "for this scene get _puzzle1solution from behavior Solution.
".