after12am / eisenscript

A programming language designed for generating awesome structures.
https://after12am.github.io/eisenscript-docs/
MIT License
46 stars 5 forks source link

error in script parsing ? #44

Closed kronpano closed 7 years ago

kronpano commented 7 years ago

following script should produce some sort of Beddard's pyramid

crate rule crate md 3{ {} fbox { s 0.5 x 0.9 z 0.9 y -0.9 } crate //1 { s 0.5 x -0.9 z 0.9 y -0.9 } crate //2 { s 0.5 x 0.9 z -0.9 y -0.9 } crate //3 { s 0.5 x -0.9 z -0.9 y -0.9 } crate //4 } rule fbox{ {} frame {rx 90} frame {rz 90}frame } rule frame{ { y 0.46 } ring { y -0.46 } ring } rule ring { // front { s 1 0.08 0.08 z 5.75 } box // back { s 1 0.08 0.08 z -5.75 } box // left { s 0.08 0.08 1 x -5.75 } box // right { s 0.08 0.08 1 x 5.75 } box // middle horizontal { s 0.08 0.08 1 x 0} box // middle vertical { s 1 0.08 0.08 x 0 } box }

It does so in Structure Synth but - as far as I can see - here it does not traverse into the crate rule and through number 2,3 and 4 - only number one is executed.

Perhaps an issue with breadth first -not depth? Not sure where to look for that one.

Structure Synth image vs BrowserSynth image

ghost commented 7 years ago

I think it may be a bug around the random choosing of weighted rules. In case of rule's weight of 1, it seems to run every rules. But eisenscript runs only one rules according to random seeds. So it should be fixed the bug.

after12am commented 7 years ago

fix version is: https://raw.githubusercontent.com/after12am/eisenscript/master/build/eisenscript.js

This was hard to fix very than I think. And I think transcompiler is very difficult again. But It is happy to have user like you.

Thank you,

after12am commented 7 years ago

Here is works. But the code you tested was not work well...

crate
rule crate md 2 {
{} fbox
{ s 0.5 x 0.9 z 0.9 y -0.9 } crate //1
{ s 0.5 x -0.9 z 0.9 y -0.9 } crate //2
}

rule fbox{
  box
}
after12am commented 7 years ago

Sorry, it worked. My testing code was a bit tweaked. try it, please.

kronpano commented 7 years ago

Thanks a lot!!! Yes - looks like it works well!!!

Question: do you want it to work like Structure Synth? That means - do you expect to see the same structure when you use the same script in Stucture Synth and in BrowserSynth (sorry for the name - just using it to distinguish the two).

after12am commented 7 years ago

BrowserSynth is sound good. You have a nice sence for naming things.

The anser is yes!