I forgot to mention that if you want to run the code I&#39;ve attached, you should compile it with -O or -O2. The interpreter is too slow to handle the brute force approach I applied...<br><br><div class="gmail_quote">On Tue, Nov 18, 2008 at 12:55 AM, Peter Verswyvelen <span dir="ltr">&lt;<a href="mailto:bugfact@gmail.com">bugfact@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Excellent!<div><br></div><div>I&#39;m still new at Haskell, and learning Reactive, but attached is some code&nbsp;I would like to convert to Reactive, one day. I&#39;m sure your Tetris example can help me do so, thanks!</div>
<div>
<br></div><div>My code is most likely horrible; I did not clean it up, added no comments, and it contains various hacks and stuff that could be done a zillion times better and shorter by someone that actually knows Haskell well. But the result is amusing to look at, it could be a silly screen saver.</div>

<div><br></div><div>The code is a simple semi-physical simulation of&nbsp;a bunch of bouncing balls. The point of intersection is computed exactly, so the balls can move as fast as possible. Moving the mouse to the right makes the balls move faster. It would be interesting to see if Reactive can handle this: the sampling time step needs to be rewound to the time of the first collision (or it could be handled differently in a Reactive setting, I don&#39;t know)</div>

<div><br></div><div>Currently the code needs Yampa and GLFW (from Hackage), but I use Yampa only for its vector space and forceable classes...</div><div><br></div><div>If anyone else wants to give this a shot: the more tutorials and demos that use Reactive, the better :)</div>

<div><br></div><div>Cheers,</div><div>Peter Verswyvelen</div><div><br></div><div><div class="gmail_quote">2008/11/17 Creighton Hogg <span dir="ltr">&lt;<a href="mailto:wchogg@gmail.com" target="_blank">wchogg@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="Wj3C7c">Hey Reactive,<br>Since I have no hosting space I&#39;m actually going to include the implementation as an attachment all in one file.&nbsp; It&#39;s not very long anyway, so it should be alright.<br>

<br>A few caveats:<br><br>This code is still _really_ ugly, but it does work as far as I&#39;ve tested<br>

There is no game over, you need to quit manually<br>There is no score or level adjustment yet.&nbsp; I need to add that when I have more time, i.e. after this week<br><br>That being said, my first real reactive program was surprisingly simple once I got comfortable with the semantics.&nbsp; The actual reactive code isn&#39;t that complicated, but it did take a pretty big shift in thinking from writing explicit game loops.<br>


<br>I&#39;ve included a good bit of comments so it hopefully it isn&#39;t too hard to follow, but if there are any questions about why I did something a particular way (the answer may be &#39;I&#39;m dumb&#39;) please e-mail me or find me on #haskell.<br>



<br></div></div>_______________________________________________<br>
Reactive mailing list<br>
<a href="mailto:Reactive@haskell.org" target="_blank">Reactive@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br>