<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>void-flower &#187; pokemon</title>
	<atom:link href="http://void-flower.net/ribbons/pokemon/feed/" rel="self" type="application/rss+xml" />
	<link>http://void-flower.net</link>
	<description></description>
	<lastBuildDate>Sat, 31 Jul 2010 03:15:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Summer&#8217;s almost over&#8230;</title>
		<link>http://void-flower.net/2010/07/summers-almost-over/</link>
		<comments>http://void-flower.net/2010/07/summers-almost-over/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 03:07:53 +0000</pubDate>
		<dc:creator>Rebecca</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[orientation]]></category>
		<category><![CDATA[pokemon]]></category>

		<guid isPermaLink="false">http://void-flower.net/?p=344</guid>
		<description><![CDATA[I love Pokemon.]]></description>
			<content:encoded><![CDATA[<p>From two entries ago (so still on this page&#8230;):</p>
<blockquote><p>Come summer though, I’ll probably do something. I keep planning a lot of things to do, but never do them (story of my life). [March 14, 2010]</p></blockquote>
<p>Sure, like that really happened. Wishful thinking as always. [Insert meta-ing about meta posts here.]</p>
<p>It is now July, and I haven&#8217;t done much aside from my fourth co-op term (done this item Sept. 3rd) and the Math Orientation website. John and I visited each other a lot, and I went to his cottage last weekend. He is there now, while I am studying for STAT231 (<abbr title="Bullshit">BS</abbr>231) &#8212; lucky him! I also took another Japanese course this term, and already had the exam. Two courses and co-op &#8212; never again.</p>
<p>I remember back in high school, the summers I would just waste away doing nothing. I think all I did was develop random useless scripts on the computer and play <abbr title="Ragnarok Online">RO</abbr>. I used to stay up until 5-6am, go to bed, and then wake up in the early evening to resume what I was doing before. What a waste! This summer, I am working full-time, on the computer doing side projects/websites, and playing RO again. That is mostly just the weekdays, too. Weekends usually have consisted of John coming down (from Toronto) or me going up via Greyhound. There (or here) we spend our time lying around doing nothing at all.</p>
<p>Such contrast from the high school summers.</p>
<p>It&#8217;s a bit depressing that I will never have a high school summer again, as I will never have a summer where I won&#8217;t be in school still or working full-time. The only time I can imagine having a &#8216;free&#8217; summer like that is when I am very pregnant/having small children. That won&#8217;t be for a long while though :)</p>
<p>Awesomely enough, my summer has also been filled with Pokemon. I think I have also progressed from a fan to avid fan. </p>
<p>From the beginning of the Orientation week planning, I suggest Pokemon because it&#8217;s awesome &#8212; it made it to being the theme. I am the webmaster for the website, so lots of Pokemon for me there. Designing/developing that hackery was/is fun. <a href="http://orientation.math.uwaterloo.ca" title="UW Math Orientation 2010 - POKEMON!11!!">Check out the glory.</a> A lot of the hours spent aren&#8217;t even visible to the user, sadly. The secret special <abbr title="Awesome organizer people">FOC</abbr> pages are what I spent most of the time on. There the four FOC can view/edit the applicants&#8217;/leaders&#8217; information. Not exactly difficult with PHP/MySQL, but it takes more time for error handling/data checking when not just writing things for myself. A couple forms and things from the main website that the leaders/applicants used also took some time as well. Frankly I&#8217;m surprised no one from the <abbr title="UW Computer Science Club">CSC</abbr> or elsewhere has attempted to break/hijack the entire thing. Everyone has generally been nice &#8212; only a few spams and stupid things. </p>
<p>In addition to that, I just bought Pokemon SoulSilver. I previously&#8230; acquired&#8230; the ROM image from the vastness of the <abbr title="Series of tubes">Internet</abbr> and placed it on my&#8230; piece of DRAM that magically allows games to be played on the DS&#8230; but the game kept freezing and once erased my save file. After 5+ times of restarting the game, I just decided to buy the thing. First time I bought a DS game. I was so excited to learn that it came with a little pedometer thing &#8212; the PokeWalker. Sounds really lame, but you can put a Pokemon from the DS game &#8216;on&#8217; it, and take it for a  &#8216;walk&#8217;. I thought it was just steps => EXP, but you can apparently play little item/Pokemon games on it. It has a little concept of currency which you can trade for the ability to play a little game to get an item, or play a little game to find a Pokemon and fight/capture it. It reminds me of those old Nanos and Tamagotchis. I&#8217;m pretty impressed, I must say.<br />
The graphics of the DS game are super hot, too. :D</p>
]]></content:encoded>
			<wfw:commentRss>http://void-flower.net/2010/07/summers-almost-over/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modelling Small Systems with UML and dot/graphviz</title>
		<link>http://void-flower.net/2009/12/modelling-uml-with-dotgraphviz/</link>
		<comments>http://void-flower.net/2009/12/modelling-uml-with-dotgraphviz/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 11:28:14 +0000</pubDate>
		<dc:creator>Rebecca</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[all-nighter]]></category>
		<category><![CDATA[dot]]></category>
		<category><![CDATA[graphviz]]></category>
		<category><![CDATA[pokemon]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://void-flower.net/?p=301</guid>
		<description><![CDATA[Learn about modelling small systems with UML and graphviz/dot.]]></description>
			<content:encoded><![CDATA[<p>The first (but hopefully not last) geeky instructional-type thing I&#8217;ll post.</p>
<h2>What is UML, graphviz, dot?</h2>
<p>UML stands for <a href="http://en.wikipedia.org/wiki/Unified_Modeling_Language">Unified Modelling language</a>. A picture/diagram is used to represent a &#8217;system&#8217;, by which I mean a program in this case. Wikipedia says &#8220;UML includes a set of graphical notation techniques to create visual models of software-intensive systems.&#8221;</p>
<p><a href="http://graphviz.org">Graphviz</a> is a free set of software that allows you to describe graphs in various ways. Dot is a language &#8211; nothing more &#8211; that represents a graph. The graphviz software takes a description of a graph written in dot, and give you your image in various formats.</p>
<p>Dot is a simple language, and uses intuitive labels and values for things like edges and nodes. The hardest part is thinking of what you need, and finding the correct spelling of the attributes to apply to your node/edge. (But that can be found on the documentation site &#8211; and google).</p>
<p>To make any graphs, you need: graphiz (there are windows binaries, and packages in popular linux distributions). Dot is a tool included with graphviz. You also need a text editor. There are GUIs for making graphs (and OSes like OSX have larger programs that use graphviz) but I&#8217;m going to be on the command line in Ubuntu. </p>
<h2>First graph</h2>
<p>There are a couple types of graphs (that I&#8217;ve seen so far and used) and they are directed graphs and undirected graphs. Directed means that there are arrows and form a direct relationship between nodes, and undirected means there are no arrows between the nodes, and the path from one node to another is bidirectional.</p>
<p>So let&#8217;s make a graph now. The hello world of graphs:</p>
<pre>
digraph G {
    node [ shape="box" ]
    edge [ arrowhead="dot" ]

    Hello [ label="Hello" ]
    World [ label="World", color="blue" ]

    Hello -> World
}
</pre>
<p><span id="more-301"></span><br />
On the command line, I ran this command:</p>
<pre>
$ dot -Tpng -o helloworld.png helloworld.dot
</pre>
<p>-T specifies a type for the output to take. I chose a PNG image. Other types include, but not limited to, PDF, PS, BMP, GIF, JPEG&#8230; the list goes on. The -o allows me to specify an explicit output file. Last on the line is the input file &#8211; my description of the graph.</p>
<p>and this makes:</p>
<p><img src="http://void-flower.net/wordpress/wp-content/uploads/2009/12/helloworld.png" alt="Hello -&gt; World" title="helloworld" width="85" height="155" class="size-full wp-image-303" /></p>
<p>As you may have noticed, I didn&#8217;t say anything about where things were placed, or whether Hello  is below World or not. The point of this graphing software is to that stuff for you. It magically figures out (via fancy algorithms) where to put things to occupy the space in the most efficient manner, without having things overlap or look ugly. </p>
<p>The line-by-line:<br />
<b>digraph G</b> says you&#8217;re going to make a new digraph (short for <em>di</em>rected graph) called G. <b>node</b> and <b>edge</b> here are describing all the edges and nodes for this graph. <b>Hello</b> and <b>World</b> are nodes. They have attributes: label, and for World, color. By default, text is black, nodes are white. I&#8217;ve changed the shape colour of World to blue. I could have set other things like background colours, text colours, and probably shape outlines. The label goes inside the node. One of the most important lines, <b>Hello -> World</b>, describes the relationship between Hello and World. The <em>edgeop</em> here tells us that Hello points to World. Since I chose &#8220;dot&#8221; for my edge above, I get a line with a circle at the end. Without relationships, directed graphs are pretty pointless. </p>
<p>Play around with all the options and you can make some pretty cool graphs. I made a digraph to model my course plan for university a while ago located <a href="http://csclub.uwaterloo.ca/~rjputins/courseplan.png">here</a>. Each node is a course, and the relationships define prerequisites. I coloured a bunch of nodes the same colours, and those represent the terms I will do those courses in. Other examples of digraphs include things like family trees, maps, fancy to-do lists, graph theory stuff, visualisations of various data structures. </p>
<h2>UML and this digraph stuff</h2>
<p>So for my last CS246 project, we need to make a UML diagram to fit on an 8.5&#215;11 sheet of paper. We&#8217;re handing it in electronically, so it must be done on the computer at some point. I really didn&#8217;t feel like writing it on paper, then opening up gimp/paint to draw boxes and lines for 3hrs. I&#8217;ve used dot before, so I know it&#8217;s much easier to open a text editor and write the descriptions of these graphs. It&#8217;s very easy to modify, then just compile in less than a second. </p>
<p>There are 7 classes, and 2 subclasses for this project design. So I need 9 boxes to draw the classes, then shove arrows between them in a way that describes how the classes interact with each other. UML&#8217;s boxed are sectioned into at least 2 sections. So far I&#8217;ve only done one shape &#8211; the box. Most of the other shapes graphviz offers look to be like only one label. How do I fit so much stuff into a node?</p>
<p>There is a special shape called a &#8216;record&#8217;. It allows for a special definition of a label that makes sections out of your node. The sections are formed when a pipe (|) character is seen in the label. <a href="http://www.graphviz.org/doc/info/shapes.html#record">Read more about the record shape.</a></p>
<pre>
digraph C {
    SomeClass [
        shape="record"
        label="{SomeClass|some attributes\l|some operations/methods\l}"
    ]
}
</pre>
<p><img src="http://void-flower.net/wordpress/wp-content/uploads/2009/12/class.png" alt="class" title="class" width="267" height="112" class="aligncenter size-full wp-image-309" /></p>
<p>The description looks messy for that, but the important point here is that the pipes separate the label into sections. The \l in there means: make a new line, and align to the left. </p>
<p>With record, I can make my classes now, and then join them like a normal digraph. I&#8217;ll make a sample, more interesting system to model instead of the one I&#8217;m doing for my project.</p>
<h2>Sample Model &#8211; Pokemon</h2>
<p>Pokemon is cool. Let&#8217;s use pokemon for an example. I&#8217;ll model an example party of pokemon and a trainer. The key thing to look for here is common methods (attacks) between pokemon, and the connection between me (the trainer). You will see the basics UML and a simple system model in this example. </p>
<pre>
digraph Party {
    node [ shape="record" ]
    // I want the default arrowhead, so I won't set any
    // global (until changed later) edge descriptions

    Trainer [
        // You can use string concatenation to split strings into smaller chunks
        label="{Trainer|- name : String\l- money : Integer\l|" +
                 "- party : String[1..*]\l" +
                 "+ callPokemon( pokemon : Pokemon ) : bool\l" +
                 "+ returnPokemon ( pokemon : Pokemon ) : void\l}"
     ]

    Pokemon [
        label="{Pokemon|- name : String\l- health : Integer\l|" +
                 "+ tackle : Attack\l}"
        color="orange"
    ]

    Charmander [
        label="{Charmander|\l|+ ember : Attack\l}"
        color="red"
    ]

    Vaporeon [
        label="{Vaporeon|\l|+ surf : Attack\l}"
        color="blue"
    ]

    // Finally, the relationships
    // Vaporeon is a Pokemon
    Vaporeon -> Pokemon [ arrowhead="empty" ]

    // So is Charmander
    Charmander -> Pokemon [ arrowhead="empty" ]

    // Trainer can have up to 6 pokemon
    // Each pokemon is caught by only one trainer
    Trainer -> Pokemon [
        label="caught"
        headlabel="1..6"
        taillabel="1"
        arrowhead="none"
    ]
}
</pre>
<p>Once again:</p>
<pre>
dot -Tpng -o pokemon.png pokemon.dot
</pre>
<p>Okay, so that took a long time. I should have been working on something else (see <a href="#sidenote">sidenote</a>). It looks like a lot of stuff up there in order to describe an image you could have drawn faster, but for much larger diagrams, this is faster (you can write programs to write dot code for you). The product of all this is:</p>
<p><img src="http://void-flower.net/wordpress/wp-content/uploads/2009/12/pokemon.png" alt="pokemon" title="pokemon" width="386" height="160" class="aligncenter size-full wp-image-315" /></p>
<p>As for explaining things, I will assume you now have some knowledge of UML from the wikipedia page, and understand what the arrows and lines mean as well as the basic attribute types.</p>
<p>The most important segment of the description above is:</p>
<pre>
    Trainer -> Pokemon [
        label="caught"
        headlabel="1..6"
        taillabel="1"
        arrowhead="none"
    ]
</pre>
<p>This tells us about the relationship between the Trainer and the multiple pokemon &#8211; called &#8216;caught&#8217;. Since a party of pokemon can contain from 1 to 6 pokemon (1 to 6 caught pokemon), I&#8217;ve set my label to be 1..6 at the pokemon point. Each pokemon can only be caught by only one trainer, so taillabel is 1. These are called &#8216;restrictions&#8217; in the model. They give the viewer some more detail about how your system/program works. If I had put headlabel=&#8221;*&#8221; that would mean that a Trainer could catch 0 or more pokemon (all 150+!).</p>
<pre>
Charmander -> Pokemon [ arrowhead="empty" ]
Vaporeon -> Pokemon [ arrowhead="empty" ]
</pre>
<p>These two lines mean that the subclasses of Pokemon &#8211; Charmander and Vaporeon &#8211; are represented as a parent/child relationship. Pokemon contains common operations (attacks) and attributes (name, health). In a program, Vaporeon and Charmander would <em>inherit</em> from the Pokemon base class.</p>
<h2>Conclusion</h2>
<p>Pokemon is awesome. The record shape makes UML possible in dot.</p>
<p><a name="sidenote"></a><br />
<em>It&#8217;s 6am now and I didn&#8217;t sleep yet for one, and I should have been writing the test documentation and finishing the UML diagram for the project. Instead, I thought I&#8217;d make this tutorial. I&#8217;ve also eaten a lot of carrots in this time.</p>
<p>Idea: turn this into a mathNEWS article!!11!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://void-flower.net/2009/12/modelling-uml-with-dotgraphviz/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
