I wrote a program to solve Sudoku puzzles, and when I run it I get a problem... various submorphs stop drawing (and get rendered as a red box with a yellow cross through it), and a walkback comes up with "Error: Error: Instances of UndefinedObject are not indexable" (in WorldState>>displayWorldSafely)
Not sure if I'm doing something wrong with my program or if it is an error in Morphic.
Essentially, I fork a process and set a morph to step while the forked process updates the model that the morph is drawing from.
The code can be downloaded from here: http://thams.com/Kurt-Sudoku-ktt.2.mcz
and executed with 'Kudoku example1'
Any help appreciated.
-- kurt
Kurt Thams wrote:
I wrote a program to solve Sudoku puzzles, and when I run it I get a problem... various submorphs stop drawing (and get rendered as a red box with a yellow cross through it), and a walkback comes up with "Error: Error: Instances of UndefinedObject are not indexable" (in WorldState>>displayWorldSafely)
Not sure if I'm doing something wrong with my program or if it is an error in Morphic.
Essentially, I fork a process and set a morph to step while the forked process updates the model that the morph is drawing from.
Don't fork off a process. Morphic runs in a single thread and a you will get errors like this if you try using other processes. Use morphics step mechanism or if you _really_ have to use a seperate process use WorldState>>addDeferredUIMessage: Karl
The code can be downloaded from here: http://thams.com/Kurt-Sudoku-ktt.2.mcz
and executed with 'Kudoku example1'
Any help appreciated.
-- kurt
karl wrote:
Kurt Thams wrote:
I wrote a program to solve Sudoku puzzles, and when I run it I get a problem... various submorphs stop drawing (and get rendered as a red box with a yellow cross through it), and a walkback comes up with "Error: Error: Instances of UndefinedObject are not indexable" (in WorldState>>displayWorldSafely)
Not sure if I'm doing something wrong with my program or if it is an error in Morphic.
Essentially, I fork a process and set a morph to step while the forked process updates the model that the morph is drawing from.
Don't fork off a process. Morphic runs in a single thread and a you will get errors like this if you try using other processes. Use morphics step mechanism or if you _really_ have to use a seperate process use WorldState>>addDeferredUIMessage: Karl
So how do you properly use Morphic to display the intermediate results of a long-running, computationally-intensive process? This code could not be runing in the step method, otherwise the display would never update.
Would you have your computationally-intensive process running in a forked thread, and the implementor of "step" then alters the values underlying the morph objects?
-- kurt
Kurt Thams wrote:
karl wrote:
Kurt Thams wrote:
I wrote a program to solve Sudoku puzzles, and when I run it I get a problem... various submorphs stop drawing (and get rendered as a red box with a yellow cross through it), and a walkback comes up with "Error: Error: Instances of UndefinedObject are not indexable" (in WorldState>>displayWorldSafely)
Not sure if I'm doing something wrong with my program or if it is an error in Morphic.
Essentially, I fork a process and set a morph to step while the forked process updates the model that the morph is drawing from.
Don't fork off a process. Morphic runs in a single thread and a you will get errors like this if you try using other processes. Use morphics step mechanism or if you _really_ have to use a seperate process use WorldState>>addDeferredUIMessage: Karl
So how do you properly use Morphic to display the intermediate results of a long-running, computationally-intensive process? This code could not be runing in the step method, otherwise the display would never update.
Would you have your computationally-intensive process running in a forked thread, and the implementor of "step" then alters the values underlying the morph objects?
Yup, that is the best way to do it. By the way, there is an other Sudoku solver on SqueakSource. I have not used it. karl
On Sat, Dec 31, 2005 at 09:49:53PM +0100, karl wrote:
Kurt Thams wrote:
karl wrote:
Kurt Thams wrote:
I wrote a program to solve Sudoku puzzles, and when I run it I get a problem... various submorphs stop drawing (and get rendered as a red box with a yellow cross through it), and a walkback comes up with "Error: Error: Instances of UndefinedObject are not indexable" (in WorldState>>displayWorldSafely)
Not sure if I'm doing something wrong with my program or if it is an error in Morphic.
Essentially, I fork a process and set a morph to step while the forked process updates the model that the morph is drawing from.
Don't fork off a process. Morphic runs in a single thread and a you will get errors like this if you try using other processes. Use morphics step mechanism or if you _really_ have to use a seperate process use WorldState>>addDeferredUIMessage: Karl
So how do you properly use Morphic to display the intermediate results of a long-running, computationally-intensive process? This code could not be runing in the step method, otherwise the display would never update.
Do this:
WorldState addDeferredUIMessage: ["display your intermediate results"]
It's perfectly OK to run background processes as you describe. All you need to do is schedule the display parts to run in the Morphic UI process using #addDeferredUIMessage:.
Dave
squeak-dev@lists.squeakfoundation.org