andycyca [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=65617 Simple histogram toy <p> <table><tr><td> <a href="/bbs/?pid=111298#p"> <img src="/bbs/thumbs/pico8_nofehukjo-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=111298#p"> nofehukjo 0.1 alpha</a><br><br> by <a href="/bbs/?uid=65617"> andycyca</a> <br><br><br> <a href="/bbs/?pid=111298#p"> [Click to Play]</a> </td></tr></table> </p> <p>Newbie amateur game dev here! I've been programming for a few years now, mostly for academic/scientific purposes. I've always wanted to try my hand at making games, but I've always found an excuse not to.</p> <p>So screw that, I'm starting from zero in a new language doing the absolute minimum that I can call a &quot;thing&quot; and here it is: a very simple histogram tool that &quot;rolls&quot; virtual dice and displays the frequency of the different rolls (excluding events with zero-frequency).</p> <p>I'm used to doing this with more sophisticated tools and <em>ad-hoc</em> libraries, learning to do things &laquo;by hand&raquo; is a challenge in and of itself.</p> <p>The histograms do not generally follow the distribution that one would expect. I believe this happens because:</p> <ol> <li>Strong cryptographic principles and robust (pseudo-)random number generation is outside the scope of a tool like Pico-8, and</li> <li>Andy has screwed something in the code and prefers to publish something imperfect rather than trying to perfect it and never publish it.</li> </ol> <p>So here it is, a small tool that will expose me and <em>might</em> help someone in the future.</p> <h2>Customization</h2> <p>Ideally, you should only need to customize three things:</p> <ul> <li><code>rolls</code> is how many times you will try the experiment; in a real-life situation you want this to be large</li> <li><code>dpr</code> is how many dice you're rolling each time. It's the first number in the common dice notation (1d8)</li> <li><code>ds</code> is the dice size, or how many faces the virtual dice have. Common dice for D&amp;D are obviously 4, 6, 8, 10, 12, and 20; but one can customize it to other numbers for &laquo;impossible&raquo; dice.</li> </ul> <h2>What else?</h2> <p>I haven't tested this with larger numbers, mostly because P8 is not the tool for such rigorous analysis and data visualization. Use large numbers at your peril.</p> https://www.lexaloffle.com/bbs/?tid=47667 https://www.lexaloffle.com/bbs/?tid=47667 Wed, 04 May 2022 21:28:00 UTC