Popular recipes by Shea Kauffman http://code.activestate.com/recipes/users/4168682/2012-03-27T19:30:47-07:00ActiveState Code RecipesUseful Unrestricted Grammar (Python)
2012-03-27T19:30:47-07:00Shea Kauffmanhttp://code.activestate.com/recipes/users/4168682/http://code.activestate.com/recipes/578087-useful-unrestricted-grammar/
<p style="color: grey">
Python
recipe 578087
by <a href="/recipes/users/4168682/">Shea Kauffman</a>
(<a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/grammar/">grammar</a>, <a href="/recipes/tags/grammer/">grammer</a>, <a href="/recipes/tags/language/">language</a>, <a href="/recipes/tags/thue/">thue</a>, <a href="/recipes/tags/turing_machine/">turing_machine</a>, <a href="/recipes/tags/unrestricted/">unrestricted</a>).
</p>
<p>This is an implementation of an easy to use unrestricted grammar. It could be used for quickly prototyping a DSL, testing a post-formal system, or parsing test in a way that requires context. It would however be extremely slow for simple substitutions.</p>
Planet Terrain Heightmap Generator (Python)
2010-03-10T16:35:37-08:00Shea Kauffmanhttp://code.activestate.com/recipes/users/4168682/http://code.activestate.com/recipes/576929-planet-terrain-heightmap-generator/
<p style="color: grey">
Python
recipe 576929
by <a href="/recipes/users/4168682/">Shea Kauffman</a>
(<a href="/recipes/tags/creation/">creation</a>, <a href="/recipes/tags/generation/">generation</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/heightmap/">heightmap</a>, <a href="/recipes/tags/landscape/">landscape</a>, <a href="/recipes/tags/map/">map</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/planet/">planet</a>, <a href="/recipes/tags/planted/">planted</a>, <a href="/recipes/tags/pygame/">pygame</a>, <a href="/recipes/tags/terrain/">terrain</a>, <a href="/recipes/tags/world/">world</a>).
Revision 9.
</p>
<p>The process is simply:
1. Take a plane
2. Cut out a shape
3. Make it a little taller
4. Repeat</p>
<ul>
<li>Similar to the <a href="http://freespace.virgin.net/hugo.elias/models/m_landsp.htm">spherical landscape</a> algorithm by Hugo Elias.</li>
<li>I found a combination of Ovals and Triangles to produce the best results.</li>
</ul>
Unrestricted Grammar used like a dictionary (Python)
2009-01-04T19:10:28-08:00Shea Kauffmanhttp://code.activestate.com/recipes/users/4168682/http://code.activestate.com/recipes/576606-unrestricted-grammar-used-like-a-dictionary/
<p style="color: grey">
Python
recipe 576606
by <a href="/recipes/users/4168682/">Shea Kauffman</a>
(<a href="/recipes/tags/dict/">dict</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/grammar/">grammar</a>, <a href="/recipes/tags/grammer/">grammer</a>, <a href="/recipes/tags/language/">language</a>, <a href="/recipes/tags/thue/">thue</a>, <a href="/recipes/tags/turing_machine/">turing_machine</a>).
</p>
<p>Programs can be written as substitutions. This allows a set of substitution rules to be defined and then strings are transformed using these rules in a left recursive manner.</p>