khval / AmosKittens

Amos interpreter under development, most commands are support, some extensions are supported.
MIT License
10 stars 3 forks source link

Strange math bug in "Graphic 3D-Cube.Amos" #44

Closed khval closed 2 years ago

khval commented 2 years ago

Describe the bug:

Strange math bug in "Morphing2.amos" and "Graphic 3D-Cube.Amos" (I think bug is similar, so reported as one bug.)

khval commented 2 years ago

"Morphing.amos" / "Morphing2.amos" found a bug in "Screen Mode" command. (not a math issue.)

khval commented 2 years ago

Expected cause, if many arrays with index are used in the same mathematical formula, I guess the index get confused. might be store value at wrong place, maybe? This needs investigation.

khval commented 2 years ago

Issue with arrays inside expressions with in parenthesis, think its fundamental issue with how arrays are handled in Amos kittens, two things come to mind, its pretty complicated, does it need to be? why can’t indexes be handled in the same why as parenthesis is implemented. Should not parenthesis remember last variable? I can imagine problems with nested arrays.

khval commented 2 years ago

Nested arrays works, it looks like the problem is even more fundamental, it has to do with order of * / + - % etch, it looks like the ( and ) symbols, destroys the order of operations, the stack is also over written and corrupted.

khval commented 2 years ago

Looks like some of the problem is solved. At least cube is now drawn, but is not centered like it should.

khval commented 2 years ago

Wrote a few tests, should be working now.