<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>tag:blog.danieljanus.pl,2019:category:games</id>
  <title>Daniel Janus – games</title>
  <link href="http://blog.danieljanus.pl/category/games/"/>
  <updated>2010-02-10T00:00:00Z</updated>
  <author>
    <name>Daniel Janus</name>
    <uri>http://danieljanus.pl</uri>
    <email>dj@danieljanus.pl</email>
  </author>
  <entry>
    <id>tag:blog.danieljanus.pl,2010-02-10:post:clojure-set</id>
    <title>Clojure SET</title>
    <link href="http://blog.danieljanus.pl/clojure-set/"/>
    <updated>2010-02-10T00:00:00Z</updated>
    <content type="html">&lt;div&gt;&lt;p&gt;I’ve just taken a short breath off work to put &lt;a href="http://github.com/nathell/setgame"&gt;some code&lt;/a&gt; on GitHub that I had written over one night some two months ago. It is an implementation of the &lt;a href="http://en.wikipedia.org/wiki/Set_(game)"&gt;Set&lt;/a&gt; game in Clojure, using Swing for GUI.&lt;/p&gt;&lt;p&gt;I do not have time to clean up or comment the code, so I’m leaving it as is for now; however, I hope that even in its current state it can be of interest, especially for Clojure learners.&lt;/p&gt;&lt;p&gt;Some random notes on the code:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Clojure is concise! The whole thing is just under 250 lines of code, complete with game logic and the GUI. Of these, the logic is about 50 LOC. Despite this it reads clearly and has been a pleasure to write, thanks to Clojure’s supports for sets as a data structure (in vein of the game’s title and theme).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;There are no graphics included. All the drawing is done in the GUI part of code (I’ve replaced the canonical squiggle shape by a triangle and stripes by gradients, for the sake of easier drawing).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;I’ve toyed around with different Swing layout managers for this game. Back in the days when I wrote in plain Java, I used to use &lt;a href="https://tablelayout.dev.java.net/"&gt;TableLayout&lt;/a&gt;, but it has a non-free license; &lt;a href="http://www.jgoodies.com/freeware/forms/"&gt;JGoodies Forms&lt;/a&gt; is also nice, but has a slightly more complicated API (and it’s an additional dependency, after all). In the end I’ve settled with the standard GridBagLayout, which is similar in spirit to those two, but requires more boilerplate to set up. As it turned out, simple macrology makes it quite pleasurable to use; see &lt;code&gt;add-gridbag&lt;/code&gt; in the code for details.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Other things of interest might be my function to randomly shuffle seqs, which strikes a nice balance between simplicity/conciseness of implementation and randomness; and a useful debugging macro.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Comments?&lt;/p&gt;&lt;/div&gt;</content>
  </entry>
  <entry>
    <id>tag:blog.danieljanus.pl,2008-04-07:post:yavp</id>
    <title>YAVP</title>
    <link href="http://blog.danieljanus.pl/yavp/"/>
    <updated>2008-04-07T00:00:00Z</updated>
    <content type="html">&lt;div&gt;&lt;pre&gt;&lt;code&gt;Jezus, the high elven wizard, saved the world with his brave efforts and became a great ruler while saving himself 34 times.
He scored 24999532 points and advanced to level 50.
He survived for 0 years, 123 days, 0 hours, 11 minutes and 39 seconds (176207 turns).
Jezus visited 127 places.
His strength score was modified by +26 during his career.
His learning score was modified by +17 during his career.
His willpower score was modified by +10 during his career.
His dexterity score was modified by +7 during his career.
His toughness score was modified by +25 during his career.
His charisma score was modified by +9 during his career.
His appearance score was modified by +6 during his career.
His mana score was modified by +13 during his career.
His perception score was modified by +15 during his career.
He was unnaturally aged by 76 years.
He was the champion of the arena.
He was a member of the thieves guild.
He made a little water dragon very happy.
He defeated the arch enemy of a mighty karmic wyrm.
He adhered to the principles of the Cat Lord and thus rose to great fame.
He saved Khelavaster from certain death.
He left the Drakalor Chain after completing his quest and became a great leader and famous hero.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Yay! Now that I have finished ADOM for the first time ever, after something like six years of trying, I can finally get back to work with peace of mind. :-)&lt;/p&gt;&lt;/div&gt;</content>
  </entry>
</feed>
