Alan,
What I'm not clear on is the relative importance to your project of - the bitmap-like qualities of an ImageMorph vs. - the world/container qualities of a PasteUpMorph
If it is the former, here is an example of how you can have a Form on the screen, make changes to it and see those changes. ============= f _ Form extent: 400@400 depth: 32. f fillColor: Color red. aiworld _ ImageMorph new image: f; openInWorld. World displayWorldSafely. (Delay forSeconds: 1) wait. "so you can see each change happen"
f fillColor: Color green. aiworld changed. World displayWorldSafely. (Delay forSeconds: 1) wait.
f getCanvas line: 0@0 to: 400@400 width: 6 color: Color yellow. aiworld changed. World displayWorldSafely. (Delay forSeconds: 1) wait.
f getCanvas line: 400@0 to: 0@400 width: 6 color: Color blue. aiworld changed. World displayWorldSafely. (Delay forSeconds: 1) wait. =============
If it is the latter, the you might try something like this ============= aiworld _ PasteUpMorph new extent: 400@400; openInWorld. aiworld addMorph: (RectangleMorph new position: 100@100). aiworld addMorph: (EllipseMorph new position: 200@200). aiworld imageForm inspect. "<--your ai could 'read' this form to see wwhat's happening" =============
Cheers, Bob
Bob Arning wrote:
What I'm not clear on is the relative importance to your project of - the bitmap-like qualities of an ImageMorph vs. - the world/container qualities of a PasteUpMorph
They are both important. The first is required for the AI to function, and the second is required to give it a sufficiently interesting world to interract with. Eg: I should be able to drop in an instance of ChessMorph...
If it is the latter, the you might try something like this
aiworld _ PasteUpMorph new extent: 400@400; openInWorld. aiworld addMorph: (RectangleMorph new position: 100@100). aiworld addMorph: (EllipseMorph new position: 200@200). aiworld imageForm inspect. "<--your ai could 'read' this form to see wwhat's happening" =============
Now this is something I wouldn't have guessed!!!
From my tinkering with it I have found that this seems to dump a copy of
the screen display including borders.
This has several drawbacks. -- it is not synchronized with the pasteup. The AI may indeed be very slow but even still it has to think it is running at normal speed regardless of how much time it takes to execute. -- It involves a copy operation which adds a significant ammount of overhead.
Even still, I had not known this approach was even possible so this is indeed very interesting.
squeak-dev@lists.squeakfoundation.org