<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6667097412706957271</id><updated>2011-07-31T11:11:54.725+01:00</updated><category term='while'/><category term='randomizer'/><category term='solundria'/><category term='guinness book'/><category term='mass writing'/><category term='XOR'/><category term='java'/><category term='contents'/><category term='patterns'/><category term='outline'/><category term='chunk16'/><category term='virus'/><category term='ellipses'/><category term='Processing.'/><category term='chunk 16'/><category term='OU Mass Writing'/><category term='Waterstones'/><category term='applet'/><category term='syntax'/><category term='Java Graphics'/><category term='record'/><category term='variables'/><title type='text'>OU Mass Writing - Rosie Wood</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>63</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8717379873641449247</id><published>2010-10-14T12:47:00.003+01:00</published><updated>2010-10-14T12:52:24.060+01:00</updated><title type='text'>Tapulla Release on Android Market</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/TLbulOA5IqI/AAAAAAAAAXo/nd_dolEp1cc/s1600/lev2.png"&gt;&lt;img style="cursor: pointer; width: 120px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/TLbulOA5IqI/AAAAAAAAAXo/nd_dolEp1cc/s200/lev2.png" alt="" id="BLOGGER_PHOTO_ID_5527867915828273826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;After much fun and hard work, I am proud to announce that I have released a game on the Android Market!&lt;br /&gt;It was written using Processing's Android Tool&lt;br /&gt;Tapulla  features original chill out music and is ideal for winding down with,  when commuting home from work. The children will like it too and you can  compete to see who is the overall family champion.&lt;br /&gt;Tapulla only costs 2 pounds and is well worth it! (Well, I would say that wouldn't I :))&lt;br /&gt;More levels free on next update too!&lt;br /&gt;More info on the &lt;a href="http://solundria.com/"&gt;website&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8717379873641449247?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8717379873641449247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2010/10/tapulla-release-on-android-market.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8717379873641449247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8717379873641449247'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2010/10/tapulla-release-on-android-market.html' title='Tapulla Release on Android Market'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Xfr7yTwHuG4/TLbulOA5IqI/AAAAAAAAAXo/nd_dolEp1cc/s72-c/lev2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2931623962347076437</id><published>2010-06-03T09:51:00.003+01:00</published><updated>2010-06-03T10:57:07.302+01:00</updated><title type='text'>Processing in Android - Very Desirable</title><content type='html'>My chunks for the OU book are finally done and I posted the last errata today...phew!&lt;br /&gt;  Having chosen Java whenever possible to obtain my degree it was great to learn to use Processing too. It allows me to use Java and make use of all the Processing facilities at the same time.&lt;br /&gt;  Any Java programmer would probably be interested in using Android for mobile phones and I have been no exception. I have been hankering after one of these phones for over a year now but they are so pricey!  I was absolutely delighted, therefore when my husband got me my HTC Desire! Then when I discovered that Processing have brought out a Beta tool for Android I was literally over the moon.&lt;br /&gt;  The tool at the moment has an Android emulator and a Present tool which allows you to attach the phone and see if your prog works correctly. The export facility generates a debug version apk file. This works for emulator and Present mode. To get the sketch to run standalone on your Android phone you just need to sign it with your private key. They are working on the"export application" option so that it produces a release version apk file that is digitally signed.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/TAd7Zc7PqzI/AAAAAAAAAWs/7NsSrWum6eA/s1600/c16.png"&gt;&lt;img style="cursor: pointer; width: 200px; height: 142px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/TAd7Zc7PqzI/AAAAAAAAAWs/7NsSrWum6eA/s200/c16.png" alt="" id="BLOGGER_PHOTO_ID_5478483148911127346" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Chunk 16 on Android Emulator&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2931623962347076437?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2931623962347076437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2010/06/processing-in-android-very-desirable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2931623962347076437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2931623962347076437'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2010/06/processing-in-android-very-desirable.html' title='Processing in Android - Very Desirable'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Xfr7yTwHuG4/TAd7Zc7PqzI/AAAAAAAAAWs/7NsSrWum6eA/s72-c/c16.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2125152600324977383</id><published>2010-01-05T10:12:00.018Z</published><updated>2010-01-18T14:29:36.052Z</updated><title type='text'>Chunk 55</title><content type='html'>I will be completing Chunk 55 which explains how polynomials can be used to draw different types of curves in Processing.&lt;br /&gt;The&lt;a href="http://barrymasswriting.blogspot.com/2008/10/introducing-polynomials.html"&gt; introduction to polynomials&lt;/a&gt; has already been written by Barry and I will attempt to carry on from there. This will mean that this chunk will be co-authored by Barry and myself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Text for Chunk 55&lt;/span&gt;  &lt;span style="font-style: italic;"&gt;following Barry's introduction.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Each component of a polynomial expression is called a term, and these are usually ordered from the highest exponent to the lowest.  Polynomial expressions do not contain negative or fractional exponents. A typical polynomial expression would have an ordered syntax:E.g. 6xcubed+5xsquared+7x-12 (Not sure how superscript is used in blogger)&lt;br /&gt;In this expression the leading term which has the largest exponent is 6xcubed and its degree is 3. ie 6x6x6 meaning 6 to the power of &lt;span style="font-weight: bold;"&gt;3&lt;/span&gt;.&lt;br /&gt;The leading term has a coefficient of 6, the second term coefficient is 5, the third term has a coefficient of 7 and the final term, which is a constant, doesn't have a coefficient.&lt;br /&gt;Monomial expressions have only one term, binomials have 2 and trinomials 3.&lt;br /&gt;When working with polynomials it is usual to name them for their leading degree (largest exponent) The expression 6xcubed + 5xsquared +7x - 12 would therefore be a 3rd degree polynomial or cubic.&lt;br /&gt;Polynomials of 2 degrees are called quadratics&lt;br /&gt;Polynomials of 3 degrees are called cubics&lt;br /&gt;Polynomials of 4 degrees are called quartics&lt;br /&gt;Polynomials of 5 degrees are called quintics&lt;br /&gt;In Chunk55 we will only be dealing with quadratic and cubic polynomials but it is interesting to see how the degree and coefficient of a polynomial expression affect the curves when plotted on a graph.&lt;br /&gt;Polynomials with an &lt;span style="font-weight: bold;"&gt;even numbered degree&lt;/span&gt; in their leading term, always enter and leave in the &lt;span style="font-weight: bold;"&gt;same direction&lt;/span&gt;. ie up or down. Therefore, quadratic polynomials are always parabolas.&lt;br /&gt;If the &lt;span style="font-weight: bold;"&gt;coefficient is even&lt;/span&gt;, then the curve will enter and leave at the top of the graph and if the&lt;span style="font-weight: bold;"&gt; coefficient is odd,&lt;/span&gt; it will enter and leave at the bottom.&lt;br /&gt;Polynomials with an &lt;span style="font-weight: bold;"&gt;odd numbered degree&lt;/span&gt; in their leading term, however, have curves that start and end in&lt;span style="font-weight: bold;"&gt; opposite directions&lt;/span&gt;. An &lt;span style="font-weight: bold;"&gt;odd numbered&lt;/span&gt; leading degree with a &lt;span style="font-weight: bold;"&gt;positive coefficient,&lt;/span&gt; will have a curve that starts at the bottom and exits at the top, while a &lt;span style="font-weight: bold;"&gt;negative coefficient,&lt;/span&gt; will have its starting curve coming in from the top and exiting at the bottom.&lt;br /&gt;To plot &lt;span style="font-weight: bold;"&gt;quadratic polynomials&lt;/span&gt;, we need to be able to place the x and y coordinates from 0 to the size of the window. We do this by using an offset of half the width/height of the window.&lt;br /&gt;The width of the parabola is shifted right by adding half the width of the window to the x coordinate and this variable has been named xShift.&lt;br /&gt;The height of the parabola is shifted down by subtracting half the height of the window from the y coordinate and this variable has been named yShift. This allows both upfacing and downfacing curves to be displayed to be displayed together in the window.&lt;br /&gt;An example quadratic such as:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;y=&lt;/span&gt; &lt;span style="font-style: italic;"&gt;6xsquared-7x+10&lt;/span&gt; In Processing is written as:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;y= 6* pow(x, 2)-7*x + 10;&lt;br /&gt;We know that the Processing display screen's coordinates start at the upper left corner,&lt;br /&gt;which is the opposite of a Cartesion Grid's layout, therefore we plot x and y with the statement: &lt;/span&gt;point(x+xShift, yShift-y*ratio); In our sketch we want to be able to display positive and negative versions of a quadratic expression at the same time so we must use yShift variable&lt;br /&gt;to place the curves centrally in our display window. The ratio uses our maximum coEfficient to&lt;br /&gt;calculate the spacing for our plots. As our maximum coEfficient is 50 we work out the scale with&lt;br /&gt;the statement:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;float ratio = height/(50*pow(loopLimit-1, 2)-50*loopLimit-1 + 100);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;The statements: &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;for (int i=-xShift; i&amp;lt;loopLimit; i++){&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;y = coEfficient* pow(x, 2)-7*x + 1;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;point(x+xShift, yShift-y*ratio);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;would draw one curve with plots of x and y for our chosen quadratic expression.&lt;br /&gt;&lt;span&gt;In this sketch, we will replace the leading term's coEfficient, with a variable between 2 and 50, in a for next loop. &lt;/span&gt;&lt;span&gt;This will give us a graph of nested parabolas with a variable coEfficient.&lt;br /&gt;A&lt;/span&gt;&lt;span&gt;s the exponent is an even number, we know our curves will all enter and leave in the same direction, also because our equation is quadratic we will have a parabola and because the coEfficient is even its opening will be at the top.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/S0u-Kkc7zeI/AAAAAAAAAV8/00QxyEC7opc/s1600-h/yup.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 298px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/S0u-Kkc7zeI/AAAAAAAAAV8/00QxyEC7opc/s320/yup.png" alt="" id="BLOGGER_PHOTO_ID_5425639264890899938" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;                                      &lt;span style="font-style: italic;"&gt;graph of &lt;/span&gt;&lt;span style="font-style: italic;"&gt;y=&lt;/span&gt; &lt;span style="font-style: italic;"&gt;coEfficient*xsquared-7x+10&lt;/span&gt;&lt;br /&gt;                                             where coEfficient=2 To 50&lt;br /&gt;When we add a plot of a quadratic parabola, with a negative coefficient in its leading term, we end up with this graph:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/S0vJrnaDquI/AAAAAAAAAWE/zglple23tpA/s1600-h/ydown.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 298px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/S0vJrnaDquI/AAAAAAAAAWE/zglple23tpA/s320/ydown.png" alt="" id="BLOGGER_PHOTO_ID_5425651927247727330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                                             graph of &lt;/span&gt;&lt;span style="font-style: italic;"&gt;y=&lt;/span&gt; &lt;span style="font-style: italic;"&gt;coEfficient*xsquared-7x+10&lt;/span&gt;      and                   &lt;br /&gt;&lt;span style="font-style: italic;"&gt;                                                            &lt;/span&gt;&lt;span style="font-style: italic;"&gt;y=&lt;/span&gt; -&lt;span style="font-style: italic;"&gt;coEfficient*xsquared-7x+10&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Code for final quadratic sketch:&lt;/span&gt;&lt;br /&gt;/*author: Rosie Wood&lt;br /&gt;January 2010*/&lt;br /&gt;size(400, 400);&lt;br /&gt;background(255);&lt;br /&gt;strokeWeight(3);&lt;br /&gt;float x = 0, y = 0;&lt;br /&gt;int loopLimit = 200;&lt;br /&gt;//shifts curve to the right&lt;br /&gt;int xShift = width/2;&lt;br /&gt;int yShift = height/2;&lt;br /&gt;/*As explained in Greenberg if magic numbers are used, the curves can&lt;br /&gt;be too large for the display window. He used the&lt;br /&gt;polynomial and plugged in the loop limit to get the maximum. This&lt;br /&gt;way if the window size changes, the program should still work.&lt;br /&gt;In this sketch I have tried to get a ratio that will work as long&lt;br /&gt;as the leading term's coEfficient is &amp;lt;=50 the second term coefficient&lt;br /&gt;does not make much difference and can be greater than 100 and still fit in the window. A constant also makes little difference to how well the curve fits in the window&lt;br /&gt;although the beginning and end of the curves could be outwith the&lt;br /&gt;boundaries of the display window*/&lt;br /&gt;float ratio = height/(50*pow(loopLimit-1, 2)-50*loopLimit-1 + 100);&lt;br /&gt;int coEfficient=0;&lt;br /&gt;for(coEfficient=2;coEfficient&amp;lt;50;coEfficient++){&lt;br /&gt;stroke(random(255),random(255),random(255));&lt;br /&gt;for (int i=-xShift; i&amp;lt;loopLimit; i++){&lt;br /&gt;&lt;br /&gt;x = i;&lt;br /&gt;/*Here the coefficient of the leading term is positive so the parabola&lt;br /&gt;should enter and leave at the top*/&lt;br /&gt;&lt;br /&gt;y = coEfficient* pow(x, 2)-7*x + 1;&lt;br /&gt;point(x+xShift, yShift-y*ratio);&lt;br /&gt;/*Here the coefficient of the leading term is negative so the parabola&lt;br /&gt;should enter and leave at the bottom*/&lt;br /&gt;&lt;br /&gt;y = -coEfficient* pow(x, 2)-7*x + 1;&lt;br /&gt;point(x+xShift, yShift-y*ratio);&lt;br /&gt;}}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Cubic Polynomials&lt;br /&gt;&lt;/span&gt;When graphing polynomials, the maximum number of bumps is equal to the degree of the polynomial-1. i.e. n-1&lt;span style="font-weight: bold;"&gt; ,&lt;/span&gt;&lt;span&gt; where n =the degree of the leading term&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;. &lt;/span&gt;&lt;br /&gt;A cubic polynomial has a degree of 3 in its leading term (x*x*x), so it will have at most 2 bumps (inflections/changes of direction).&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/S08DB7mX68I/AAAAAAAAAWU/YO8iQlaJj6Q/s1600-h/cubic.png"&gt;&lt;img style="cursor: pointer; width: 186px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/S08DB7mX68I/AAAAAAAAAWU/YO8iQlaJj6Q/s200/cubic.png" alt="" id="BLOGGER_PHOTO_ID_5426559407718132674" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Cubic Polynomial with a &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;positive coefficient in it's &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;leading term.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/S08DvVaWGbI/AAAAAAAAAWc/EZKPeSHdetE/s1600-h/cubic3.png"&gt;&lt;img style="cursor: pointer; width: 186px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/S08DvVaWGbI/AAAAAAAAAWc/EZKPeSHdetE/s200/cubic3.png" alt="" id="BLOGGER_PHOTO_ID_5426560187741116850" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Cubic Polynomial with a&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;negative coefficient in it's&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;                       &lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;leading term.&lt;/span&gt;&lt;/span&gt;                          &lt;span style="font-style: italic;font-size:85%;" &gt; &lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/S08D_jzmC5I/AAAAAAAAAWk/cuPSsHPKiP4/s1600-h/cubic2.png"&gt;&lt;img style="cursor: pointer; width: 186px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/S08D_jzmC5I/AAAAAAAAAWk/cuPSsHPKiP4/s200/cubic2.png" alt="" id="BLOGGER_PHOTO_ID_5426560466483022738" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;This sketch shows both types&lt;br /&gt;of polynomials&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt; together. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;To be co&lt;/span&gt;&lt;span style="font-style: italic;"&gt;n&lt;/span&gt;&lt;span style="font-style: italic;"&gt;t&lt;/span&gt;&lt;span style="font-style: italic;"&gt;i&lt;/span&gt;&lt;span style="font-style: italic;"&gt;nued......&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2125152600324977383?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2125152600324977383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2010/01/chunk-55.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2125152600324977383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2125152600324977383'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2010/01/chunk-55.html' title='Chunk 55'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/S0u-Kkc7zeI/AAAAAAAAAV8/00QxyEC7opc/s72-c/yup.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-880054220491792530</id><published>2009-08-19T16:16:00.003+01:00</published><updated>2009-08-19T16:25:24.781+01:00</updated><title type='text'>Unwanted Ads</title><content type='html'>I dont think Google should be posting advertisements for DVDs and such on my blog. I only signed up for the endangered animal of the day panel and I don't think this has anything to do with DVDs etc!&lt;br /&gt;&lt;br /&gt;Also I am fed up of the Flat Belly tip advert that keeps showing up when I'm browsing. Who told them I had a flat belly? Maybe I was only doing research for a friend when I clicked that lose fat advert!&lt;br /&gt;&lt;br /&gt;Also the advert that has, "Look how good I look at 'my age'". I dont go online to be subjected to catty comments.:p&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-880054220491792530?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/880054220491792530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/08/unwanted-ads.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/880054220491792530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/880054220491792530'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/08/unwanted-ads.html' title='Unwanted Ads'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3781159699753027385</id><published>2009-08-11T17:42:00.002+01:00</published><updated>2009-08-11T17:59:23.966+01:00</updated><title type='text'>Fingers Crossed</title><content type='html'>I'm hoping that Darrel has managed to edit Chunk 16 OK as the last I heard there were some problems....gulp&lt;br /&gt;I do think that a live forum would have made communication easier on the project.&lt;br /&gt;Is it alright to put some of the applets on our own sites?&lt;br /&gt;If we don't include the source code, I think it would help sales of the forthcoming OU Processing book. &lt;br /&gt;I don't know about the rest of you, but I really miss writing for my OU Processing blog...&lt;br /&gt;I've been busy trying to do search optimization on &lt;a href="http://www.solundrian.com/"&gt;Solundria&lt;/a&gt;&lt;br /&gt;I know this is a shameless plug but there's a lot of good content there! Honest...&lt;br /&gt;I used some of my processing programs to generate images for my snap games. I even made a Snappy Easter version with Easter eggs. This involved using 3d spheres with some of the Chunky program's images.&lt;br /&gt;Details are available in this blog somewhere.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3781159699753027385?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3781159699753027385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/08/fingers-crossed.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3781159699753027385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3781159699753027385'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/08/fingers-crossed.html' title='Fingers Crossed'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8274493697924414668</id><published>2009-05-27T23:09:00.003+01:00</published><updated>2009-05-27T23:16:26.435+01:00</updated><title type='text'>Chunk 16 - Product Line</title><content type='html'>Zazzle.co.uk is an interesting new website and I just had to try its design a product widgets using chunk 16 images. This could be a good way of generating money for the Open University Student Hardship fund.&lt;br /&gt;I intend adding some more products and will perhaps use Chunk 46 images too.&lt;br /&gt;Watch this space for more funky chunky products!&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://www.zazzle.co.uk/utl/getpanel?tl=codecoaster%27s%20Store%20at%20Zazzle&amp;amp;ch=codecoaster&amp;amp;at=238119637416211284&amp;amp;st=POPULARITY" flashvars="path=http://www.zazzle.co.uk/assets/swf/zp/skins" wmode="transparent" type="application/x-shockwave-flash" width="450" height="300"&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8274493697924414668?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8274493697924414668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/05/chunk-16-product-line.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8274493697924414668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8274493697924414668'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/05/chunk-16-product-line.html' title='Chunk 16 - Product Line'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2222304711253709458</id><published>2009-04-08T17:08:00.004+01:00</published><updated>2009-04-08T18:33:15.702+01:00</updated><title type='text'>Mix Up</title><content type='html'>&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdzMqx9xbBI/AAAAAAAAASg/yK0YclwPhiI/s1600-h/mix7.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 152px; height: 152px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdzMqx9xbBI/AAAAAAAAASg/yK0YclwPhiI/s320/mix7.gif" alt="" id="BLOGGER_PHOTO_ID_5322353894984084498" border="0" /&gt;&lt;/a&gt;We learned in Chunk45 how we can use the mask method to create an image from two other images. Chunk46 images can be used to create a mask. Instead of using one mask we shall explore how we can use a different mask on each image in a folder of generated images.&lt;br /&gt;&lt;/p&gt;  &lt;p&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdzOGhdEw-I/AAAAAAAAASw/3htnYQt0CfU/s1600-h/mix30.gif"&gt;&lt;img style="cursor: pointer; width: 131px; height: 131px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdzOGhdEw-I/AAAAAAAAASw/3htnYQt0CfU/s320/mix30.gif" alt="" id="BLOGGER_PHOTO_ID_5322355471099937762" border="0" /&gt;&lt;/a&gt;We need to decide on the file type and the size of the images we would like to make. The size of our window, masks and images must be the same size, although they can be of different file types. We can use any sketch that loops through the draw method.  If we examine the code for Chunk16 we can see, that a new image is generated and displayed, at the end of every iteration of draw. We will therefore use Chunk16 as an example. As a new image is displayed at the end of draw it would make sense to place the save statement there. We initialize an integer as a global variable so its value can be referenced outside of draw. We increment the integer by one at the start of draw and at the end of draw we just add a save statement e.g.:&lt;br /&gt;                               save("name"+n+".gif");&lt;br /&gt;Where name is the name of the file each image will have followed by a sequential number n. We can increase the frame rate and use the exit method to close Chunk16 when it has generated the required amount of images. We would add an if statement to control how many images were generated like so:&lt;br /&gt;if(n==20)exit();&lt;br /&gt;Next we perform the same process on the Chunk 46 code to produce the same amount of images, changing the name so the images wont be overwritten when moved.&lt;br /&gt;Next we write a simple sketch to use the Chunk46 images as a mask on the Chunk 16 images. (or vica versa)&lt;br /&gt;&lt;br /&gt;Here is the code for the masking program:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;int n=0;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;void setup(){&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;size(700, 700);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;frameRate(.2);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;  &lt;span style="font-family:courier new;"&gt;void draw(){&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;n++;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;if(n&gt;50)n=0;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;PImage img = loadImage("c"+n+".jpg");&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;PImage i= loadImage("line"+n+".gif");&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;//PImage img= loadImage("line20.gif");&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;image(i, 0, 0, 700, 700);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;filter(GRAY);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;loadPixels();&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;img.mask(pixels);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;image(img, 0, 0, 700, 700);&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;save("mix"+n+".gif");&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;As you can see it uses the code we have just discussed to save a copy of each masked image. If you add an image to the sketch then save it, a data folder will be created, where we can copy the images in Chunk16 and Chunk 46 to. &lt;/p&gt;&lt;p&gt;The new images will be saved in the new sketch's folder.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdzfkFsApEI/AAAAAAAAAS4/VS_jExOnc0c/s1600-h/mix13.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 400px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdzfkFsApEI/AAAAAAAAAS4/VS_jExOnc0c/s400/mix13.gif" alt="" id="BLOGGER_PHOTO_ID_5322374670740137026" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt; &lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2222304711253709458?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2222304711253709458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/04/mix-up.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2222304711253709458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2222304711253709458'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/04/mix-up.html' title='Mix Up'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdzMqx9xbBI/AAAAAAAAASg/yK0YclwPhiI/s72-c/mix7.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-1964124411968472621</id><published>2009-04-04T20:49:00.004+01:00</published><updated>2009-04-04T20:57:22.733+01:00</updated><title type='text'>Chunk 46 - Program Completed</title><content type='html'>The Chunk 46 program is shown running in the video below, it tends to run slower when the next image is more detailed. We could decrease the variable patsPerPic to speed it up a bit or adjust the framerate.&lt;br /&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4004230&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=4004230&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/4004230"&gt;Chunk 46 - HeadLines&lt;/a&gt; from &lt;a href="http://vimeo.com/user1140029"&gt;Rosie Wood&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-1964124411968472621?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/1964124411968472621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk-46-program-completed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1964124411968472621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1964124411968472621'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk-46-program-completed.html' title='Chunk 46 - Program Completed'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5357394426071032636</id><published>2009-04-04T15:07:00.013+01:00</published><updated>2009-04-04T16:14:26.844+01:00</updated><title type='text'>Chunk 46 - Optional Modifications</title><content type='html'>This section is optional and we must decide if it is worth attempting to decipher another persons code our weite our own. The scenario is one which often crops up when writing a program. We have some code that someone else wrote, or code we ourselves wrote, that would add some desired quality to our application. It seems to fit the bill but when we copy and paste it into our own code we find that it isnt a perfect fit. We may decide it would be easier to just write our own code or we may feel that the code would save us a lot of time.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SddquUmpaYI/AAAAAAAAARU/TdnP7DPbpng/s1600-h/line13.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SddquUmpaYI/AAAAAAAAARU/TdnP7DPbpng/s200/line13.gif" alt="" id="BLOGGER_PHOTO_ID_5320838828798863746" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SddqBYtNDRI/AAAAAAAAARE/58ULdJZbAeU/s1600-h/line5.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SddqBYtNDRI/AAAAAAAAARE/58ULdJZbAeU/s200/line5.gif" alt="" id="BLOGGER_PHOTO_ID_5320838056805993746" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SddqVJAMguI/AAAAAAAAARM/aP9B5VnqgnE/s1600-h/line12.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SddqVJAMguI/AAAAAAAAARM/aP9B5VnqgnE/s200/line12.gif" alt="" id="BLOGGER_PHOTO_ID_5320838396188066530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdduXObwroI/AAAAAAAAAR0/A4cmg_qAT8o/s1600-h/line22.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdduXObwroI/AAAAAAAAAR0/A4cmg_qAT8o/s200/line22.gif" alt="" id="BLOGGER_PHOTO_ID_5320842830052109954" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SddtFAXUwEI/AAAAAAAAARs/cDyTtmqFBhI/s1600-h/line15.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SddtFAXUwEI/AAAAAAAAARs/cDyTtmqFBhI/s200/line15.gif" alt="" id="BLOGGER_PHOTO_ID_5320841417526132802" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SddshtAflEI/AAAAAAAAARk/cem-W-b_CTk/s1600-h/line16.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SddshtAflEI/AAAAAAAAARk/cem-W-b_CTk/s200/line16.gif" alt="" id="BLOGGER_PHOTO_ID_5320840811034678338" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/Sddx0nm2rlI/AAAAAAAAASM/C70V0AYoq0o/s1600-h/line40.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/Sddx0nm2rlI/AAAAAAAAASM/C70V0AYoq0o/s200/line40.gif" alt="" id="BLOGGER_PHOTO_ID_5320846633560616530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SddwRmCBcHI/AAAAAAAAAR8/IJb4SM7Djp4/s1600-h/line37.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SddwRmCBcHI/AAAAAAAAAR8/IJb4SM7Djp4/s200/line37.gif" alt="" id="BLOGGER_PHOTO_ID_5320844932330647666" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/Sddwn6aZSwI/AAAAAAAAASE/ZUTG5Tfpx1w/s1600-h/line36.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/Sddwn6aZSwI/AAAAAAAAASE/ZUTG5Tfpx1w/s200/line36.gif" alt="" id="BLOGGER_PHOTO_ID_5320845315758705410" border="0" /&gt;&lt;/a&gt;The code in this case, is contained in a for loop, in another program we wrote some time ago.  It contains many new patterns and the images above only use a few of them. Study these images and decide whether you want to use them and modify &lt;a href="http://www.solundrian.com/procs/forLoop.pde"&gt;THE CODE&lt;/a&gt; .&lt;br /&gt;The finished code will not be available here and so you will have to buy the book or modify this code if you want to add the new patterns.&lt;br /&gt;Tip: If your code slows down after making the changes, trace the code through the for loops and make sure you are clear about how many times a function is executing!&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5357394426071032636?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5357394426071032636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk-46-optional-modifications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5357394426071032636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5357394426071032636'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk-46-optional-modifications.html' title='Chunk 46 - Optional Modifications'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/SddquUmpaYI/AAAAAAAAARU/TdnP7DPbpng/s72-c/line13.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-7327696985145649438</id><published>2009-04-03T15:33:00.007+01:00</published><updated>2009-04-04T14:27:25.197+01:00</updated><title type='text'>Ch46 - An Array of Difficult Choices</title><content type='html'>After careful consideration of how to implement the choices available for pattern 7 we decide to use an array to hold the available choices.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdYfeFNQJ7I/AAAAAAAAAQ8/tsqvubiUZrc/s1600-h/line41.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdYfeFNQJ7I/AAAAAAAAAQ8/tsqvubiUZrc/s200/line41.gif" alt="" id="BLOGGER_PHOTO_ID_5320474611439118258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdYe4tfivWI/AAAAAAAAAQs/zX0Hskd8CqQ/s1600-h/line21.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdYe4tfivWI/AAAAAAAAAQs/zX0Hskd8CqQ/s200/line21.gif" alt="" id="BLOGGER_PHOTO_ID_5320473969418222946" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdYfGvIkScI/AAAAAAAAAQ0/vujn9NiO_FQ/s1600-h/line28.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdYfGvIkScI/AAAAAAAAAQ0/vujn9NiO_FQ/s200/line28.gif" alt="" id="BLOGGER_PHOTO_ID_5320474210376894914" border="0" /&gt;&lt;/a&gt;boolean [] segments={false,false,false,false,false,false,false,false};&lt;br /&gt;If we allowed any choices at all for pattern 7 what would be the outcome? We decide to try this out and implement a function to use our array. We need to reset the arrays values to false when we start to draw a pattern 7 design. Then we must randomly decide which segments to draw.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void oops(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    resetSegs();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   for(int n=0;n&amp;lt;8;n++){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       if(round(random(1))==0){segments[n]=true;}     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   println(segments);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[0]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(0,height-y,y,y);}//oopsleft down&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[1]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(width-x,0,x,x);}//oopsup right&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[2]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(x,0,width-x,x);}//oopsup left&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[3]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(width,y,y,height-y);}//oopsright down&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[4]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(width,height-y,y,y);}//oopsrightup&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[5]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(width-x,height,x,x);}//oopsdown left&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[6]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(x,height,width-x,x);}//oopsdown right&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(segments[7]==true){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(0,y,y,height-y);}//oopsleft up&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void resetSegs(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  for(int n=0;n&amp;lt;segments.length;n++){&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  segments[n]=false;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;When we run our application with this function, every time our function executes, all the segments are drawn. On careful inspection, we realise that resetting the array and filling in the choices should not be within the function or the for loops. We move the offending code from the function to the start of the while loop:&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;&lt;span style="font-size:85%;"&gt;while(count&amp;lt;patsperpic){&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;resetSegs();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; for(int n=0;n&amp;lt;8;n++){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;     if(round(random(1))==0){segments[n]=true;}   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; }&lt;/span&gt;&lt;br /&gt;changeColour();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;An example of running our application with no limits on the choices for pattern 7, is as shown in the images above. We may decide that this is acceptable or not...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The patterns used in Chunk 46 include 4 different meshes, which we may feel don't merit a case statement each. If we moved this code to one case statement then we would have more patterns and less meshes.&lt;br /&gt;&lt;a href="http://www.solundrian.com/procs/ch46.pde"&gt;Example Source Code&lt;/a&gt; with space for 2 new patterns&lt;br /&gt;The next section is optional and involves adding new patterns from another program's for loop.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-7327696985145649438?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/7327696985145649438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/04/ch46-array-of-difficult-choices.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7327696985145649438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7327696985145649438'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/04/ch46-array-of-difficult-choices.html' title='Ch46 - An Array of Difficult Choices'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdYfeFNQJ7I/AAAAAAAAAQ8/tsqvubiUZrc/s72-c/line41.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8078314471052817375</id><published>2009-04-02T20:44:00.009+01:00</published><updated>2009-04-03T16:47:21.041+01:00</updated><title type='text'>Chunk 46 - Structure</title><content type='html'>In this section we will move our patterns into functions and decide how each function will control the symmetry of its own pattern.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdXqF0AQ9rI/AAAAAAAAAQk/0e9vW9o4HPQ/s1600-h/line43.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdXqF0AQ9rI/AAAAAAAAAQk/0e9vW9o4HPQ/s200/line43.gif" alt="" id="BLOGGER_PHOTO_ID_5320415920388110002" border="0" /&gt;&lt;/a&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdUchpT446I/AAAAAAAAAP0/DCd34a0wiJU/s1600-h/line35.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdUchpT446I/AAAAAAAAAP0/DCd34a0wiJU/s200/line35.gif" alt="" id="BLOGGER_PHOTO_ID_5320189899158643618" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdUcvhTGnRI/AAAAAAAAAP8/QsKDr_D8v74/s1600-h/line38.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdUcvhTGnRI/AAAAAAAAAP8/QsKDr_D8v74/s200/line38.gif" alt="" id="BLOGGER_PHOTO_ID_5320190137526033682" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;We want to make our program as easy to manage as possible so we decide we will have a global variable that will control the amount of lines each statement will use to be drawn to the screen. As the size of the pixels is different vertically and horizontally we will use two for next loops to contain the pattern controlling.&lt;br /&gt;Here is a list of the variables we might end up with:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;int numLines=20;//changing this controls the amount of lines in a statement&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int stepH=0;        //used in for loop for vertical steps&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int stepW=0;       //used in for loop for horizontal steps&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int n=0;               //allows the value of n to be accessed from the functions&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int x=0;               //horizontal step &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int y=0;               // vertical step&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int rannum=0;   //a random number between 0 and 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int design=1;      //an integer to identify the case statement to execute&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int count=0;      //used to compare with the number of patterns per picture&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int drawCount=0; //counts how many patterns have been displayed so far&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Here is the basic structure of the application:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void setup(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  size(400, 400);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  stepH=height/numLines;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  stepW=width/numLines;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  strokeWeight(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  smooth();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  frameRate(30);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void draw(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  patsPerPic=round(random(2,7));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  background(0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  count=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  n=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  while(count&amp;amp;ltpatsperpic){&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    changeColour();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    rannum=round(random(2));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    design=round(random(2));&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for(x=0;x &amp;lt;width+1;x=x+stepw){&lt;br /&gt;for y=0;y&amp;lt;height+1;y+=stepH){"&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;    &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;switch(design){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;            case 0: function0(); break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;            case 1: function1(); break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;            case 2:function2();break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                                }                         }      }//end of fors&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;count++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                                               }//end of while&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;drawCount++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}//end of draw&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void changeColour(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  stroke(random(255),random(255),random(255),random(255));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void function0(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(whatever);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void function1(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      line(whatever);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void function2(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      line(whatever);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Lets look at one of our functions and how the value of rannum decides which patterns are drawn.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void bigArches(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  //rannum=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  if(rannum==1||rannum==0){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(x,0,width,x);//large mesh ur&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(0,y,y,width);}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  if(rannum==2||rannum==0){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(0,height-y,y,0);//large mesh u l&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    line(width,height-y,y,height);}  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The way we have designed this function, allows 3 choices. If the value of rannum is zero, it can be seen that both if statements are executed. A value of 1 or two only executes one of the if statements. If we wanted the arches to be totally symmetrical, we could set the value of rannum to zero within the function.&lt;br /&gt;If we are working on a function, then we can replace the design variable in the switch, with the number of the case statement we are working on.&lt;br /&gt;e.g. &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;switch(3){&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;To add a function to the basic structure we would add the function, give it a case statement and increase the size of the random number used to choose the design. If a pattern only uses one statement there is little benefit in moving it to a function. How we decide the options availablr for each pattern is a matter of personal taste. Most of the functions will have a structure similar to the bigArches function above but you may decide that a pattern is too trivial to be shown on its own and so give it no options e.g.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void inwards(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(0,0,height-y,y);//inwards l d&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(width,height,y,height-y);//inwards r u&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(0,height,y,y);//inwards l u&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(width,0,y,y);//inwards r d&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;This means that when this design is chosen it will always show the four statements in its pattern,&lt;br /&gt;Some statenents in a pattern could be shown on their own, in a pair or as one of four. This gives 7 choices and this is easy to implemrnt by choosing a random number in the function. e.g.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void butterfly(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       int rannum=round(random(6));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       if(rannum==1||rannum==5||rannum==0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         line(x,height-y,width-x,0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       if(rannum==2||rannum==5||rannum==0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        line(x,y,width-x,height);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       if(rannum==3||rannum==6||rannum==0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        line(width,width-y,x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      if(rannum==4||rannum==6||rannum==0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        line(0,y,x,height-y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;However, you may decide that you dont like the symmetry of the designs produced when only one statement of the four is used in a pattern and just use the rannum variable to control the oppositely located pairs of statements.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void butterfly(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       if(rannum==1||rannum==0){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         line(x,height-y,width-x,0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         line(x,y,width-x,height);}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       if(rannum==2||rannum2==0){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          line(width,width-y,x,y);//butterfly r&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          line(0,y,x,height-y);}}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;As was demonstrated in the last section the amount of choices available when there are eight possible statements in a pattern is considerable. When implementing such a design, we may decide to simplify it, if it is not bringing anything worthwhile to the program. e.g.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void triangle3(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   if(rannum==1||rannum==0){  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(0,0,y,height);//ray uld&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(0,0,width,height-y);//ray ulr    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(width-x,0,width,height);//ray  d r u &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     line(0,y,width,height);//ray d r l&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; if(rannum==2||rannum==0){   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   line(width,0,0,height-y);//ray u r l&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   line(width,0,height-y,height);//ray u r d &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   line(0,height,width-x,0);// dl u     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   line(0,height,width,height-y);//ray d l r&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; }}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;On the other hand we may decide that it is worth the added complexity if it brings some quality to our application.&lt;br /&gt;Implementing pattern 7 will warrant some careful consideration.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8078314471052817375?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8078314471052817375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk-46-structure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8078314471052817375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8078314471052817375'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk-46-structure.html' title='Chunk 46 - Structure'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdXqF0AQ9rI/AAAAAAAAAQk/0e9vW9o4HPQ/s72-c/line43.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-7589490033297942929</id><published>2009-04-01T09:10:00.026+01:00</published><updated>2009-04-03T16:46:10.577+01:00</updated><title type='text'>Chunk46 - Line Patterns</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMiDcat2yI/AAAAAAAAAKE/Gdb0MbKUTdY/s1600-h/patterns.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 263px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMiDcat2yI/AAAAAAAAAKE/Gdb0MbKUTdY/s320/patterns.jpg" alt="" id="BLOGGER_PHOTO_ID_5319633027417889570" border="0" /&gt;&lt;/a&gt;After much deliberation we come up with a motley collection of patterns which we will be re-factoring out to functions in the next section.&lt;br /&gt;Our first pattern required 4 line statements to draw it and we placed these in our for loop. Looking at our collection of patterns we realise that some need a different amount of statements in order to be drawn and their symmetrical properties vary. We intend to make a randomised pattern generator, along the lines of Chunk16 but we have some decisions to make along the way, which will affect how the finished patterns will be generated.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMnNAjao4I/AAAAAAAAAKM/aYalfjf8VjU/s1600-h/pat4.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMnNAjao4I/AAAAAAAAAKM/aYalfjf8VjU/s200/pat4.gif" alt="" id="BLOGGER_PHOTO_ID_5319638689295016834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;One of our patterns requires only one statement and is totally symmetrical. Any function this pattern is used in will be vety simple as there are no choices to make. If you havent guessed this unique pattern is number 4.&lt;br /&gt;Pattern 4 is symmetrical, horizontally, vertically and also diagonally. We have to decide, which symmetrical properties our sketch will be using. We could decide to make the symmetrical properties of our pattern vary and this would make it more complex to manage. Lets use the KISS principle to begin with...(Keep It Simple Stupid).&lt;br /&gt;Pattern 4 required only one statement and two of our patterns are only a little more complex having only 2 possible statements in their code. In our example pattern numbers 5, 6 and 11 have only 2 possible statements.&lt;br /&gt;Lets look at their symmetry:&lt;br /&gt;Pattern 5:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdMuZE_n-QI/AAAAAAAAAKc/Wq-_3E9MwDc/s1600-h/stripesA.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdMuZE_n-QI/AAAAAAAAAKc/Wq-_3E9MwDc/s200/stripesA.gif" alt="" id="BLOGGER_PHOTO_ID_5319646593226897666" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdMu6F7LhlI/AAAAAAAAAKk/3Y-dxCgY2zs/s1600-h/stripesB.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdMu6F7LhlI/AAAAAAAAAKk/3Y-dxCgY2zs/s200/stripesB.gif" alt="" id="BLOGGER_PHOTO_ID_5319647160412374610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This pattern has 3 possible display options, we can display both images together which forms a grid and is totally symmetrical or we can use one of the images alone, to produce horizontally or vertically, symmetrical stripes.&lt;br /&gt;Pattern 6:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMxW7tX_0I/AAAAAAAAAKs/fq23Z6dFqh8/s1600-h/bt1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMxW7tX_0I/AAAAAAAAAKs/fq23Z6dFqh8/s200/bt1.gif" alt="" id="BLOGGER_PHOTO_ID_5319649854909579074" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMxemhwntI/AAAAAAAAAK0/1mNufE0K0Bk/s1600-h/bt2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMxemhwntI/AAAAAAAAAK0/1mNufE0K0Bk/s200/bt2.gif" alt="" id="BLOGGER_PHOTO_ID_5319649986662670034" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Again we can choose vertical, horizontal or total symmetry.&lt;br /&gt;Pattern 11:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNWKpli7lI/AAAAAAAAAMs/6zztXuwvMis/s1600-h/tap2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNWKpli7lI/AAAAAAAAAMs/6zztXuwvMis/s200/tap2.gif" alt="" id="BLOGGER_PHOTO_ID_5319690325816700498" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNYrD4ldxI/AAAAAAAAAM8/aWX6ApYP-CI/s1600-h/tap1.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNYrD4ldxI/AAAAAAAAAM8/aWX6ApYP-CI/s200/tap1.gif" alt="" id="BLOGGER_PHOTO_ID_5319693081654949650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Pattern 11 covers the whole display area with one statement, which has diagonal and either horizonal or vertical symmetry depending on which one of the two statements in the set is used. Using both statements acheives total symmetry.&lt;br /&gt;&lt;br /&gt;Each pattern in our next group requires 4 statements to be drawn and has other display options. Lets look at them one by one:&lt;br /&gt;Pattern 2:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdM0cc-X-9I/AAAAAAAAAK8/bAxaGfQVnDw/s1600-h/honeycomb1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdM0cc-X-9I/AAAAAAAAAK8/bAxaGfQVnDw/s200/honeycomb1.gif" alt="" id="BLOGGER_PHOTO_ID_5319653248273480658" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdM0ka1wTQI/AAAAAAAAALE/G3bLewOmnKc/s1600-h/honeycomb2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdM0ka1wTQI/AAAAAAAAALE/G3bLewOmnKc/s200/honeycomb2.gif" alt="" id="BLOGGER_PHOTO_ID_5319653385139408130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Our options are beginning to get more complicated here. We can display each single pattern on its own but this would be assymetrical and would not fill the display screen. The diagonally opposite patterns would be symmetrical on the diagonal axes and would give us another two choices or we could use all the statements, to produce a totally symmetrical pattern which could cover most of all previous patterns in one "coat".&lt;br /&gt;Pattern 3:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdM36a57anI/AAAAAAAAALM/tezCUCFT1rw/s1600-h/dStripes1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdM36a57anI/AAAAAAAAALM/tezCUCFT1rw/s200/dStripes1.gif" alt="" id="BLOGGER_PHOTO_ID_5319657061648919154" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdM4B2q_UOI/AAAAAAAAALU/zPSm23Hq_Xo/s1600-h/dStripes2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdM4B2q_UOI/AAAAAAAAALU/zPSm23Hq_Xo/s200/dStripes2.gif" alt="" id="BLOGGER_PHOTO_ID_5319657189361537250" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This pattern is similar to pattern 2, in that we have 3 symmetrically possible choices but it would probably allow any underlying patterns to show through.&lt;br /&gt;Pattern 8:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdM6-ba0HCI/AAAAAAAAALc/amevqyBoQvs/s1600-h/SR1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdM6-ba0HCI/AAAAAAAAALc/amevqyBoQvs/s200/SR1.gif" alt="" id="BLOGGER_PHOTO_ID_5319660429041212450" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNMY5-rxyI/AAAAAAAAALs/BKR9oF_3mhk/s1600-h/SR2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNMY5-rxyI/AAAAAAAAALs/BKR9oF_3mhk/s200/SR2.gif" alt="" id="BLOGGER_PHOTO_ID_5319679575618996002" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Pattern 8 covers the screen in one statement but it is not very symmetrical, having a semi symmetry on one diagonal axis. Using two statements with diagonal symmetry might be a better option or using all four statements in the set gives us a totally symmetrical pattern.&lt;br /&gt;Pattern 9:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNN6hATkeI/AAAAAAAAAL0/sYcXe7eDhOM/s1600-h/butterfly1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNN6hATkeI/AAAAAAAAAL0/sYcXe7eDhOM/s200/butterfly1.gif" alt="" id="BLOGGER_PHOTO_ID_5319681252542091746" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdNODOO7q1I/AAAAAAAAAL8/qUrLG-G4O-c/s1600-h/butterfly2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdNODOO7q1I/AAAAAAAAAL8/qUrLG-G4O-c/s200/butterfly2.gif" alt="" id="BLOGGER_PHOTO_ID_5319681402121988946" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdNOMFLvkiI/AAAAAAAAAME/OUmUEvOTRpU/s1600-h/butterfly3.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdNOMFLvkiI/AAAAAAAAAME/OUmUEvOTRpU/s200/butterfly3.gif" alt="" id="BLOGGER_PHOTO_ID_5319681554311516706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I call this pattern the butterfly and although it is an attractive pattern its symmetry could be hard to explain and implement. Depending on the statements chosen  it can have total, horizontal, vertical or diagonal symmetry. As in pattern 8 it covers the screen in one statement and each statement has horizontal or vertical symmetry on its own.&lt;br /&gt;Pattern 10:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNTir62YxI/AAAAAAAAAMc/yIzp1tgRr2c/s1600-h/ray1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNTir62YxI/AAAAAAAAAMc/yIzp1tgRr2c/s200/ray1.gif" alt="" id="BLOGGER_PHOTO_ID_5319687440224903954" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdNS9a--gnI/AAAAAAAAAMU/ZRcTcT82avI/s1600-h/ray2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdNS9a--gnI/AAAAAAAAAMU/ZRcTcT82avI/s200/ray2.gif" alt="" id="BLOGGER_PHOTO_ID_5319686800023650930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is another simple pattern which presents no problems.&lt;br /&gt;&lt;br /&gt;Our final two patterns have 8 statements in each set, which further complicates things by allowing more options for symmetrical displays:&lt;br /&gt;Pattern 12:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNn-aY9TBI/AAAAAAAAAN0/-GRFeZLClhg/s1600-h/ray1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNn-aY9TBI/AAAAAAAAAN0/-GRFeZLClhg/s200/ray1.gif" alt="" id="BLOGGER_PHOTO_ID_5319709906788240402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNm8Ao9ZNI/AAAAAAAAANM/3DZPQJIgPP0/s1600-h/ray2.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNm8Ao9ZNI/AAAAAAAAANM/3DZPQJIgPP0/s200/ray2.gif" alt="" id="BLOGGER_PHOTO_ID_5319708766004667602" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNngVNwF_I/AAAAAAAAANs/cJeqx4FkfUk/s1600-h/ray6.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdNngVNwF_I/AAAAAAAAANs/cJeqx4FkfUk/s200/ray6.gif" alt="" id="BLOGGER_PHOTO_ID_5319709390002984946" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNovO5iEkI/AAAAAAAAAN8/nczsJt6vmUY/s1600-h/ray4.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNovO5iEkI/AAAAAAAAAN8/nczsJt6vmUY/s200/ray4.gif" alt="" id="BLOGGER_PHOTO_ID_5319710745517232706" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNnFHJWWUI/AAAAAAAAANU/a9NOgurj5Bc/s1600-h/ray3.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdNnFHJWWUI/AAAAAAAAANU/a9NOgurj5Bc/s200/ray3.gif" alt="" id="BLOGGER_PHOTO_ID_5319708922369956162" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNppnx--sI/AAAAAAAAAOM/H5jm9Gcyh_o/s1600-h/ray5.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNppnx--sI/AAAAAAAAAOM/H5jm9Gcyh_o/s200/ray5.gif" alt="" id="BLOGGER_PHOTO_ID_5319711748628871874" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If we pick out some combinations of statements from the set of Pattern 12, we could find the above patterns but we have probably missed some. We will not discuss the symmetry of pattern 12 here but we will have to study it again when we move it to a function.&lt;br /&gt;Pattern 7:&lt;br /&gt;Like the preceding pattern there are 8 statements in this set. Although we are not going to study Set Theory in this chapter, it may help give us some insight to help us manage the options available. A set has a number of subsets equal to 2 to the power of the number of its elements. In the case of pattern 7 this is simply 2^8. This gives us 2x2x2x2x2x2x2x2 or 256 possible combinations, including the empty set, which we don't want, as it would just result in an empty screen. We could list this set formally as:&lt;br /&gt;Pattern8={{1},{2},{3},{4},{5},{6},{7},{8},{1,2},{1,3},&lt;br /&gt;{1,4},{1.5},{1,6},{1,7},{1,8},{2,3},{2,4},{2,5},{2,6},{2,7},&lt;br /&gt;{2,8},{3,4},{3,5},{3,6},{3,7},{3,8},{4,5},{4,6},{4,7},{4,8},&lt;br /&gt;{5,6},{5,7},{5,8},{6,7},{6,8},{7,8},{1,2,3},{1,2,4},{1,2,5},{1,2,6}&lt;br /&gt;,{1,2,7},{1,2,8},{1,3,4},{1,3,5},{1,3,6},{1,3,7},{1,3,8},{1,4,5},{1,4,6},{1,4,7}&lt;br /&gt;,{1,4,8},{1,5,6},{1,5,7},{1,5,8},{1,6,7},{1,6,8},{1,7,8},{2,3,4},{2,3,5},{2,3,6},{2,3,7},{2,3,8},{2,4,5),{2,4,6},{2,4,7},{2,4,8},{2,5,6},{2,5,7},{2,5,8},{2,6,7},{2,6,8},{2,7,8}{3,4,5},{3,4,6},{3,4,7},{3,4,8},{3,5,6},{3,5,7},{3,5,8},{3,6,7},{3,6,8},{3,7,8},{4,5,6}{4,5,7},{4,5,8},{4,6,7},{4,6,8},{4,7,8}{5,6,7}{5,6,8},{5,7,8}{6,7,8},&lt;br /&gt;&lt;br /&gt;{1,2,3,4},{1,2,3,5},{1,2,3,6}&lt;br /&gt;,{1,2,3,7},{1,2,3,8}{1,2,4,5},{1,2,4,6},{1247},{1,2,4,8},{1,2,5,6},{1,2,5,7},{1,2,5,8}{1,2,6,7}&lt;br /&gt;&lt;br /&gt;,{1,2,6.8},{1,2,7,8}{1,3,4,5},{1,3,4,6},{1,3,4,7},{1,3,4,8},{1,3,5,6},{1,3,5,7},{1,3,5,8},{1,3,6,7}&lt;br /&gt;&lt;br /&gt;,{1,3,6,8},{1,3,7,8},{1,4,5,6},{1,4,5,7},{1,4,5,8},{1,5,6,7},{1,5,6,8},{1,5,7,8},{1,6,7,8},{2,3,4,5},{2,3,4,6}&lt;br /&gt;&lt;br /&gt;,{2,3,4,7},{2,3,4,8},{2,3,5,6},{2,3,5,7},{2,3,5,8},{2,3,6,7},{2,3,6,8},{2,3,7,8},{2,4,5,6},{2,4,5,7}&lt;br /&gt;&lt;br /&gt;,{2,4,5,8},{2,5,6,7},{2,5,6,8},{2,5,7,8},{2,6,7,8},{3,4,5,6},{3,4,5,7},{3,4,5,8},{3,4,6,7},{3,4,6,8},{3,5,6,7},{3,5,6,8},{3,5,7,8},{3,6,7,8},{4,5,6,7},&lt;br /&gt;&lt;br /&gt;{1,2,3,4,5},{12346}&lt;br /&gt;,{1,2,3,4,7},{1,2,3,4,8},{1,2,3,5,6},{1,2,3,5,7},{1,2,3,5,8},{1,2,3,6,7},{1,2,3,6,8},{1,2,3,7,8},{1,3,4,5,6},{1,3,4,5,7},{1,3,4,5,8},{1,3,4,6,7},{1,3,4,6,8},{1,3,4,7,8},{1,3,5,6,7},{1,3,5,6,8},{1,3,5,7,8},{1,3,6,7,8},{1,4,5,6,7},{1,4,5,6,8},{1,4,5,7,8},{1,4,6,7,8},{1,5,6,7,8}&lt;br /&gt;,{2,3,4,5,6},{2,3,4,5,7},{2,3,4,5,8},{2,3,4,6,7},{2,3,4,6,8},{2,3,4,7,8},{2,3,5,6,7},{2,3,5,6,8},{2,3,5,7,8},{2,3,6,7,8},{2,4,5,6,7},{2,4,5,6,8},{2,4,5,7,8},{2,5,6,7,8},{3,4,5,6,7},{3,4,5,6,8},{3,4,5,7,8},{4,5,6,7,8}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;,{1,2,3,4,5,6},{1,2,3,4,5,7},{1,2,3,4,5,8},{1,2,3,4,6,7},{1,2,3,4,6,8}&lt;br /&gt;,{1,2,3,4,7,8},{1,3,4,5,6,7},{1,3,4,5,6,8},{1,3,4,5,7,8},{1,3,4,6,7,8},{1,3,5,6,7,8}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;{1,2,3,4,5,6,7},{1,2,3,4,5,6,8},{1,2,3,4,5,7,8},{1,2,3,4,6,7,8},{1,2,3,5,6,7,8},{1,2,4,5,6,7,8},{1,3,4,5,6,7,8},{2,3,4,5,6,7,8},{1,2,3,4,5,6,7,8}}&lt;br /&gt;tHIS IS A WORK IN PROGRESS!&lt;br /&gt;Sometimes we end up wishing we hadnt started something and  this is one of these times! A couple of hours later and still over 50 combinations short!&lt;br /&gt;&lt;br /&gt;Anyway to continue.....&lt;br /&gt;Pattern 7:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdOsQfWXZkI/AAAAAAAAAOU/wrNcspPRtB0/s1600-h/oops1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdOsQfWXZkI/AAAAAAAAAOU/wrNcspPRtB0/s200/oops1.gif" alt="" id="BLOGGER_PHOTO_ID_5319784984147879490" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdQHYrQkcVI/AAAAAAAAAPk/tHXbqZ3s_Ws/s1600-h/oops3.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdQHYrQkcVI/AAAAAAAAAPk/tHXbqZ3s_Ws/s200/oops3.gif" alt="" id="BLOGGER_PHOTO_ID_5319885180341875026" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdQERI_S5aI/AAAAAAAAAOs/Ik4qEBeqxZc/s1600-h/oops5.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdQERI_S5aI/AAAAAAAAAOs/Ik4qEBeqxZc/s200/oops5.gif" alt="" id="BLOGGER_PHOTO_ID_5319881752348648866" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdQGZQGuNPI/AAAAAAAAAPU/SW9QUtxoED0/s1600-h/oops9.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdQGZQGuNPI/AAAAAAAAAPU/SW9QUtxoED0/s200/oops9.gif" alt="" id="BLOGGER_PHOTO_ID_5319884090721055986" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdQEd7JJbGI/AAAAAAAAAO0/Kn8uEFW_Kb8/s1600-h/oops4.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdQEd7JJbGI/AAAAAAAAAO0/Kn8uEFW_Kb8/s200/oops4.gif" alt="" id="BLOGGER_PHOTO_ID_5319881971970174050" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdQGLr4btDI/AAAAAAAAAPM/VDZ4f7psLfw/s1600-h/oops8.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdQGLr4btDI/AAAAAAAAAPM/VDZ4f7psLfw/s200/oops8.gif" alt="" id="BLOGGER_PHOTO_ID_5319883857659147314" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdQEoqqy7SI/AAAAAAAAAO8/xyNxhlfpafI/s1600-h/oops6.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdQEoqqy7SI/AAAAAAAAAO8/xyNxhlfpafI/s200/oops6.gif" alt="" id="BLOGGER_PHOTO_ID_5319882156526464290" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdQGB2VniEI/AAAAAAAAAPE/gGP_N1jJONw/s1600-h/oops7.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdQGB2VniEI/AAAAAAAAAPE/gGP_N1jJONw/s200/oops7.gif" alt="" id="BLOGGER_PHOTO_ID_5319883688667220034" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdQLYCwnW2I/AAAAAAAAAPs/lcjm2IbuS-8/s1600-h/oops2.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdQLYCwnW2I/AAAAAAAAAPs/lcjm2IbuS-8/s200/oops2.gif" alt="" id="BLOGGER_PHOTO_ID_5319889567516941154" border="0" /&gt;&lt;/a&gt;We will stop there with pattern 7 but as can be seen, there are many decisions to be made over which combination of pattern 7 statements we will allow, maybe it would be easier to choose the ones we wont allow! Our next task is to place each pattern in its own function and control its drawing from a for loop within the draw method.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SdNb3JEEoWI/AAAAAAAAANE/VMr79_UuOsY/s1600-h/ray1.gif"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-7589490033297942929?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/7589490033297942929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk46-line-patterns.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7589490033297942929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7589490033297942929'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/04/chunk46-line-patterns.html' title='Chunk46 - Line Patterns'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/SdMiDcat2yI/AAAAAAAAAKE/Gdb0MbKUTdY/s72-c/patterns.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8520157984703195468</id><published>2009-03-31T22:06:00.006+01:00</published><updated>2009-04-01T00:07:55.899+01:00</updated><title type='text'>Chunk 46 - HeadLines</title><content type='html'>I have been given the go ahead to do chunk 46, which will be along the lines of lines. There isnt much on the subject of maths that my mind retains for long but one of the very few lessons that stuck was in Geometry and the subject was lines. I suppose that everyone was taught this lesson, and how by placing lines correctly on a grid produces curves. To me it is equivalent to the chemistry lesson where mixing 2 clear liquids produced a coloured one. It was on the strength of this long remembered concept, I decided to do Chunk 46&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;To jog everyones memory we will repeat the lesson by placing lines along the x and y axes of a grid but we will be using Processing instead of squared paper and a sharp pencil.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;int n=0;&lt;br /&gt;&lt;br /&gt;void setup(){                         &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdKOA2h_lAI/AAAAAAAAAJ0/vhTSIN0EljE/s1600-h/curve.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdKOA2h_lAI/AAAAAAAAAJ0/vhTSIN0EljE/s320/curve.gif" alt="" id="BLOGGER_PHOTO_ID_5319470255167214594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;size(400,400);&lt;br /&gt;strokeWeight(1);&lt;br /&gt;background(255);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;void draw(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;line(0,n,n+10,height);&lt;br /&gt;n+=10;&lt;br /&gt;delay(200);&lt;br /&gt;if(n&gt;height){&lt;br /&gt;n=0;&lt;br /&gt;}}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;Using Processing it has not taken us long to produce this sketch and not a smudge in sight! We even slowed it down by a fifth of a second, to help demonstrate what was happening!&lt;br /&gt;Now we have produced our sketch, we  decide to repeat the exercise, in the four corners of our screen. Unfortunately we dont have a calculator to work this out for us and we have to calculate the beginning and ending of each line in the virtual graph.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;line(0,n,n+10,height);&lt;br /&gt;Fortunately we have a pattern to guide us, in the code we used to create the first sketch. We can see that the pattern starts at zero across and a variable n, which increases by ten each time the draw method is exited and reexecuted. The end coordinate is the value of n+10 and is always the height of the screen downwards. To make our next pattern at the bottom right corner we know the first coordinate should start at the width of the screen across and have n pixels down. On each iteration, the point should have a variable number across and a fixed value equal to the height of the screen. If we are careful not to hard code any of the integers used to draw our sketch, this will mean our code can run in any size of window.&lt;br /&gt;The way we coded the pattern sketch was ok to demonstrate the lines being drawn but we shall place the code in a for loop now, as we are using steps to increment the value of the gaps between the lines.&lt;br /&gt;Try to calculate the statements needed to draw the other three patterns. The mathematically minded can use their free time to come up with some other patterns to use in their program and those whose mathematics are more artistic will come up with loads of new patterns as they try to work out the numbers.&lt;br /&gt;Add a function to change the stroke colour each time the draw loop repeats. The finished sketch should look like the illustration and hopefully you will have thought up some new patterns, which we shall use in the next section.&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdKfNp1Sx2I/AAAAAAAAAJ8/jWZzuhX3840/s1600-h/pat1.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 400px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SdKfNp1Sx2I/AAAAAAAAAJ8/jWZzuhX3840/s400/pat1.gif" alt="" id="BLOGGER_PHOTO_ID_5319489166794475362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8520157984703195468?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8520157984703195468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-46-headlines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8520157984703195468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8520157984703195468'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-46-headlines.html' title='Chunk 46 - HeadLines'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/SdKOA2h_lAI/AAAAAAAAAJ0/vhTSIN0EljE/s72-c/curve.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5975959710145909784</id><published>2009-03-27T20:00:00.002Z</published><updated>2009-03-27T20:16:22.628Z</updated><title type='text'>Chunk16 Goes Mobile</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/Sc0z-2ya4EI/AAAAAAAAAJs/Uh1XBhdVlVM/s1600-h/mobiles.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/Sc0z-2ya4EI/AAAAAAAAAJs/Uh1XBhdVlVM/s400/mobiles.jpg" alt="" id="BLOGGER_PHOTO_ID_5317963889946320962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Ive been playing around with the mobile processing IDE and managed to port a maobile version of Chunk16 to a midlet. Unfortunately I dont have a java phone yet, so I cant test it properly. Mobile Processing is very easy to pick up but it does have its limits. I dont think it can scale images, which is disapointing as some of my applets need this functionality. There isnt so much documentation available, as there is for Processing and this is making it hard to use the libraries properly. In order to grab the screen into an image you have to use the Image2 library but I have got nowhere fast with this so far.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5975959710145909784?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5975959710145909784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk16-goes-mobile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5975959710145909784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5975959710145909784'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk16-goes-mobile.html' title='Chunk16 Goes Mobile'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/Sc0z-2ya4EI/AAAAAAAAAJs/Uh1XBhdVlVM/s72-c/mobiles.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3844898786780787086</id><published>2009-03-23T10:07:00.002Z</published><updated>2009-03-23T11:11:32.414Z</updated><title type='text'></title><content type='html'>The chunk 79 text and standalone program have now been submitted but the text was in odf format and I'm not sure this is acceptable. Working with Processing is a real pleasure for me and I would really like to use it more. On my wanderings around the web, I heard tell of a GUI library, that can be used with it and this is something I will definitely check out.  &lt;br /&gt;Using Processing's image capabilities will be a bonus when I'm designing java games but I would have liked to find a way to slot in some Processing code to a Java program when needed. Processing might be a viable option when it comes to online games but I would need to spend some time researching the best way to implement a user interface. Sound is quite an important quality in games, but I havent looked into this yet, although I know Processing can use the minim sound library.&lt;br /&gt;On Mondays I have decided I will work on my web site. There are a few outstanding tasks that I have been putting off. A few months ago I updated the site to using PHP 5. It has a basic content management system, where you can add news items and images to the database. I did an OU course on Open Source using PHP a few years ago and at the time I had a good understanding of it. Now, however, my selective memory has decided to scrap most of the information. &lt;br /&gt;I coded the CMS by following a book and it included a password protected administration page for managing the news content. When I implemented this I somehow enabled an option to wipe out any news that is over a week old.... This is now extremely annoying as when I am busy the news page becomes completely empty. I will have to find that book and the relevant piece of code to disable this unwanted behaviour.&lt;br /&gt;The only commercial content on my site is the 'Snappy Birthday Game'. This is a very half hearted attempt to make some money from my programming work. There are totally free versions of the game available but you can send a personalised Smappy game to someone with a message for a small fee. The images for the cards in the game are pretty awful and I really need to give them an overhaul, but I never seem to get a round tuit. This might explain why so far I have sold zero copies lol.&lt;br /&gt;The organisation of the site is not great and I should make a launch page for all the free processing applets I have hosted there.  &lt;br /&gt;These are just some of the tasks I need to tackle on Mondays.....so I'm busy today.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3844898786780787086?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3844898786780787086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-text-and-standalone-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3844898786780787086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3844898786780787086'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-text-and-standalone-program.html' title=''/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-7264629279416481973</id><published>2009-03-22T16:15:00.015Z</published><updated>2009-03-22T18:18:44.794Z</updated><title type='text'>Chunk 79 - Introduction</title><content type='html'>&lt;style type="text/css"&gt; 	&lt;!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.&lt;/style&gt;In the preceding chapters, we have seen how the pixels array can be used to apply different effects, to the screen display. In order to perform these pixel operations, it is usually necessary to set up some kind of loop to work on each separate pixel. In this chapter we look at the filter method, which allows us to carry out various effects, on the contents of the display screen. The effects affect every pixel and cannot be applied to specific areas of the screen, although theoretically, you could achieve this using the translate function. &lt;p style="margin-bottom: 0cm;"&gt;	The filter method is very simple to use and accepts eight different constant parameters, which  apply different filters to the screen content. The parameters accepted by the filter method are: INVERT, GRAY, THRESHOLD, ERODE, DILATE, OPAQUE, BLUR and POSTERIZE.   The signature of the filter method is filter(MODE), where MODE is one of the parameters listed above. Some modes can also accept an integer or float, that specifies the intensity required, if no second parameter is provided, a default value is used, which is usually mid range.&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;Before discussing each filter in depth we will look at an image transformed by each filter mode, so we can compare the different effects.&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZl-hBzfzI/AAAAAAAAAIM/PB0ftwfKP1Q/s1600-h/image.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZl-hBzfzI/AAAAAAAAAIM/PB0ftwfKP1Q/s200/image.gif" alt="" id="BLOGGER_PHOTO_ID_5316048534849683250" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZnDn2DS-I/AAAAAAAAAIc/9vl1NySpoA0/s1600-h/gray.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: left; cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZnDn2DS-I/AAAAAAAAAIc/9vl1NySpoA0/s200/gray.gif" alt="" id="BLOGGER_PHOTO_ID_5316049722090408930" border="0" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/ScZohW9HrtI/AAAAAAAAAIk/ASrjxfvw6dU/s1600-h/invert.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/ScZohW9HrtI/AAAAAAAAAIk/ASrjxfvw6dU/s200/invert.gif" alt="" id="BLOGGER_PHOTO_ID_5316051332464357074" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;      &lt;p style="margin-bottom: 0cm;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZqyFGRBzI/AAAAAAAAAI0/wxklfwKR4LM/s1600-h/dilate.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZqyFGRBzI/AAAAAAAAAI0/wxklfwKR4LM/s200/dilate.gif" alt="" id="BLOGGER_PHOTO_ID_5316053818751911730" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZweK0RtbI/AAAAAAAAAJE/xvY6QfM6s4s/s1600-h/posterize.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZweK0RtbI/AAAAAAAAAJE/xvY6QfM6s4s/s200/posterize.gif" alt="" id="BLOGGER_PHOTO_ID_5316060073759454642" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZqJuLT6RI/AAAAAAAAAIs/zkbgKPYmHYM/s1600-h/erode.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZqJuLT6RI/AAAAAAAAAIs/zkbgKPYmHYM/s200/erode.gif" alt="" id="BLOGGER_PHOTO_ID_5316053125404289298" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/ScZxH6d0rOI/AAAAAAAAAJM/YJSfNVsCfQA/s1600-h/threshold.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/ScZxH6d0rOI/AAAAAAAAAJM/YJSfNVsCfQA/s200/threshold.gif" alt="" id="BLOGGER_PHOTO_ID_5316060790924815586" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScZxuZWRnCI/AAAAAAAAAJU/RLYAnaCcw7A/s1600-h/blur.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScZxuZWRnCI/AAAAAAAAAJU/RLYAnaCcw7A/s200/blur.gif" alt="" id="BLOGGER_PHOTO_ID_5316061452049685538" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZyaNXVKzI/AAAAAAAAAJc/6zvTSZrgjlQ/s1600-h/opaque.gif"&gt;&lt;img style="cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZyaNXVKzI/AAAAAAAAAJc/6zvTSZrgjlQ/s200/opaque.gif" alt="" id="BLOGGER_PHOTO_ID_5316062204747131698" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;       &lt;p style="margin-bottom: 0cm;"&gt;&lt;img src="file:///C:/Users/Rosie/AppData/Local/Temp/moz-screenshot.jpg" alt="" /&gt;&lt;/p&gt;&lt;p&gt;As can be seen from the images, using the filter method and its modes, can spectacularly transform an image. Some of these effects had the filter applied several times, to emphasize the effects produced. The astute observer may have noticed, that the opaque image is no different from the original image. This is because our example image has no transparent areas. Some very dramatic animations can be created, by varying the intensity parameter of a filter and displaying each effect in a loop. We will now discuss the modes in depth. Most modes will have a small animation to illustrate their functionality.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-7264629279416481973?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/7264629279416481973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7264629279416481973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7264629279416481973'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-introduction.html' title='Chunk 79 - Introduction'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Xfr7yTwHuG4/ScZl-hBzfzI/AAAAAAAAAIM/PB0ftwfKP1Q/s72-c/image.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3992826412957688425</id><published>2009-03-21T09:35:00.003Z</published><updated>2009-03-22T16:14:54.404Z</updated><title type='text'>CH79 - Filter Utility - Standalone</title><content type='html'>The difference between using the Java.io package and Processing's own file methods, was nothing short of amazing!&lt;br /&gt;The code needed to implement opening and saving files has been greatly simplified and the utility was deployed as a normal processing application. The file choosers used to open and save files, are native to the user's installation and this gives a much better impression. The user can now choose any graphic file type including TIFF from anywhere on their system. The functionality of the utility is exactly the same as in Mark 1, but far more streamlined.&lt;br /&gt;There are some methods that could use a little tweaking but all filters work at least once. I'm not sure if a file can be saved with alpha values intact, but I have left in the Opaque filter for completeness, it is possible that transparent gifs etc could be affected but I havent tested this.&lt;br /&gt;&lt;a href="http://www.solundrian.com/procs/ch79_2/ch79_2.pde"&gt;Source Code&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.solundrian.com/procs/ch79_2/applet/ch79_2.jar"&gt;Save or Run the application&lt;/a&gt;&lt;br /&gt;In order to run as an applet, the applet would need to be signed as it loads and saves files, on the user's machine.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3992826412957688425?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3992826412957688425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/ch79-filter-utility-mark2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3992826412957688425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3992826412957688425'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/ch79-filter-utility-mark2.html' title='CH79 - Filter Utility - Standalone'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5393830528319959007</id><published>2009-03-21T01:11:00.004Z</published><updated>2009-03-21T01:27:10.456Z</updated><title type='text'>Chunk 79 - Filter Utility Mark One</title><content type='html'>After writing the utility I found it was impossible to deploy it as a standalone application, as it uses the java io package, which complicates matters.&lt;br /&gt;The utility can be built by cutting and pasting the &lt;a href="http://www.solundrian.com/procs/ch79/ch79.pde"&gt;source code&lt;/a&gt; into the IDE and saving it. Then either add the font and directories manually and add some images to each folder, or download and extract, a &lt;a href="http://www.solundrian.com/procs/ch79/ch79.jar"&gt;prebuilt data folder&lt;/a&gt; and copy it into the application directory.&lt;br /&gt;The utility works well but it is a pain that the reader has to build it themselves. After using the java io to open files I discovered that processing has its own way of loading and saving files complete with a file chooser. Hopefully, our next version will be easier to code and deploy.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5393830528319959007?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5393830528319959007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-filter-utility-mark-one.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5393830528319959007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5393830528319959007'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-filter-utility-mark-one.html' title='Chunk 79 - Filter Utility Mark One'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-1297054034678025928</id><published>2009-03-20T15:11:00.007Z</published><updated>2009-03-22T22:52:26.728Z</updated><title type='text'>Chunk 79 - Filter Utility</title><content type='html'>Well, apart from the odd bug, the coding of the filter utility is complete. The hardest part was getting the help panel to disappear, when applying a filter. This was achieved, by using the get() method to take a snapshot of the display screen, before showing the panel and then displaying this image, before applying a filter.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Instructions&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScO2lGuJ2GI/AAAAAAAAAH0/9MDDD4dmMiI/s1600-h/filechoice.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 278px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScO2lGuJ2GI/AAAAAAAAAH0/9MDDD4dmMiI/s320/filechoice.gif" alt="" id="BLOGGER_PHOTO_ID_5315292733802928226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The images to be worked on should be copied to the relevant folder in the data directory. There are three directories:&lt;br /&gt;GIF - JPG - PNG&lt;br /&gt;The utility can deal with up to 10 files in any directory. If the reader chooses an empty directory, the program will crash, if there is time I might fix this later...&lt;br /&gt;When the utility is started the reader is given a choice of which type of file to use. The uppercase or lower case 'G', 'J' or 'P' are acceptable inputs. On entering an acceptable inp&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/ScO7vU6pQ-I/AAAAAAAAAH8/kHd5Lnoj1TE/s1600-h/chooseFile.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 283px; height: 320px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/ScO7vU6pQ-I/AAAAAAAAAH8/kHd5Lnoj1TE/s320/chooseFile.gif" alt="" id="BLOGGER_PHOTO_ID_5315298406970246114" border="0" /&gt;&lt;/a&gt;ut the reader is shown a list of files in the appropriate directory&lt;br /&gt;The reader chooses the required file by entering its number.  The chosen file is displayed on the screen so that it can be worked on. Pressing the 'H' or 'h' key opens a help panel, which displays the options for the program.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScPDKwI28kI/AAAAAAAAAIE/jUNFWNK902Q/s1600-h/filterChoice.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 186px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScPDKwI28kI/AAAAAAAAAIE/jUNFWNK902Q/s320/filterChoice.jpg" alt="" id="BLOGGER_PHOTO_ID_5315306574715482690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The choices available are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;I - INVERT&lt;/li&gt;&lt;li&gt;G - GRAY&lt;/li&gt;&lt;li&gt;E - ERODE&lt;/li&gt;&lt;li&gt;D - DILATE&lt;/li&gt;&lt;li&gt;P - POSTERIZE&lt;/li&gt;&lt;li&gt;B - BLUR&lt;/li&gt;&lt;li&gt;T - THRESHOLD&lt;/li&gt;&lt;li&gt;O - OPAQUE&lt;/li&gt;&lt;li&gt;R - RESTART&lt;/li&gt;&lt;li&gt;S - SAVE&lt;/li&gt;&lt;li&gt;X - EXIT&lt;br /&gt;The filters are applied to the image but some e.g. posterize only work once.&lt;br /&gt;R allows the reader to choose a different file type and file.&lt;br /&gt;S saves the file and allows the user to continue working on the image.&lt;br /&gt;X exits the application.&lt;br /&gt;When a file is saved it will have "filtern" (where n is the number of the image saved this session)appended to its name. The extension of the file, will be the same as the image being worked on. All files will be saved in the ch79 directory. The files should be renamed and moved to another directory if they are needed as they might be overwritten the next time the program is run.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.solundrian.com/procs/ch79/ch79.pde"&gt;&lt;span style="font-weight: bold;"&gt;Source Code&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-1297054034678025928?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/1297054034678025928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-filter-utility.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1297054034678025928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1297054034678025928'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79-filter-utility.html' title='Chunk 79 - Filter Utility'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/ScO2lGuJ2GI/AAAAAAAAAH0/9MDDD4dmMiI/s72-c/filechoice.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-6661360971741327657</id><published>2009-03-19T14:50:00.002Z</published><updated>2009-03-19T15:24:18.695Z</updated><title type='text'>Load Chosen File</title><content type='html'>In order to load files from the data directories, make sure the permissions for ch79 are not set to read only. Navigate to the ch79 folder in myWork, right click,Properties and unclick the read only check box.&lt;br /&gt;The application now loads the user's choice of file and displays it.&lt;br /&gt;To set up the application, use the Tools/Create font utility to add the AngannaNew font with a size of 24. Change file name to Ang24. Make 3 new folders in the data folder for ch79. Name them,GIF, JPG and PNG.&lt;br /&gt;The finished utility will not run as an applet as it loads and saves files on the client's PC. When the program is complete I will make it available for download. It gets the working directory from a system property. This, should work, but I have only tried it on my own pc.&lt;br /&gt;Here is the code so far:&lt;br /&gt;import java.io.File;&lt;br /&gt;String mode="none";&lt;br /&gt;String dir="none";&lt;br /&gt;boolean fileChosen=false;&lt;br /&gt;int size=600;&lt;br /&gt;File f;&lt;br /&gt;String sep=File.separator;&lt;br /&gt;String curDir = System.getProperty("user.dir");&lt;br /&gt;PFont font;&lt;br /&gt;PImage i;&lt;br /&gt;String[]files;&lt;br /&gt;void setup(){&lt;br /&gt;  size(size+size/3,size);&lt;br /&gt;  font=loadFont("Ang24.vlw");&lt;br /&gt;  textFont(font,24);&lt;br /&gt;  frameRate(20);}&lt;br /&gt;&lt;br /&gt;void draw(){&lt;br /&gt;if(!fileChosen){&lt;br /&gt;  if(mode=="none"){&lt;br /&gt;    chooseMode();}&lt;br /&gt;  else{&lt;br /&gt;    chooseFile();}}&lt;br /&gt; else{  &lt;br /&gt;  image(i,0,0,width,height);}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void clearDisplay(){&lt;br /&gt;  fill(255);&lt;br /&gt;  rect(0,0,width/2,height/2);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void chooseMode(){&lt;br /&gt;  display("Type of File\n G - GIF\n J - JPG\n P - PNG");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void chooseFile(){&lt;br /&gt;  String s=dir+" Files:\n";&lt;br /&gt;  String path=getPath(); &lt;br /&gt;  File gDir=new File(path); &lt;br /&gt;  files=gDir.list();&lt;br /&gt;  int i=files.length;&lt;br /&gt;  if(i&gt;9)i=9;&lt;br /&gt;  for(int n=0;n&lt;i;n++){&lt;br /&gt;    String fName=files[n];&lt;br /&gt;    s+=n+": "+fName+"\n";}&lt;br /&gt;    s+="Enter File Number";&lt;br /&gt;  display(s);}&lt;br /&gt;&lt;br /&gt;void getFile(char key){&lt;br /&gt;&lt;br /&gt;  int num = Character.getNumericValue(key);&lt;br /&gt;  String f=files[num];&lt;br /&gt;  String path=getPath();&lt;br /&gt;  if(files.length&gt;num+1){&lt;br /&gt;  i=loadImage(path+f);&lt;br /&gt;  fileChosen=true;&lt;br /&gt;}}&lt;br /&gt;&lt;br /&gt;String getPath(){&lt;br /&gt;return curDir+sep+"myWork"+sep+"ch79"+sep+"data"+sep+dir+sep;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void display(String s){&lt;br /&gt;  clearDisplay();&lt;br /&gt;  fill(0);&lt;br /&gt; text(s,2,20);}&lt;br /&gt;&lt;br /&gt;void keyPressed(){&lt;br /&gt;if(mode=="none"){&lt;br /&gt;  if(key=='g'||key=='G'){&lt;br /&gt;    mode="gif";&lt;br /&gt;    dir="GIF";&lt;br /&gt;  }&lt;br /&gt;  if(key=='j'||key=='J'){&lt;br /&gt;    mode="jpg";&lt;br /&gt;    dir="JPG";&lt;br /&gt;  }&lt;br /&gt;  if(key=='p'||key=='P'){&lt;br /&gt;    mode="png";&lt;br /&gt;    dir="PNG";&lt;br /&gt;  }}&lt;br /&gt;else{&lt;br /&gt;  if(key&gt;='0'&amp;amp;&amp;amp;key&lt;='9'){&lt;br /&gt;    print("choosing file");&lt;br /&gt;getFile(key);}}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-6661360971741327657?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/6661360971741327657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/load-chosen-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6661360971741327657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6661360971741327657'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/load-chosen-file.html' title='Load Chosen File'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3058267000593288959</id><published>2009-03-17T18:25:00.003Z</published><updated>2009-03-17T19:09:15.564Z</updated><title type='text'>Listing Files in the data Directories</title><content type='html'>The first task was to think about how the reader would load graphic files into the application. I could have had all files in the data directory but I decided it would be better to have a file for each data type. I never use tiff files so I decided to make directories called: GIF/JPG and PNG. I copied some images of the various types into their appropriate folder.&lt;br /&gt;When the application starts the user is given the choice of which type of file they are going to work with. An input of 'G', 'J' or P is accepted. This display only shows if the mode has not been set. When a file type has been chosen, a list of the files in that directory is displayed allowing the reader to choose the working file.&lt;br /&gt;In order to work with files we have to import the java.io package. As the program can only listen for one key press, I had to limit the amount of files to 10. There is probably a way of accepting double figure inputs, but this chapter is on filters and the input code is off track, as it is.&lt;br /&gt;In order for the pathnames to work on other operating systems I used the path separator attribute of the File class. Next I will have to allow a file to be chosen and opened in the system.&lt;br /&gt;&lt;br /&gt;Code for Standalone File Choice:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;import java.io.File;&lt;br /&gt;String mode="none";&lt;br /&gt;String dir="none";&lt;br /&gt;boolean fileChosen=false;&lt;br /&gt;int size=600;&lt;br /&gt;File f;&lt;br /&gt;PFont font;&lt;br /&gt;&lt;br /&gt;void setup(){&lt;br /&gt;size(size+size/3,size);&lt;br /&gt;font=loadFont("Ang24.vlw");&lt;br /&gt;textFont(font,24);&lt;br /&gt;frameRate(20);}&lt;br /&gt;&lt;br /&gt;void draw(){&lt;br /&gt;if(!fileChosen){&lt;br /&gt;if(mode=="none"){&lt;br /&gt;  chooseMode();}&lt;br /&gt;else{&lt;br /&gt;  chooseFile();}}}&lt;br /&gt;&lt;br /&gt;void clearDisplay(){&lt;br /&gt;fill(255);&lt;br /&gt;rect(0,0,width/2,height/2);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void chooseMode(){&lt;br /&gt;display("Type of File\n G - GIF\n J - JPG\n P - PNG");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void chooseFile(){&lt;br /&gt;String s=dir+" Files:\n";&lt;br /&gt;String sep=File.separator;&lt;br /&gt;String curDir = System.getProperty("user.dir");&lt;br /&gt;String path=curDir+sep+"myWork"+sep+"ch79"+sep+"data"+sep+dir+sep;&lt;br /&gt;File gDir=new File(path);&lt;br /&gt;String[]files=gDir.list();&lt;br /&gt;int i=files.length;&lt;br /&gt;if(i&gt;9)i=9;&lt;br /&gt;for(int n=0;n&amp;lt;i;n++){ &lt;br /&gt;  fname="files[n];&lt;br /&gt;  s+=n+": "+fName+"\n";}&lt;br /&gt;s+="Enter File Number";&lt;br /&gt;display(s);}&lt;br /&gt;&lt;br /&gt;void display(String s){&lt;br /&gt;  clearDisplay();&lt;br /&gt;  fill(0);&lt;br /&gt; text(s,2,20);}&lt;br /&gt;&lt;br /&gt;void keyPressed(){&lt;br /&gt;if(mode=="none"){&lt;br /&gt;  if(key='g'||key=='G'){mode=&amp;quot;gif&amp;quot;){&lt;br /&gt;    dir="GIF";}&lt;br /&gt;  if(key=='j'||key=='J'){&lt;br /&gt;    mode="jpg";&lt;br /&gt;    dir="JPG";&lt;br /&gt;  }&lt;br /&gt;  if(key=='p'||key=='P'){&lt;br /&gt;    mode="png";&lt;br /&gt;    dir="PNG";&lt;br /&gt;  }}}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3058267000593288959?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3058267000593288959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/listing-files-in-data-directories.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3058267000593288959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3058267000593288959'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/listing-files-in-data-directories.html' title='Listing Files in the data Directories'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-97023376633429609</id><published>2009-03-17T10:47:00.003Z</published><updated>2009-03-17T11:17:34.022Z</updated><title type='text'>Standalone Program-Intentions</title><content type='html'>When I started thinking about Chunk 79, I was intending to write some sort of applet for medical scanning. When I was researching the subject, I discovered an &lt;a href="http://www.bioimagesuite.org/"&gt;open source application&lt;/a&gt;, that provides all the functionality needed to perform medical imaging.  &lt;br /&gt;When I am programming, I use any available image to enable me to concentrate on the code. Sometimes the image is blurry or has some other defect, this book will be used by artists and programmers, so I think that if the standalone program was a filtering utility, the reader would gain a useful application while learning about the various filter modes.&lt;br /&gt;The application will display a help panel with the key - filter pairs listed. They will be able to load in an image and apply various filters to it. A real world application would probacly have an undo function. I will try to provide one undo using push/popMatrix. After the reader has finished filtering their image they will be able to save it and the program will exit.&lt;br /&gt;That is my intention but specifications have a habit of changing, when an application is being coded. I therefore have no idea if the finished program will be anything like this initial specification.   &lt;br /&gt;Most of the groundwork for the text of chunk 79 has been completed and the text will just need an intro, some editing of the filter modes, already covered in the blog and a summary.  The standalone program is a large portion of the requirements for Chunk 79, so I think I'd better get that completed before writing up the text...&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-97023376633429609?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/97023376633429609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/standalone-program-intentions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/97023376633429609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/97023376633429609'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/standalone-program-intentions.html' title='Standalone Program-Intentions'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3300085759783121137</id><published>2009-03-16T13:03:00.009Z</published><updated>2009-03-17T10:25:55.718Z</updated><title type='text'>The OPAQUE Filter</title><content type='html'>I haven't done anything on my website for a couple of months now, so with easter coming up I decided to make an easter edition of my Snappy card game. I did one for Christmas, so an easter one would be exactly the same only with different images. I needed some images of easter eggs and so Processing seemed like an ideal solution. It took me some hours to find a simple example I could work with but I finally tracked down a rotating textured globe in the processing forum.  Many thanks to the author (doozer) for making the source code available!&lt;br /&gt;&lt;a href="http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1228081049"&gt;3d Textured Globe&lt;/a&gt;&lt;br /&gt;After some minor edits I changed the globe to a sphere and added in some chunk 16 images. I kachunked some files to make 4 backgrounds. The globe applet rotates on both axes so I disabled one. I am intending using the code to generate easter egg images so I didnt need the egg rotating vertically. The result looked really good, but the image was a bit transparent and the background was showing through and this was not what I needed for an easter egg image. Aha, I thought the OPAQUE filter would come in useful here. This was a real coincidence, as this is the final filter I need to describe here on the blog. I applied the opaque filter and it worked perfectly. A side effect was the sphere stopped rotating altogether but as I'm generating static images this proved to be no hardship. Now I have my images, I can place them in the Java snap game as card images.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/Sb5VrhWhE7I/AAAAAAAAAHc/vTQLIq1KLbI/s1600-h/i0alpha.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 250px; height: 300px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/Sb5VrhWhE7I/AAAAAAAAAHc/vTQLIq1KLbI/s320/i0alpha.jpg" alt="" id="BLOGGER_PHOTO_ID_5313778816519312306" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/Sb5WbuBixNI/AAAAAAAAAHs/ItPcf7HAa8A/s1600-h/i0.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 250px; height: 300px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/Sb5WbuBixNI/AAAAAAAAAHs/ItPcf7HAa8A/s320/i0.jpg" alt="" id="BLOGGER_PHOTO_ID_5313779644554724562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Translucent Image&lt;/span&gt;&lt;span style="font-style: italic;"&gt;                                                                                           Same image with OPAQUE filter applied&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;                                                                                                  &lt;br /&gt;&lt;span&gt;To see the spinning egg, before the opaque filter was applied and to play the finished snap game visit &lt;a href="http://www.solundrian.com/snappyE/dist/launch.html"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3300085759783121137?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3300085759783121137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/opaque-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3300085759783121137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3300085759783121137'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/opaque-filter.html' title='The OPAQUE Filter'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/Sb5VrhWhE7I/AAAAAAAAAHc/vTQLIq1KLbI/s72-c/i0alpha.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5695718145269663329</id><published>2009-03-13T16:36:00.002Z</published><updated>2009-03-13T16:39:52.923Z</updated><title type='text'>The GRAY Filter</title><content type='html'>&lt;p align="center"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/Gray/applet/index.html" scrolling="no" width="520" align="center" height="320"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;Turns the contents of the display screen to grayscale.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5695718145269663329?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5695718145269663329/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/gray-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5695718145269663329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5695718145269663329'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/gray-filter.html' title='The GRAY Filter'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-536705973878871734</id><published>2009-03-13T15:45:00.004Z</published><updated>2009-03-13T18:40:52.424Z</updated><title type='text'>The ERODE and DILATE Filters</title><content type='html'>&lt;p align="left"&gt;&lt;br /&gt;&lt;iframe align="center" SCROLLING="auto" src="http://www.solundrian.com/procs/filtersErode/applet/index.html" width="800px" height="400px"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ERODE left - Dilate centre - Origunal right. The filter has been applied 10 times in this example.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;There is very little information on the ERODE and DILATE filters and the Processing Reference, suggests these modes are used along with parameters. The filter method however accepts no parameters with these modes.&lt;br /&gt;When one of these filters is applied to an image, there seems to be very little difference. There is a slight difference when the stroke weight is small.&lt;br /&gt;By repeatedly applying the filters to an image however, the effect becomes more noticeable.&lt;br /&gt;ERODE lessens the presence of light areas and DILATE increases them.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-536705973878871734?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/536705973878871734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/erode-and-dilate-filters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/536705973878871734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/536705973878871734'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/erode-and-dilate-filters.html' title='The ERODE and DILATE Filters'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8246431029719740279</id><published>2009-03-13T09:46:00.004Z</published><updated>2009-03-13T12:41:48.335Z</updated><title type='text'>The INVERT filter</title><content type='html'>&lt;p align="center"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/invert/applet/index.html" scrolling="no" width="700" align="center" height="400"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;&lt;span style="font-style: italic;"&gt;Inverted image on left, original on right&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;The invert filter takes an image from the display screen and inverts its colours. As can be seen from the applet, when the background of an image is black, it is changed to white. Black has colour value 0 and white has value 255. So to invert black 255 is added to the colour value of (0,0,0) to give (255,255,255). The red, green and blue colour values set at 255 (maximum value) gives the colour white.  The colour pure red has a colour value of (255,0,0), we would expect the inverse of this to be (0,255,255). We can test this theory in Processing.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:arial;"&gt;psuedo code:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;make colour &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;&lt;span style="font-style: italic;"&gt;c=(255,0,0)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;(red)&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;set background to c&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;make colour &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;&lt;span style="font-style: italic;"&gt;c=(0,255,255)(cyan)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;set fill to  newC&lt;br /&gt;draw a rectangle in centre of screen&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;apply invert filter&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:georgia;"&gt;Run the following code in processing to produce a cyan square with a red background.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;color c, newC;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void setup(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  size(200,200);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;c=color(255,0,0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;newC=color(0,255,255);}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void draw(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;background(c);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;fill(newC);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;rect(width/4,height/4,width/2,height/2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;//filter(INVERT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:georgia;"&gt;uncomment the last line and run again.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;&lt;span&gt;The colour of the rectangle is now red and the background cyan.&lt;br /&gt;If we set the colour value to (128,128,128) and then invert it we may establish how processing applies the invert filter.&lt;br /&gt;Applying different values we can establish that the invert filter subtracts the colour values from 255 to produce the new colour values.&lt;br /&gt;We can use the following code to prove this by changing the values of the colours and printing out the values after the inverse filter has been applied:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;color c, newC;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void setup(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  size(200,200);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;c=color(55,55,55);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;newC=color(0,255,255);}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;void draw(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;background(c);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;fill(newC);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;rect(width/4,height/4,width/2,height/2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;filter(INVERT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;color getC=get(10,10);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;println(red(getC));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;println(blue(getC));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;println(green(getC));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8246431029719740279?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8246431029719740279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/invert-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8246431029719740279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8246431029719740279'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/invert-filter.html' title='The INVERT filter'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-6525995587110214542</id><published>2009-03-07T06:59:00.002Z</published><updated>2009-03-07T07:17:54.519Z</updated><title type='text'>The POSTERIZE Filter</title><content type='html'>&lt;p align="center"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/filtersP/applet/index.html" scrolling="no" width="600" align="center" height="600"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;My apologies if the above applet takes longer to start. This is because it contains 50 jpgs. {I'll maybe get round to cutting it down to 10...}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt;The Posterize&lt;/span&gt;&lt;span style="font-family: arial;"&gt; filter takes as an argument an integer representing the amount of colours to use when it rerenders the display screen. I think it works best with chunky shapes and lines. The images used here, dont use very many colours, so using a value of 255 just slows down the animation with very little visible result. In the applet the blur filter has been used to make the image less detailed, then the pixels array has been used to turn black areas to a random colour. Finally the Posterize filter is applied to the image. In the applet only values of 2 - 10 are used which works well with the images used. Each time the posterize level reaches 10, a new image is loaded, a new colour is chosen and the process repeats.&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-6525995587110214542?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/6525995587110214542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/posterize-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6525995587110214542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6525995587110214542'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/posterize-filter.html' title='The POSTERIZE Filter'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-4431748965921423017</id><published>2009-03-07T01:59:00.002Z</published><updated>2009-03-07T02:08:41.169Z</updated><title type='text'>The BLUR Filter</title><content type='html'>&lt;p align="center"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/blur/applet/index.html" scrolling="no" width="600" align="center" height="600"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The blur filter performs a blur on the image loaded into the display area. It can accept an integer of 100 but I would stick to a number under 20 unless you really want a very blurred image; as the time taken seems to increase exponentially the higher the parameter. &lt;br /&gt;The applet above uses much the same code as the THRESHOLD filter but an integer parameter varying from 1 - 15 is used.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-4431748965921423017?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/4431748965921423017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/blur-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4431748965921423017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4431748965921423017'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/blur-filter.html' title='The BLUR Filter'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5957768646954675519</id><published>2009-03-05T17:27:00.001Z</published><updated>2009-03-05T18:29:01.723Z</updated><title type='text'>The THRESHOLD Filter</title><content type='html'>&lt;p align="left"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/tholds/applet/index.html" scrolling="no" width="600" align="left" height="600"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The threshold filter takes the most predominant colours in an image and turns them white. Colours that are less intense are turned black. Depending on the threshold level, the decision whether to change a pixel white or black varies.&lt;br /&gt;When no threshold level parameter is supplied, the default value (0.5) is applied to the display screen.  As you have probably learned by now, each colour has red, green and blue values, that range from 0 to 255. The threshold filter examines a pixel's red, green and blue values and (using the default 0.5) if the highest colour value is greater than half of 255, it changes the pixel to white, otherwise it is turned black.&lt;br /&gt;In the applet above we have added a method, to apply the threshold filter. This method is called, with an increased threshold level, each time the draw method is entered. The image therefore appears to get filled in with black as the threshold level is increased.&lt;br /&gt;After the filter has been applied the pixels array is used in 3 for loops to change the colour of the pixels in a different quadrant of the display screen. The first quadrant's pixels are not changed.&lt;br /&gt;If you reload this page the colours are randomly changed.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5957768646954675519?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5957768646954675519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/threshold-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5957768646954675519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5957768646954675519'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/threshold-filter.html' title='The THRESHOLD Filter'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3457954380311479701</id><published>2009-03-05T10:48:00.003Z</published><updated>2009-03-05T13:36:01.342Z</updated><title type='text'>Exploring the Filter Method</title><content type='html'>The Filter method can apply 7 different modes to an image which has been loaded into the display area.&lt;br /&gt;filter(THRESHOLD);&lt;br /&gt;filter(GRAY);&lt;br /&gt;filter(INVERT);&lt;br /&gt;filter(POSTERIZE);&lt;br /&gt;filter(BLUR);&lt;br /&gt;filter(OPAQUE);&lt;br /&gt;filter(ERODE);&lt;br /&gt;filter(DILATE);&lt;br /&gt;The method has two different forms. The first as seen above just accepts the mode constant, as a parameter. The second accepts MODE and a number as an integer or float which represents the magnitude of the filter on the image.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ThresholdMode&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/Sa_Om0cOcFI/AAAAAAAAAHU/UAGbIvCr6cY/s1600-h/thresholds.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 400px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/Sa_Om0cOcFI/AAAAAAAAAHU/UAGbIvCr6cY/s400/thresholds.jpg" alt="" id="BLOGGER_PHOTO_ID_5309689652000485458" border="0" /&gt;&lt;/a&gt;Top-Left image has had a threshold filter of 0.1 applied.&lt;br /&gt;&lt;br /&gt;Top-Right image has had a threshold filter of 0.5 applied.&lt;br /&gt;&lt;br /&gt;Bottom-Left image has had a threshold filter of 0.9 applied.&lt;br /&gt;&lt;br /&gt;Bottom-Right image has been added to the sketch folder and displayed on the screen.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;Code to produce above image in Processing&lt;/span&gt;&lt;br /&gt;int sizeWindow=700;&lt;br /&gt;int fCount=0;&lt;br /&gt;PImage a,b,c,d;&lt;br /&gt;String fName="c28.jpg";&lt;br /&gt;void setup(){&lt;br /&gt; size(sizeWindow, sizeWindow);&lt;br /&gt; a=loadImage(fName);&lt;br /&gt; b=loadImage(fName);&lt;br /&gt; c=loadImage(fName);&lt;br /&gt; d=loadImage(fName);&lt;br /&gt; //smooth();&lt;br /&gt; //frameRate(.5);&lt;br /&gt; noLoop();&lt;br /&gt;}&lt;br /&gt;void draw(){&lt;br /&gt;image(a,0,0,width/2,height/2);&lt;br /&gt;&lt;br /&gt;//b=get(0,0,width/2,height/2);&lt;br /&gt;filter(THRESHOLD,.1);&lt;br /&gt;image(b,width/2,0,width/2,height/2);&lt;br /&gt;&lt;br /&gt;filter(THRESHOLD,.5);&lt;br /&gt;image(c,0,height/2,width/2,height/2);&lt;br /&gt;&lt;br /&gt;filter(THRESHOLD,.9);&lt;br /&gt;image(c,width/2,height/2,width/2,height/2);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-family: arial;"&gt;An image must be added to the sketch &lt;/span&gt;and renamed 'c28.jpg' or the code can be edited with the name of another image.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3457954380311479701?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3457954380311479701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/exploring-filter-method.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3457954380311479701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3457954380311479701'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/exploring-filter-method.html' title='Exploring the Filter Method'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/Sa_Om0cOcFI/AAAAAAAAAHU/UAGbIvCr6cY/s72-c/thresholds.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5486940054516749070</id><published>2009-03-05T00:07:00.002Z</published><updated>2009-03-05T00:31:14.198Z</updated><title type='text'>Chunk 79</title><content type='html'>I have been assigned to do Chunk 79 which looks at the filter function in Processing. This should be quite a challenging assignment for me!&lt;br /&gt;I mentioned before I help out on the open source project WitchCraft. WitchCraft takes UML2 diagrams and generates a functional website, complete with content management and database. It uses many technologies including Spring and Java. The WitchCraft developers have decided to design a cutting edge medical management service called Cerebrum using WitchCraft.&lt;br /&gt;Different modules will be designed to make the application a success. There will eventually be modules for medical scanning capabilities. In the meantime, it would be neat to use processing to provide an applet that can simulate this type of  module. I did think of using black and white for xrays and red and blue for thermal imaging, but Ive no idea how bones in an Xray could be portrayed using filters,&lt;br /&gt;Anyway I will try my best to create something presentable while working on chunk 79.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CHUNK 79&lt;/span&gt;&lt;br /&gt;TITLE  Using the filter method&lt;br /&gt;DESCRIPTION This should be a gentle introduction to the filter method.&lt;br /&gt;OUTCOMES&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Be able to understand the function of the filter method&lt;/li&gt;&lt;li&gt;Be able to develop a program of no more than 120 lines using the filter method&lt;/li&gt;&lt;/ul&gt;REFERENCE Greenberg 452--459&lt;br /&gt;HINT Take this gradually and build up the described program in small chunks.&lt;br /&gt;PROGRAM Develop an interesting program similar to the one that you describe in the text.&lt;br /&gt;My first task will be to read rhe relevant pages in the Greenberg book....&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5486940054516749070?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5486940054516749070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5486940054516749070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5486940054516749070'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-79.html' title='Chunk 79'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8679843555923942177</id><published>2009-03-04T13:56:00.005Z</published><updated>2009-03-04T23:50:10.826Z</updated><title type='text'>Chunk 16 Roundup</title><content type='html'>&lt;p align="left"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/small/applet/index.html" scrolling="auto" width="300" height="300"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;chunk 16 applet with a window size of only 200x200&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Chunk 16 has been submitted and I must say that I thoroughly enjoyed writing it. I have found the finished programs to be quite useful whenever I need a jpg or a series of images to demonstrate a concept. The kachunker is useful when I need a background for a web page etc.&lt;br /&gt;The beauty of processing windows and writing code without using magic numbers is I can make a chunk 16 applet of any size and post it just about anywhere.&lt;br /&gt;With the latest update of Java.Processing when a processing applet index has comments as used for Java documentation i.e. /** the applet may display functions on the page so these will have to be removed from Chunk 16.&lt;br /&gt;&lt;br /&gt;Processing is now a new option to consider when designing web page content. I am an administrator and developer for the open source project "Witchcraft - MDA" and I used one of the examples provided in Processing to make an animated banner. The zap font was very appropriate. It seems impossible to get the applet centred and it works better with scrolling set to auto.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Chunk 16 Kachunker&lt;/span&gt;&lt;br /&gt;&lt;p align="left"&gt;&lt;iframe src="http://www.solundrian.com/procs/small/walker/applet/index.html" scrolling="no" width="300" height="300"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/p&gt;&lt;span style="font-style: italic;"&gt;The Walker applet allows a sequence of kachunked files to be traversed&lt;/span&gt;&lt;br /&gt;The kachunker application will not work as an unsigned applet as it requires saving images to the client machine. click on the applet above to give it focus and then use up and down keys to see its kachunked files.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LaChunk&lt;/span&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;iframe src="http://www.solundrian.com/procs/small/LaChunk/applet/index.html" scrolling="no" width="205" align="center" height="205"&gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;Your browser does not support iframes.&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/p&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&lt;/iframe&gt;&lt;/p&gt;&lt;p style="text-align: left;"&gt;&lt;span style="font-style: italic;"&gt;LaChunk uses Chunk16 files to produce a kaleidoscopic animation  &lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8679843555923942177?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8679843555923942177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-16-roundup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8679843555923942177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8679843555923942177'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/03/chunk-16-roundup.html' title='Chunk 16 Roundup'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-4552339153586624667</id><published>2009-01-27T11:40:00.002Z</published><updated>2009-01-27T11:42:48.415Z</updated><title type='text'>Frilly Cogs-Using kaChunked files</title><content type='html'>I think the cogs look better with kaChunked files. KaChunking 2 or 3 times make the frills look even lacier.&lt;br /&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2978746&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2978746&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2978746"&gt;Frilly Cogs - KaChunked&lt;/a&gt; from &lt;a href="http://vimeo.com/user1140029"&gt;Rosie Wood&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-4552339153586624667?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/4552339153586624667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/01/frilly-cogs-using-kachunked-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4552339153586624667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4552339153586624667'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/01/frilly-cogs-using-kachunked-files.html' title='Frilly Cogs-Using kaChunked files'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5143801454272686902</id><published>2009-01-27T11:31:00.002Z</published><updated>2009-01-27T11:38:27.626Z</updated><title type='text'>Frilly Cogs</title><content type='html'>This one uses textured polgons to display an image of the screen. The octagons rotate and one of them makes a frill of the background image.&lt;br /&gt;The effect reminds me of crocheted doileys ...&lt;br /&gt;I would really like to be able to take the frilly part of the image and save it as a transparent gif as I think that would provide some really lovely sprites but I'm not sure how that could be achieved without using classes.&lt;br /&gt;&lt;object width="400" height="302"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2899441&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2899441&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="302"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2899441"&gt;Frilly Cogs&lt;/a&gt; from &lt;a href="http://vimeo.com/user1140029"&gt;Rosie Wood&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5143801454272686902?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5143801454272686902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/01/frilly-cogs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5143801454272686902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5143801454272686902'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/01/frilly-cogs.html' title='Frilly Cogs'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5082286566839471174</id><published>2009-01-27T11:14:00.002Z</published><updated>2009-01-27T11:23:23.256Z</updated><title type='text'>PolyChunk</title><content type='html'>In an attempt to improve the LaChunk program, I made textured octagons and moved them to the four corners of the screen. Unfortunately, only the first one rotated properly and I think classes would be one way of correcting this. I experimented with the uncooperative code and added groups of polygons to produce this program. I think it looks better than the one I had intended to make.&lt;br /&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2869886&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2869886&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2869886"&gt;PolyChunk&lt;/a&gt; from &lt;a href="http://vimeo.com/user1140029"&gt;Rosie Wood&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5082286566839471174?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5082286566839471174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/01/polychunk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5082286566839471174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5082286566839471174'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/01/polychunk.html' title='PolyChunk'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-6886131177052738136</id><published>2009-01-10T21:12:00.009Z</published><updated>2009-01-12T12:42:56.478Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Processing.'/><category scheme='http://www.blogger.com/atom/ns#' term='OU Mass Writing'/><category scheme='http://www.blogger.com/atom/ns#' term='chunk 16'/><title type='text'>Another Chunk 16 Add On</title><content type='html'>&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2801633&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2801633&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=ff9933&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2801633"&gt;Faster LaChunk&lt;/a&gt; from &lt;a href="http://vimeo.com/user1140029"&gt;Rosie Wood&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;LAChunk is a kaleidoscopic type application, which uses Chunk16 images (or any other images). The application has 5 images on the screen at once. One is used as the background, while the other 4 rotate around the corners.&lt;br /&gt;LaChunk has been set up to use 50 images and it's image path points to the chunk16 folder in 'myWork'. Just add the statement&lt;br /&gt;int fCount=0;&lt;br /&gt;to the variables at the start of Chun16 and these statements at the end of the draw method, before the patternsPerPicture statement.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;save("c"+fCount+".jpg");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  fCount++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  if(fCount&gt;=50)exit();           &lt;/span&gt;&lt;br /&gt;This will quickly generate 50 random images and then the program will stop. If you dont like any image, try putting it through KaChunk once and save it over the unwanted image. This allows LaChunk's images to be changed often, so it doesnt get boring.&lt;br /&gt;Although I like the patterns produced by LaChunk I don't like the way the corners of the images overlap at the sides. There's probably an easy way, of making part of an image that overlaps another, transparent in Processing. The problem is that I like the way the corners meet up in the middle, so the transparency would have to only occur when there was an overlap. The image arrays and blend filters would seem to be the best way to acheive this, but I cant find much usable info on this. Another way might be to use the contains method of the java class Rectangle. I may come back to this problem later, but I've decided to see how it looks using polygons and textures.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-6886131177052738136?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/6886131177052738136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/01/another-chunk-16-add-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6886131177052738136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6886131177052738136'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/01/another-chunk-16-add-on.html' title='Another Chunk 16 Add On'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-4650027960266385241</id><published>2009-01-07T12:06:00.008Z</published><updated>2009-01-07T14:44:02.529Z</updated><title type='text'>Chunk16 - Add Ons</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Saving Chunk16 Images&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Chunk 16 sometimes produces images that I really want to keep, so I added this function that saves an image when any key is pressed:&lt;br /&gt;void keyPressed() {&lt;br /&gt;save("_0ch16.jpg");&lt;br /&gt;}&lt;br /&gt;This is an event driven function and responds to a key press. Unfortunately it often doesnt save the image being viewed but copies the next one. I generally open the applications folder and have it sitting alongside the running application, that way I can see the image that has been saved. If I dont like the image, I press a key to save the next image. The path can be edited to save the image to any folder and file you like. I have named the saved file '_0ch16.jpg' as I use it in another application that uses this format. This function only ever produces one image at a time, as I dont want to waste space and have to delete files I dont want. If you want to keep an image remove it from the folder or rename it, before saving any other images.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;KaChunk&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;I had intended to write a kaleidoscope type program for chunk 16 but I got sidetracked, hence the name 'KaChunk'.&lt;br /&gt;When you want to 'KaChunk' an image add it to the kachunk folder and name it _0ch16.jpg.  When you run the program it will display and save an image consisting of four smaller copies of the reuired image. pressing any key repeats the process. The following slide show demonstrates the images produced by KaChunk.&lt;br /&gt;&lt;a href="http://good-times.webshots.com/slideshow/569484792qSBRbU"&gt;SlideShow&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Walker&lt;/span&gt;&lt;br /&gt;The Walker applicaton allows the images produced by KaChunk to be 'walked' through using the up and down keys. When the program starts it loads the original '_0ch16.jpg' file. Because this is the 'closest' you can get to the image the up key wont work until you are viewing smaller images. Use the down key to move further away and the up key to zoom in.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Chunk16 Photo Frame &lt;/span&gt;&lt;br /&gt;This function just centres an image at the end of the draw method.&lt;br /&gt;                                  &lt;br /&gt;                  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWS0SBHyoII/AAAAAAAAAGo/ochK-B6a9iE/s1600-h/photo.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 187px; height: 187px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWS0SBHyoII/AAAAAAAAAGo/ochK-B6a9iE/s400/photo.gif" alt="" id="BLOGGER_PHOTO_ID_5288550084071563394" border="0" /&gt;&lt;/a&gt;                 void doImage(){&lt;br /&gt;imageMode(CENTER);&lt;br /&gt;image(b,centre,centre);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;I added a date function to the photo frame which toggles the display of month, date and time on or off, and pressing the p key toggles the photo.&lt;br /&gt;The key presses are a bit iffy and it can take up to 3 draws to toggle. The save image function still works too so photos can be saved with a Chunk16 frame. Press any key except p or d to save a copy of what is on the screen.&lt;br /&gt;The code below has to be added to Chunk16 to allow the photo frame and date functions to work. Place a photo in the path for fName and edit the fName to use your photo.&lt;br /&gt;&lt;br /&gt;Global Variables&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;boolean showDate=false;&lt;br /&gt;boolean showImage=true;&lt;br /&gt;String IMAGE_PATH = "C:/ch16/";&lt;br /&gt;String fName=IMAGE_PATH+"pic1.jpg";&lt;br /&gt;PImage b=loadImage(fName);&lt;br /&gt;PFont font;&lt;br /&gt;String [] months={"January","February","March","April","May","June","July","August","September","October","November","December"};&lt;br /&gt;int h=b.height/2;&lt;br /&gt;int w=b.width/2;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:100%;"&gt;Add these statements to the setup method:&lt;br /&gt;&lt;/span&gt; font = loadFont("AccordLightSF-30.vlw");&lt;br /&gt;textFont(font, 30);&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;Add these statements to the end of the draw method&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: courier new;"&gt;default:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;     repeatShapes(round(random(5,width/2)),'4');//draws squares             &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; if(showImage){doImage();}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; if(showDate){doCalendar();}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Add these functions:&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;void doImage(){&lt;br /&gt;imageMode(CENTER);&lt;br /&gt;image(b,centre,centre);&lt;br /&gt;}&lt;br /&gt;void doCalendar(){&lt;br /&gt;int d = day();    // Values from 1 - 31&lt;br /&gt;int m = month();  // Values from 1 - 12&lt;br /&gt;int y = year();   // 2003, 2004, 2005, etc.&lt;br /&gt;int sec = second();  // Values from 0 - 59&lt;br /&gt;int min = minute();  // Values from 0 - 59&lt;br /&gt;int h = hour();    // Values from 0 - 23&lt;br /&gt;&lt;br /&gt;String s = String.valueOf(y);&lt;br /&gt;fill(255);&lt;br /&gt;rect(centre,50,200,50);&lt;br /&gt;fill(0);&lt;br /&gt;textFont(font, 30);&lt;br /&gt;//text(s,centre-25,55);&lt;br /&gt;s=months[m-1]+" "+d;&lt;br /&gt;text(s,centre-75,55);&lt;br /&gt;fill(255);&lt;br /&gt;rect(centre,height-50,200,50);&lt;br /&gt;fill(0);&lt;br /&gt;&lt;br /&gt;s = String.valueOf(h)+":"+String.valueOf(min)+":"+String.valueOf(sec);&lt;br /&gt;text(s,centre-75,height-36);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;void keyPressed() {&lt;br /&gt;if (key == 'd' || key == 'D') {showDate=!showDate;}&lt;br /&gt;else if (key == 'p' || key == 'P') {showImage=!showImage;}&lt;br /&gt;else{&lt;br /&gt;save("_0ch16.jpg");}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-family:verdana;"&gt;Possibilities:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;Some of the KaChunk images make really good desktop backgrounds. Vista has a very neat slideshow utility, which can be used to show the images in any folder. It has various options for displaying the images including greyscale and sepia.  Sometime in the future I might make a Processing application which saves 50 images to quickly make a slideshow. There would have to be an editor which allows unwanted images to be deleted and replaced....&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;KaChunk Code:&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;/*&lt;br /&gt;title: KaChunk&lt;br /&gt;description: random pattern generator&lt;br /&gt;created: December 16, 2008&lt;br /&gt;by: Rosie Wood&lt;br /&gt;*/&lt;br /&gt;// define Global variable values&lt;br /&gt;//These are constant variables and therefore they are not changed&lt;br /&gt;//by the program. Setting their value here in one place helps with maimtenance&lt;br /&gt;int sizeWindow=600;&lt;br /&gt;int centre=sizeWindow/2;&lt;br /&gt;int xpos = centre;&lt;br /&gt;int ypos = centre;&lt;br /&gt;String IMAGE_PATH = "C:/Users/Rosie/Documents/processing-1.0/myWork/kaChunk/";&lt;br /&gt;PImage b;&lt;br /&gt;//int patternsPerPicture=round(random(2,50));&lt;br /&gt;&lt;br /&gt;boolean [] recs=new boolean[9];&lt;br /&gt;&lt;br /&gt;//this variable is changed frequently by the application&lt;br /&gt;int interval=30;&lt;br /&gt;int count;&lt;br /&gt;int images=0;&lt;br /&gt;String fName="_0ch16.jpg";&lt;br /&gt;// set the sketch window size and background&lt;br /&gt;//turn off fill so that patterns underneath can be seen&lt;br /&gt;//set the rate that the screen refreshes at (found this value was best for this application?)&lt;br /&gt;void setup(){&lt;br /&gt;size(sizeWindow, sizeWindow);&lt;br /&gt;background(0);&lt;br /&gt;stroke(204, 102, 0);//colour red&lt;br /&gt;noFill();&lt;br /&gt;int images=1;&lt;br /&gt;b=loadImage("_0ch16.jpg");&lt;br /&gt;draw();}&lt;br /&gt;&lt;br /&gt;void draw(){&lt;br /&gt;   b=loadImage(fName);       &lt;br /&gt;      //if(images==0){&lt;br /&gt;        //image(b,0,0);}&lt;br /&gt;      //else{&lt;br /&gt;        image(b,0,0,width/2,width/2);&lt;br /&gt;        image(b,width/2,0,width/2,width/2);&lt;br /&gt;        image(b,0,width/2,width/2,width/2);&lt;br /&gt;        image(b,width/2,width/2,width/2,width/2);&lt;br /&gt;    //  }&lt;br /&gt;    } &lt;br /&gt;     &lt;br /&gt;void keyPressed() {&lt;br /&gt; images++;&lt;br /&gt; fName="_"+images+"ch16.jpg";&lt;br /&gt; save(fName); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;Walker Code:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;int sizeWindow=600;&lt;br /&gt;int centre=sizeWindow/2;&lt;br /&gt;int xpos = centre;&lt;br /&gt;int ypos = centre;&lt;br /&gt;int images=256;&lt;br /&gt;int count=0;&lt;br /&gt;//Change this to your path!&lt;br /&gt;String IMAGE_PATH = "C:/Users/USERNAME/Documents/Processing/walker/data/";&lt;br /&gt;PImage b;&lt;br /&gt;String fName="_0ch16.jpg";&lt;br /&gt;//String []fNames=new String[13];&lt;br /&gt;&lt;br /&gt;void setup(){&lt;br /&gt;size(sizeWindow, sizeWindow,P3D);&lt;br /&gt;background(0);&lt;br /&gt;noFill();&lt;br /&gt;//findMaxPOW();&lt;br /&gt;//frameRate(.2);&lt;br /&gt;&lt;br /&gt;b=loadImage("_0ch16.jpg");&lt;br /&gt;draw();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;void draw(){&lt;br /&gt;&lt;br /&gt;  // b=loadImage(IMAGE_PATH+"_"+images+"ch16.jpg");&lt;br /&gt;   image(b,0,0,width,width);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void keyPressed() {&lt;br /&gt;if(keyCode==DOWN){&lt;br /&gt;  if(count&lt;12){ count="12;}}" count="0;" fname="_" b=""&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-4650027960266385241?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/4650027960266385241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2009/01/chunk16-add-ons.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4650027960266385241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4650027960266385241'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2009/01/chunk16-add-ons.html' title='Chunk16 - Add Ons'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWS0SBHyoII/AAAAAAAAAGo/ochK-B6a9iE/s72-c/photo.gif' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2586408740133665183</id><published>2008-12-21T18:49:00.010Z</published><updated>2009-01-28T14:49:38.453Z</updated><title type='text'>Chunk16 - Overview</title><content type='html'>In Processing the draw function will loop until the program is stopped. When the application reaches the end of draw, any work done in the method is copied to the screen and then the draw method is entered again. The amount of patterns to draw for each pass through of draw is controlled by a for loop. Inside this loop are 9 case statements, which are controlled by the 'design' switch. The design switch is a random number between 1 and 9 inclusive.&lt;br /&gt;Each case statement uses different functions to draw it's own pattern.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SU6QMfGS6JI/AAAAAAAAAE4/bgu9gw78PTY/s1600-h/case1.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 214px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SU6QMfGS6JI/AAAAAAAAAE4/bgu9gw78PTY/s320/case1.gif" alt="" id="BLOGGER_PHOTO_ID_5282317957132904594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Case 1 - Draws circles while the interval variable is less than the width of the screen, interval is incremented by a random number with each iteration of the while loop. Uses drawCircles(gap) method.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SU6YTkKk9VI/AAAAAAAAAFI/hfqcRn9rDYA/s1600-h/case2.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 214px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SU6YTkKk9VI/AAAAAAAAAFI/hfqcRn9rDYA/s320/case2.gif" alt="" id="BLOGGER_PHOTO_ID_5282326874845148498" border="0" /&gt;&lt;/a&gt;Case 2 - Uses the drawCircles(gap) method to draw a random amount of circles, depending on the gap.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SU6ZaLqC2NI/AAAAAAAAAFQ/HCuocEbr1Js/s1600-h/case3.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 213px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SU6ZaLqC2NI/AAAAAAAAAFQ/HCuocEbr1Js/s320/case3.gif" alt="" id="BLOGGER_PHOTO_ID_5282328088036956370" border="0" /&gt;&lt;/a&gt;Case 3 - Draws circles while the interval variable is less than the width of the screen, interval is incremented by 20 with each iteration of the while loop. Uses the drawCircle2(diameter) method.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SU6boFF4PlI/AAAAAAAAAFY/D9fHd1RrsL0/s1600-h/case4.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 215px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SU6boFF4PlI/AAAAAAAAAFY/D9fHd1RrsL0/s320/case4.gif" alt="" id="BLOGGER_PHOTO_ID_5282330525816077906" border="0" /&gt;&lt;/a&gt;Case 4 - Draws circles while the interval variable is less than the width of the screen, interval is incremented by 20 with each iteration of the while loop. Uses the drawCircle2(diameter) method.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SU6fAk5MYXI/AAAAAAAAAFg/qqQC8MvyPbU/s1600-h/cases.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 215px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SU6fAk5MYXI/AAAAAAAAAFg/qqQC8MvyPbU/s320/cases.gif" alt="" id="BLOGGER_PHOTO_ID_5282334245204550002" border="0" /&gt;&lt;/a&gt;Using only the first 5 cases produces circles that contain variable moires. This is interesting for a short while but it soon gets a bit boring. After carrying out the modifications some cases use the repeatShapes function and the patterns produced are slightly different.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWNroz9kQ6I/AAAAAAAAAFo/l3q3AAfWGds/s1600-h/case5.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 106px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWNroz9kQ6I/AAAAAAAAAFo/l3q3AAfWGds/s320/case5.gif" alt="" id="BLOGGER_PHOTO_ID_5288188736350471074" border="0" /&gt;&lt;/a&gt;case 5: The    doLines function draws lines diagonally using a for loop but sometimes it doesn't Iook very symmetrical.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SWNvhOmpmsI/AAAAAAAAAFw/roipsBnq7xk/s1600-h/case5a.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 106px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SWNvhOmpmsI/AAAAAAAAAFw/roipsBnq7xk/s320/case5a.gif" alt="" id="BLOGGER_PHOTO_ID_5288193004109667010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In the standalone program the doLines function has been improved and leaves a randomized gap, before and after each iteration of the for loop.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN2dvHA0QI/AAAAAAAAAF4/QHy5BYHOwak/s1600-h/case6.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 108px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN2dvHA0QI/AAAAAAAAAF4/QHy5BYHOwak/s320/case6.gif" alt="" id="BLOGGER_PHOTO_ID_5288200640697258242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;case6: Here the  drawCircle2 function is called while Fill is used to colour in the circles. NoFill is used to turn off fill after the function has completed. The effect can be changed by changing colours less frequently, or using the alpha parameter in color().&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN5NUIls0I/AAAAAAAAAGA/w7B9n4XMT68/s1600-h/ds.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 107px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN5NUIls0I/AAAAAAAAAGA/w7B9n4XMT68/s320/ds.gif" alt="" id="BLOGGER_PHOTO_ID_5288203657113088834" border="0" /&gt;&lt;/a&gt;The drawSectors function uses arrays to draw shapes in a 3x3 grid. The grid is divided into 3 groups - corners, sides and centre. Each iteration can draw a square or circle in none, some or all of the groups.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN8d3M_VNI/AAAAAAAAAGI/9GmjOoEErsI/s1600-h/sq.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 106px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN8d3M_VNI/AAAAAAAAAGI/9GmjOoEErsI/s320/sq.gif" alt="" id="BLOGGER_PHOTO_ID_5288207239939577042" border="0" /&gt;&lt;/a&gt;cases 8 and 9 use the drawSquares function to draw filled or unfilled squares. When used with alpha this can create a transparent, coloures filter on top of some of the patterns.&lt;br /&gt;&lt;br /&gt;Chunk 16 has 3 basic versions:&lt;br /&gt;Before modifications:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN-4Bryk2I/AAAAAAAAAGQ/g0elgUHPfDo/s1600-h/ch16_1.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 411px; height: 136px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SWN-4Bryk2I/AAAAAAAAAGQ/g0elgUHPfDo/s320/ch16_1.gif" alt="" id="BLOGGER_PHOTO_ID_5288209888452973410" border="0" /&gt;&lt;/a&gt;After Modifications:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWOArOjbzMI/AAAAAAAAAGY/y4K-msrF2OU/s1600-h/ch16_2.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 423px; height: 141px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SWOArOjbzMI/AAAAAAAAAGY/y4K-msrF2OU/s320/ch16_2.gif" alt="" id="BLOGGER_PHOTO_ID_5288211867592543426" border="0" /&gt;&lt;/a&gt;Standalone:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SWOCxVBIMBI/AAAAAAAAAGg/JzeiRKsdqgM/s1600-h/standalone.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 493px; height: 494px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SWOCxVBIMBI/AAAAAAAAAGg/JzeiRKsdqgM/s400/standalone.gif" alt="" id="BLOGGER_PHOTO_ID_5288214171430170642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The standalone version has an improved doLines function but uses the same functions as used in the text. The functions have just been tweaked a little.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2586408740133665183?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2586408740133665183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk16-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2586408740133665183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2586408740133665183'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk16-overview.html' title='Chunk16 - Overview'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/SU6QMfGS6JI/AAAAAAAAAE4/bgu9gw78PTY/s72-c/case1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2374514101299223914</id><published>2008-12-15T23:00:00.004Z</published><updated>2008-12-15T23:07:42.028Z</updated><title type='text'>Merry Xmas</title><content type='html'>Here is ny feeble attempt at a xmas tree written with Processing&lt;br /&gt;&lt;a href="http://www.solundrian.com/procs/xmasTree/applet/xmasTree.jar"&gt;Xmas Tree&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2374514101299223914?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2374514101299223914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/merry-xmas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2374514101299223914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2374514101299223914'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/merry-xmas.html' title='Merry Xmas'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-1021190245362849131</id><published>2008-12-11T20:39:00.020Z</published><updated>2008-12-15T17:28:49.779Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='OU Mass Writing'/><category scheme='http://www.blogger.com/atom/ns#' term='chunk 16'/><title type='text'>Chunk 16 - With Code</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SUaQRBEiGYI/AAAAAAAAAEg/Ux9yvOanbVQ/s1600-h/_0ch16.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SUaQRBEiGYI/AAAAAAAAAEg/Ux9yvOanbVQ/s320/_0ch16.jpg" alt="" id="BLOGGER_PHOTO_ID_5280066235158108546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The &lt;a href="http://www.solundrian.com/randomizer/applet/index.html"&gt;Chunk 16&lt;/a&gt; application draws a random picture to the screen about every second. It weighs in at a little over 100 lines and can be run as an applet or an application. by simply clicking on an appropriate link. There is no need to struggle with applet permissions, digitally signing jar files or setting up a jnlp file for Java WebStart.&lt;br /&gt;This chapter should help clarify the basics of programming, so you are ready to tackle the special features of Processing. We will go through each topic in order of difficulty, exploring each structure as we go.&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Variables&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Variables declared within a code block are only usable within that block. The local variables declared on lines 33 and 34 are usable at any point within the draw function. None of the other functions are aware of their existence.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SUaRBvrGQ6I/AAAAAAAAAEw/ghkbCWobH4s/s1600-h/ch16.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 320px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/SUaRBvrGQ6I/AAAAAAAAAEw/ghkbCWobH4s/s320/ch16.jpg" alt="" id="BLOGGER_PHOTO_ID_5280067072301613986" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Functions&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Functions are extremely useful structures that allow us to use the same code in various places by calling the function's signature. The signature of a function is its first line. If we have a function with the signature:&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;void drawCircles(int a)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;span style="font-size:100%;"&gt;then we call it like so:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;drawCircles(400);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;span style="font-size:100%;"&gt;If there is a function with the same name but a different signature it is known as an overloaded function:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;drawCircles(int a, String col)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;span style="font-size:100%;"&gt;we could call the second overloaded function like so:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;drawCircles(400, "red");&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Code that is repeated frequently is an indication that a function is required. The repetitive portion of the code should be moved into a function with any parameters required. This helps with code reuse, making the program easier to maintain and cuts down the program's length. Any errors/modifications are confined to one place and can be easily corrected.&lt;br /&gt;A simple function is usually used to change some global variable's value. It doesn't accept any parameters and returns no value. Here is an example of a simple Function . &lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-family:courier new;"&gt;//function changeColour: to change the stroke to a random colour, no parameters, no return value&lt;br /&gt;void changeColour(){&lt;br /&gt;stroke(random(255),random(255),random(255));}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;It has a void return type and empty parameter brackets.&lt;br /&gt;Some functions can be passed messages, informing them of value/s to change or use. drawCircles3(int) on line 118 accepts an integer which it uses to draw a circle using the ellipses method.&lt;br /&gt;A function can be used to perform some calculation and return a value. These type of functions must contain the return type in their signature. The getSW function on line 135 returns an int value which is used to set the stroke weight.&lt;/p&gt;&lt;pre&gt;//returns integer value for stroke weight depending on framecount&lt;br /&gt;136: int fc=round(random(frameRate*500)/5);&lt;br /&gt;137: //case statement with default value&lt;br /&gt;138: switch(fc){&lt;br /&gt;139: case 1:return 1;&lt;br /&gt;140: case 2:return 2;&lt;br /&gt;141: case 3:return 3;&lt;br /&gt;142: case 4:return 4;&lt;br /&gt;143: case 5:return 5;&lt;br /&gt;144: case 6:return 6;&lt;br /&gt;145: case 7:return 7;&lt;br /&gt;146: case 8:return 8;&lt;br /&gt;147: case 9:return 9;&lt;br /&gt;148: default :return round(random(1,4));}}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;Some functions can also accept parameters and return a value.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;As well as user defined functions there are also inbuilt functions:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The size function accepts two integers which are used to set the size of the display window.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The rect(posx, posy, width, height) function accepts four parameters, which it uses to draw a rectangle.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The random function is an overloaded function because it can accept either one or two parameters and can return a float or an integer. In chunk 16 we mostly use integers so we need to round down any floats. Examples of using round(random(int, int)) can be found in many places in Chunk 16; as it outputs randomized patterns, by varying the values of stroke width, colour, height. shapes to use, width, interval and patternsPerPicture.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;b&gt;Code &lt;/b&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUaQh61W-UI/AAAAAAAAAEo/W4EsQyoaNNE/s1600-h/c16.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 320px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUaQh61W-UI/AAAAAAAAAEo/W4EsQyoaNNE/s320/c16.jpg" alt="" id="BLOGGER_PHOTO_ID_5280066525541628226" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;b&gt;Blocks and the if statement&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;If there were no loops in our code, then our&lt;br /&gt;programs wouldn't last very long, or they would&lt;br /&gt;have to contain a huge amount of repetitive code.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Looping structures all consist of the same basic&lt;br /&gt;format. A conditional statement followed by the&lt;br /&gt;block of code to repeat.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;The if block isn't really a looping construct, but as&lt;br /&gt;it follows the same type of format we will discuss it&lt;br /&gt;here.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;The basic form of an if statement is as follows:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;int r= round(random(1,4));&lt;br /&gt;rectMode(RADIUS);&lt;br /&gt;if(r==1){&lt;br /&gt;noStroke();&lt;br /&gt;rectMode(CENTER);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:Times New Roman,serif;font-size:100%;"  &gt;The functionality of an if block can be extended&lt;br /&gt;by adding an else block:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;else{&lt;br /&gt;&lt;br /&gt;diameter=diameter/20;&lt;br /&gt;&lt;br /&gt;stroke(round(random(255)),round(random(255)),round(random(255)),round(random(255)));&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;It can be even further extended with else if blocks.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;void drawSquares(int diameter){&lt;br /&gt;98: int r= round(random(1,4));&lt;br /&gt;99: rectMode(RADIUS);&lt;br /&gt;100: //if/if else/else block&lt;br /&gt;101: if(r==1){&lt;br /&gt;102: noStroke();&lt;br /&gt;103: rectMode(CENTER);&lt;br /&gt;104: }&lt;br /&gt;105: else if(r==2){&lt;br /&gt;106: diameter=diameter/20;&lt;br /&gt;107: }&lt;br /&gt;108: else if(r==3){&lt;br /&gt;109: changeColour();&lt;br /&gt;110: }&lt;br /&gt;111: else{&lt;br /&gt;112: diameter=diameter/20;&lt;br /&gt;113: stroke(round(random(255)),round(random(255)),round(random(255)),round(random(255)));&lt;br /&gt;114: }&lt;br /&gt;116: rect(xpos,ypos,diameter,diameter);&lt;br /&gt;117:}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;The else and else if blocks cant be used on their own and must be preceeded by an if statement.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Examples of using if, else if and else consructs are on lines 36 and line 124.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;b&gt;While Loops&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;span style="font-size:100%;"&gt;while blocks allow us to repeat a section of code until a condition or conditions become true or false. The opening clause contains the condition and this is followed by a statement block. Statement blocks, in looping structures, are always enclosed by curly brackets, unless there is only one such statement. Sometimes a while statement is used to increment a simple counter.&lt;br /&gt;Here the loop is repeated 10 times and prints out the numbers 0-9.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;Int count=0;&lt;br /&gt;while(count 10){&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;This while loop calls the getInput function until the value of input is equal to the value of valid.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;while(input!=valid)input=getInput();&lt;br /&gt;Examples of while loops are on lines: 42, 51 and 57.&lt;br /&gt;39: design=round(random(1,9)); //a random number for which design to use in the switch&lt;br /&gt;40: switch(design){&lt;br /&gt;41: case 1:&lt;br /&gt;42: while(interval&lt;br /&gt;43: drawCircle2(interval-round(random(40,width/2)));//call function drawCircle2 with a random parameter&lt;br /&gt;44: interval+=round(random(3,70)); }&lt;br /&gt;45: break;&lt;br /&gt;46: case 2:&lt;br /&gt;47: drawCircles(round(random(20,round(random(1,50))))); //call the drawCircles function&lt;br /&gt;48: break;&lt;br /&gt;49: case 3:&lt;br /&gt;50: strokeWeight(getSW());//set the strokewright to the number returned by the getSW function&lt;br /&gt;51: while(interval&lt;br /&gt;52: drawCircle2(interval-round(random(1,width/2)));//use the drawCircle2 function&lt;br /&gt;53: interval+=round(random(1,width/2));}&lt;br /&gt;54: break;&lt;br /&gt;55: case 4:&lt;br /&gt;56: strokeWeight(getSW());&lt;br /&gt;57: while(interval&lt;br /&gt;58: drawCircle3(interval-round(random(2,width/4)));&lt;br /&gt;59: interval+=round(random(1,30));}&lt;br /&gt;60: break;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;The draw method has a lot of while methods that seem to be performing a similar function.&lt;br /&gt;A do while loop is very much like an upside down while loop. Do while loops are used when we need a block of code to execute at least once. This means that the statement block, is executed once, before the conditional is checked.&lt;br /&gt;The layout of a do while loop has the following structure:&lt;br /&gt;We haven't used a do while loop but it would be simple to implement if needed:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;do{&lt;br /&gt;do this statement//any amount of statements can be repeated in a statement block&lt;br /&gt;do that statement&lt;br /&gt;}&lt;br /&gt;while(condition)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;do{&lt;br /&gt;drawCircle();&lt;br /&gt;drawSquare();&lt;br /&gt;}&lt;br /&gt;while(count ,,,,&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;For Loops&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;The for loop allows us to specify the number of times a code block will repeat. We use an int to state the amount of iterations. A for loop takes a start value, an exit loop conditional clause and the amount the looping integer will be changed by. For loops can be incremented or decremented.&lt;br /&gt;It sounds a lot more complex than it is in practice!&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;for(int n=0;n==10;n++) //starts at 0 - stops at 10 - increments by 1&lt;br /&gt;{ //code block to be repeated is contained within curly brackets&lt;br /&gt;function1(n);//performs some operation&lt;br /&gt;a=+n; //performs some other operation (can contain many statements)&lt;br /&gt;} // for loop ends &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;The statement block performs some operation/s until the exit condition is met.&lt;br /&gt;In this example the integer is declared and initialised within the loop, making the integers scope local in the loop. However the integer can be declared elsewhere, thus changing its scope.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;int n;&lt;br /&gt;for (n=10;n &lt;= 100;n=n+10){ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;function1(n); } &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;println("number's final value: "+n); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;We use a for loop to control how many patterns are used to make a picture:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:100%;"&gt;for(count=0;count&lt;patternsperpicture;count++){&gt;&lt;/patternsperpicture;count++){&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;a great many statements to repeat!}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;As long as count's value, is less than patternsPerPicture the statements in the for loop will execute. Each time the loop is repeated the value of n is increased by one. If we changed the loop to start at one, then we would need to change the conditional to count&lt;=patternsPerPicture+1; When the for loop is finished the value of patternsPerPicture is changed to a random number between 2 and 50, the variables count and design are reset to zero before the for loop is entered again. Another example of the for loop can be seen in the drawCircles(int) function. Here the value of n is increased by the gap parameter. This for loop stops at a random number between the centre and edge of the display window.   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;b&gt;Switch Blocks&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Another branching structure uses a switch to determine which block of code to run. In Java the switch value must be an integer, a byte, a short, char or enumerated type.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Its basic outline follows this pattern:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New,monospace;font-size:100%;"  &gt;switch(int){&lt;br /&gt;case 1:&lt;br /&gt;statements;&lt;br /&gt;break;&lt;br /&gt;case 2:&lt;br /&gt;case 3:&lt;br /&gt;statements;&lt;br /&gt;break;&lt;br /&gt;case 4:&lt;br /&gt;statements;&lt;br /&gt;return(someValue);&lt;br /&gt;case 9:&lt;br /&gt;case 5:&lt;br /&gt;default:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;statements;&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;In this example, if the switch statement has a value of 1, 3, or 4 then the statements in the code blocks for 1, 3 or 4 will execute. To stop them continuing and executing the code in the other cases, break is used to exit the switch. In the case of the switch having a value of 4, the loop is exited by returning a value. break and return allow the switch block to be exited cleanly.&lt;br /&gt;If switch has a value of 2 it doesn't have a code block of its own, so it executes the case 3 code block before exiting with break.&lt;br /&gt;If the switch has a value of 5, 9 or some number that doesn't have a case statement then the default case will be carried out before the block is exited.&lt;br /&gt;In chunk 16 we have a large case statement (Line 40) which has cases for switch values of 1-9.&lt;br /&gt;The design variable used in the switch is a random number between 1 and 9 inclusive.&lt;br /&gt;In this section we will make chunk 16 more maintainable.&lt;br /&gt;Firstly, it would be better if the pattern always started with a plain black background! Remove the statement on line 36 and add background(0) at line 35:&lt;br /&gt;We can remove the code in case 5 to its own function(line 63). Lets try omitting the break statement so the lines function is always covered up by the pattern in case 6.&lt;br /&gt;Much better, we will leave lines in now!&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;case 5: //lovely lines!&lt;br /&gt;doLines();&lt;br /&gt;case 6:&lt;br /&gt;... &lt;/span&gt;&lt;br /&gt;Place the doLines function with the other functions&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;void doLines(){&lt;br /&gt;strokeWeight(getSW());&lt;br /&gt;for(int b=1;b&lt;br /&gt;int down=round(random(width/2));&lt;br /&gt;int across=round(random(width/2));&lt;br /&gt;line(xpos,ypos,across-b,down-b);&lt;br /&gt;line(xpos,ypos,across+b+xpos,down-b);&lt;br /&gt;line(xpos,ypos,across-b,width-down+b);&lt;br /&gt;line(xpos,ypos,across+b+xpos,width-down+b);}} &lt;/span&gt;&lt;br /&gt;Looking at our case statements we can see that cases 1,3,4,6,7 and 9 all use duplicate code. Our switch block would be much neater and easier to maintain, if we could encapsulate duplications in a function.&lt;br /&gt;We will move case 1's code to a function called repeatShapes and place it with the other functions&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;case 1:&lt;br /&gt;repeatShapes();&lt;br /&gt;break; &lt;/span&gt;&lt;br /&gt;The only difference between case 1 and case 3 is the interval variable. We can accommodate this by passing it as a parameter to the function.&lt;br /&gt;It is now possible to remove all the while loops that use the drawCircles2 function with the new function. We still have while loops, that use the drawSquares and drawCircle3 functions. Lets deal with those cases too.&lt;br /&gt;void repeatShapes(){&lt;br /&gt;while(interval&lt;br /&gt;drawCircle2(interval-round(random(40,width/2)));&lt;br /&gt;interval+=round(random(3,70)); }}&lt;br /&gt;We can place a noFill() statement to the start of the for loop and remove all noFill() statements from the switch block.&lt;br /&gt;If the case that makes filled circles didn't change colour so often, we might see some more interesting shapes created.&lt;br /&gt;By adjusting the repeatShapes function and removing some repetitive code from the case statements, our switch block now looks like this:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;switch(design){&lt;br /&gt;case 1:&lt;br /&gt;repeatShapes(round(random(3,70)),'2');&lt;br /&gt;break;&lt;br /&gt;case 2:&lt;br /&gt;drawCircles(round(random(20,round(random(1,50)))));&lt;br /&gt;break;&lt;br /&gt;case 3:&lt;br /&gt;repeatShapes(round(random(1,width/2)),'2');&lt;br /&gt;break;&lt;br /&gt;case 4:&lt;br /&gt;repeatShapes(width-round(random(2,width/4)),'3');&lt;br /&gt;&lt;br /&gt;break;&lt;br /&gt;case 5: //lovely lines!&lt;br /&gt;doLines();&lt;br /&gt;case 6:&lt;br /&gt;repeatShapes(round(random(2,200)),'5');&lt;br /&gt;break;&lt;br /&gt;case 7:&lt;br /&gt;repeatShapes(round(random(1,40)),'2');&lt;br /&gt;break;&lt;br /&gt;case 8:&lt;br /&gt;default:&lt;br /&gt;repeatShapes(width-round(random(1,width/2)),'4');&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;The one remaining change we could attempt is to do something about the cases where large filled shapes are drawn over the top of our funky patterns. Later in the book, we will learn how to use transparent colours, so for the moment lets just leave our switch statement as it is.&lt;br /&gt;Examine the switch block in the getSW function, you should notice something strange... The whole switch block can be replaced by one statement!&lt;br /&gt;The getSW function now looks like this:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;int getSW(){&lt;br /&gt;int fc=round(random(frameRate*500)/5);&lt;br /&gt;return fc%10;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;Our code is now much leaner and easier to maintain and this will help us when we start the next modification which will involve arrays.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;b&gt;Additional Function - inplementing an Array&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;An array can be thought of as a container, for a collection of objects, of the same type. This container, has an index, so that each object it holds can be fetched. An array may be declared like this:&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;int [] midxy;&lt;/span&gt;&lt;br /&gt;Arrays can be filled in a variety of ways. The capacity of the array can be set when it is declared and initialized:&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;boolean [] recs=new boolean[9];&lt;/span&gt;&lt;br /&gt;It can also be initialized by listing its members:&lt;br /&gt;&lt;span style="font-family:Courier New,monospace;"&gt;int [] midxy={100,300,500};&lt;/span&gt;&lt;br /&gt;A quick way of populating an array is to use a for loop:&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;for(int r=0;r &lt;&gt; &lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;recs[r]=false;} &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;The array recs contains 9 boolean values and we are going to use it to design&lt;/span&gt;&lt;span style="font-family:verdana;"&gt; a new function.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;So far, all our patterns are positioned around the centre point of the screen.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;We are going to use the midxy array to draw out a symetrical pattern,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;in a grid like the tic tac toe game.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Copy the following code into processing and run it.&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;int [] midxy;&lt;br /&gt;&lt;br /&gt;boolean [] recs;&lt;br /&gt;void setup(){&lt;br /&gt;size(600, 600);&lt;br /&gt;drawA();}&lt;br /&gt;&lt;br /&gt;void drawA(){&lt;br /&gt;rectMode(CENTER);&lt;br /&gt;recs=new boolean[9];&lt;br /&gt;resetRecs();&lt;br /&gt;int [] midxy={(width/3)/2, (width/3)/2+width/3, (width/3)/2+width/3*2 };&lt;br /&gt;for(int n=0;n   ,,,,,&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;As you can see this is a quick sketch of our new shape function. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Experiment by commenting and uncommenting the code between the asterisks. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;The statement after the last line of asterisks, is drawing the square at the centre of the screen. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;It is using the value in midxy[1] as its centre point. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Change one of the first 2 values in the rect function to a zero. Change both values to 2. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;See if you can place the square in each position in the grid. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:georgia;"&gt;It would get tedious typing values like (width/3)/2+width/3*2 so we will put them in an array.&lt;br /&gt;The values in midxy will find the centre of each of the 9 squares no matter what the size of the&lt;br /&gt;display window is. (But it must be a square!) Try changing the size of the display window in the&lt;br /&gt;setup method.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:georgia;"&gt;In order to keep our pattern symmetrical we are going to place the 9 squares into 3 groups.&lt;br /&gt;There will be a corner group, a side group and the central square.&lt;br /&gt;The 9 squares don't all have to be used in the pattern, so we are going to use boolean values,&lt;br /&gt;to decide whether the squares are used. A boolean value can be true or false but not null.&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUV2QrmA6DI/AAAAAAAAAEY/9pLfEszg-V8/s1600-h/grid.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5279756167113926706" style="margin: 0px 10px 10px 0px; float: left; width: 310px; height: 320px;" alt="" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUV2QrmA6DI/AAAAAAAAAEY/9pLfEszg-V8/s320/grid.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Try to make a new function that uses the recs array to help manage drawing the 9 squares in&lt;br /&gt;our grid. Call the function repeatSectors or any name you like.&lt;br /&gt;We already have a function for populating the recs array with default values at the start of the&lt;br /&gt;function.&lt;br /&gt;Use random numbers to decide whether each of the 3 groups are populated.&lt;br /&gt;Write some code that sets the value of the relevant array position to true if a shape will be&lt;br /&gt;drawn there.&lt;br /&gt;Write some code that uses the recs array to control where shapes will be drawn.&lt;br /&gt;Use the rect(int,int,int,int)function to begin with.&lt;br /&gt;Place a call to the repeatSectors function in the draw function.&lt;br /&gt;Add some randomisation to make the patterns vary as much as possible.&lt;br /&gt;If you get stuck use the reference section in Processing, Google what you are trying to do or&lt;br /&gt;check the solution provided at the end of this section.&lt;br /&gt;This is a very challenging function to write and could take a good few hours to solve but its&lt;br /&gt;early days yet and this will get you thinking like a programmer.&lt;br /&gt;When your super duper function is completed you can use your artistic flair to make it dazzling!&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;Author's Function&lt;br /&gt;173:void drawSectors(){&lt;br /&gt;174: resetRecs();&lt;br /&gt;175: int [] midxy={(width/3)/2, (width/3)/2+width/3, (width/3)/2+width/3*2 };&lt;br /&gt;177: //decide on groups to use&lt;br /&gt;178: int corners=round(random(0,1));&lt;br /&gt;179: if(corners==1){&lt;br /&gt;180: recs[0]=recs[2]=recs[6]=recs[8]=true;}&lt;br /&gt;182: int sides=round(random(0,1));&lt;br /&gt;183: if(sides==1){&lt;br /&gt;184: recs[1]=recs[3]=recs[5]=recs[7]=true;}&lt;br /&gt;186: int centre=round(random(0,1));&lt;br /&gt;187: if(centre==1){&lt;br /&gt;193: rectMode(CENTER);&lt;br /&gt;194: ellipseMode(CENTER);&lt;br /&gt;195: int f=round(random(1,5));&lt;br /&gt;196: if(f==1){&lt;br /&gt;197: fill(random(255),random(255),random(255));}&lt;br /&gt;198: else{&lt;br /&gt;199: getSW();&lt;br /&gt;200: changeColour();}&lt;br /&gt;202: int d=round(random(width/3));&lt;br /&gt;203: int sType=round(random(2));&lt;br /&gt;204: for(int n=0;n&lt;9;n++){ mod="n%3;" down="0;"&gt;5)down=2;&lt;br /&gt;209: else if (n&gt;2){down=1;}&lt;br /&gt;211: if(sType==1){&lt;br /&gt;212: rect(midxy[mod], midxy[down], d, d); }&lt;br /&gt;213: else{&lt;br /&gt;214: ellipse(midxy[mod], midxy[down], d, d);}}}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-1021190245362849131?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/1021190245362849131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk-16-with-code.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1021190245362849131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1021190245362849131'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk-16-with-code.html' title='Chunk 16 - With Code'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/SUaQRBEiGYI/AAAAAAAAAEg/Ux9yvOanbVQ/s72-c/_0ch16.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5716795657221614847</id><published>2008-12-09T16:11:00.004Z</published><updated>2008-12-09T16:22:34.528Z</updated><title type='text'>Chunk16 Code Removed - Second Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ST6bIssM3uI/AAAAAAAAADE/GVBSYbEdZA4/s1600-h/circle16.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 310px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/ST6bIssM3uI/AAAAAAAAADE/GVBSYbEdZA4/s320/circle16.gif" alt="" id="BLOGGER_PHOTO_ID_5277826387062611682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;2358 words&lt;br /&gt;&lt;br /&gt;The Chunk 16 application draws a random picture to the screen about every second. It weighs in at a little over 100 lines and can be run as an applet or an application by simply clicking on an appropriate link. There is no need to struggle with applet permissions, digitally signing jar files or setting up a jnlp file for Java WebStart. &lt;br /&gt;This chapter should help clarify the basics of programming, so you are ready to tackle the special features of Processing. We will go through each topic in order of difficulty, exploring each structure as we go.&lt;br /&gt;&lt;br /&gt;Variables declared within a code block are only usable within that block. The local variables declared on lines 33 and 34 are usable at any point within the draw function. None of the other functions are aware of their existence.&lt;br /&gt;Functions are extremely useful structures that allow us to use the same code in various places by calling the function's signature. The signature of a function is its first line. If we have a function with the signature:&lt;br /&gt;void drawCircles(int a)&lt;br /&gt;then we call it like so:&lt;br /&gt;drawCircles(400);&lt;br /&gt;If there is a function with the same name but a different signature it is known as an overloaded function:&lt;br /&gt;drawCircles(int a, String col)&lt;br /&gt;we could call the second overloaded function like so:&lt;br /&gt;drawCircles(400, "red");&lt;br /&gt;&lt;br /&gt;Code that is repeated frequently is an indication that a function is required. The repetitive portion of the code should be moved into a function with any parameters required. This helps with code reuse, making the program easier to maintain and cuts down the program's length. Any errors/modifications are confined to one place and can be easily corrected.&lt;br /&gt;A simple function is usually used to change some global variable's value. It doesn't accept any parameters and returns no value. The changeColour() function line 105 provides us with an example. It has a void return type and empty parameter brackets.&lt;br /&gt;Some functions can be passed messages, informing them of value/s to change or use. drawCircles3(int) on line 118 accepts an integer which it uses to draw a circle using the ellipses method.&lt;br /&gt;A function can be used to perform some calculation and return a value. These type of functions must contain the return type in their signature. The getSW function on line 135 returns an int value which can be used to set the stroke weight.&lt;br /&gt;A function can also both accept parameters and return a value. We havent used this type of user defined function in chunk 16.&lt;br /&gt;As well as user defined functions there are also inbuilt functions:&lt;br /&gt;The size function accepts two integers which are used to set the size of the display window.&lt;br /&gt;The rect(int, int, int, int) function accepts four parameters which it uses to draw a rectangle.&lt;br /&gt;The random function is an overloaded function because it can accept either one or two parameters and can return a float or an integer. In chunk 16 we mostly use integers so we need to round down any floats. Examples of using round(random(int, int)) can be found in many places in Chunk 16 as it outputs randomized patterns by varying the values of stroke width, colour, height. shapes to use, width, interval and patternsPerPicture.&lt;br /&gt;&lt;br /&gt;If there were no loops in our code, then our programs wouldn't last long, or they would have to contain a huge amount of repetitive code.&lt;br /&gt;Looping structures all consist of the same basic format. A conditional statement followed by the block of code to repeat.&lt;br /&gt;The if block isnt really a looping construct but as it follows the same type of format we will discuss it here.&lt;br /&gt;The basic form of an  if statement is as follows:&lt;br /&gt;&lt;br /&gt;The functionality of an if block can be extended by adding an else block:&lt;br /&gt;&lt;br /&gt;The if block can be even further extended with else if blocks.&lt;br /&gt;The else and else if blocks cant be used on their own and must be proceeded by an if statement.&lt;br /&gt;Examples of using if, else if and else consructs are on lines 36 and line 124.&lt;br /&gt;&lt;br /&gt;while blocks allow us to repeat a section of code until a condition or conditions become true or false. The opening clause contains the condition and this is followed by a statement block. Statement blocks, in looping structures, are always enclosed by curly brackets, unless there is only one such statement. Sometimes a while statement is used to increment a simple counter.&lt;br /&gt;&lt;br /&gt;Here the loop is repeated 10 times.&lt;br /&gt;&lt;br /&gt;This while loop calls the getInput function until the value of input is equal to the value of valid.&lt;br /&gt;Examples of while loops are on lines: 42, 51 and 57.&lt;br /&gt;The draw method has a lot of while methods that seem to be performing a similar function.&lt;br /&gt;&lt;br /&gt;A do while loop is very much like an upside down while loop. Do while loops are used when we need a block of code to execute at least once. This means that the statement block, is executed once, before the conditional is checked.&lt;br /&gt;The layout of a do while loop has the following structure:&lt;br /&gt;&lt;br /&gt;We haven't used a do while loop but it would be simpleto implement if needed.&lt;br /&gt;&lt;br /&gt;The for loop allows us to specify the number of times a code block will repeat. We use an int to state the amount of iterations. A for loop takes a start value, an exit loop conditional clause and the amount the looping integer will be changed by. For loops can be incremented or decremented.&lt;br /&gt;It sounds a lot more complex than it is in practice!&lt;br /&gt;&lt;br /&gt;The statement block performs some operation/s until the exit condition is met.&lt;br /&gt;In this example the integer is declared and initialised within the loop, making the integers scope local in the loop. However the integer can be declared elsewhere, thus changing its scope.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We use a for loop to control how many patterns are used to make a picture:&lt;br /&gt;&lt;br /&gt;As long as count's value, is less than the constant, patternsPerPicture the statements in the for loop will execute. Each time the loop is repeated the value of n is increased by one. If we changed the loop to start at one, then we would need to change the conditional to count&lt;=patternsPerPicture+1;&lt;br /&gt;When the for loop is finished the value of patternsPerPicture is changed to a random number between 2 and 50, the variables count and design are reset to zero before the for loop is entered again.&lt;br /&gt;&lt;br /&gt;Another example of the for loop can be seen in the drawCircles(int) function.&lt;br /&gt;Here the value of n is increased by the gap parameter. This for loop stops at a random number between the centre and edge of the display window.&lt;br /&gt;&lt;br /&gt;Another branching structure uses a switch to determine which block of code to run. In Java the switch value must be an integer, a byte, a short, char or enumerated type.&lt;br /&gt;Its basic outline follows this pattern:&lt;br /&gt;&lt;br /&gt;**************************&lt;br /&gt;In this example, if the switch statement has a value of 1, 3, or 4 then the statements in the code blocks for 1, 2 or 4 will execute. To stop them executing the code in the other cases break is used to exit the switch. In the case of the switch having a value of 4 the loop is exited by returning a value. break and return allow the switch block to be exited cleanly.&lt;br /&gt;If switch has a value of 2 it doesnt have a code block of its own and continues so it executes the case 3 code block before exiting with break.&lt;br /&gt;If the switch has a value of 5, 9 or some number that doesnt have a case statement then the default case will carried out before the block is exited.&lt;br /&gt;In chunk 16 we have a large case statement (Line 40) which has cases for switch values of 1-9.&lt;br /&gt;The design variable used in the switch is a random number between 1 and 9 inclusive.&lt;br /&gt;In this section we will make chunk 16 more maintainable.&lt;br /&gt;Firstly, it would be better if the pattern always started with a plain black background! Remove the statement on line 36 and add background(0) at line 35:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We can remove the line code in case 5 to its own function(line 63). Lets try omitting the break statement so the lines function is always covered up by the pattern in case 6.&lt;br /&gt;Much better, we will leave lines in now!&lt;br /&gt;&lt;br /&gt;Place the doLines function with the other functions&lt;br /&gt;&lt;br /&gt;Looking at our case statements we can see that cases 1,3,4,6,7 and 9 all use duplicate code. Our switch block would be much neater and easier to maintain if we could encapsulate duplications in a function.&lt;br /&gt;We will move case 1's code to a function called repeat shapes and place it with the other functions&lt;br /&gt;******&lt;br /&gt;The only difference between case 1 and case 3 is the interval variable. We can accomodate this by passing it as a parameter to the function.&lt;br /&gt;It is now possible to remove all the while loops that use the drawCircles2 function with the new function. We still have while loops, that use the drawSquares and drawCircle3 functions. Lets deal with those cases too.&lt;br /&gt;******&lt;br /&gt;We can place a noFill() statement to the start of the for loop and remove  all noFill() statements from the switch block.&lt;br /&gt;If the case that makes filled circles didnt change colour so often we might see some more interesting shapes created. I added a 50/50 chance of this happening, to the else statement in the drawShapes method. See if you can work out how this works in the repeatShapes function.&lt;br /&gt;By adjusting the repeatShapes function and removing some repetitive code from the case statements, our switch block now looks like this:&lt;br /&gt;******&lt;br /&gt;The one remaining change we could attempt is to do something about the cases where large filled shapes are drawn over the top of our funky patterns. Later in the book, we will learn how to use transparent colours, so for the moment lets leave our switch statement as it is.&lt;br /&gt;Examine the switch block in the getSW function, you should notice something strange... The whole switch block can be replaced by one statement!&lt;br /&gt;The getSW function now looks like this:&lt;br /&gt;******&lt;br /&gt;Our code is now much leaner and easier to maintain and this will help us when we start the next modification which will involve arrays.&lt;br /&gt;&lt;br /&gt;An array is a can be thought of as a container for a collection of objects of the same type. This container, has an index, so that each object it holds, can be easily fetched. To declare an array:&lt;br /&gt;int [] midxy;&lt;br /&gt;arrays can be filled in a variety of ways. The capacity of the array can be set when it is declared and initialized:&lt;br /&gt;boolean [] recs=new boolean[9];&lt;br /&gt;It can also be initialized by listing its members:&lt;br /&gt;int [] midxy={100,300,500};&lt;br /&gt;A quick way of populating an array is to use a for loop:&lt;br /&gt;The array recs contains 9 boolean values and we are going to use it to design a new function. So far all our patterns are positioned around the centre point of the screen. We are going to use the recs array to draw out a symetrical pattern, in a grid like the tic tac toe game.&lt;br /&gt;Copy the following code into processing and run it.&lt;br /&gt;*********&lt;br /&gt;As you can see this is a quick sketch of our new shape function. Experiment by commenting and uncommenting the code between the asterisks. The statement after the last line of asterisks is drawing the square at the centre of the screen. It is using the value in midxy[1] as its centre point. Change one of the first 2 values in the rect function to a zero. Change both values to 2. See if you can place the square in each position in the grid. It would get tedious typing values like (width/3)/2+width/3*2 so we'll put them in an array.&lt;br /&gt;The values in midxy will find the centre of each of the 9 squares no matter what the size of the display window is. (But it must be a square!) Try changing the size of the display window in the setup method.&lt;br /&gt;In order to keep our pattern symmetrical we are going to place the 9 squares into 3 groups. There will be a corner group, a side group and the central square. The 9 squares dont all have to be used in the pattern, so we are going to use boolean values, to decide whether the squares are used. A boolean value can be true or false but not null.&lt;br /&gt;Our first step will be to move the code from our experiment into the chunk 16 program. If we type /* */ we can simply paste in all the experimental code between the asterisks and Processing will ignore it.&lt;br /&gt;Try to make a new function that uses the recs array to help manage drawing the 9 squares in our grid. Call the function drawSectors or any name you like.&lt;br /&gt;We already have a function for populating the recs array with default values at the start of the function.&lt;br /&gt;Use random numbers to decide whether each of the 3 groups are populated.&lt;br /&gt;Write some code that sets the value of the relevant array position to true if a shape will be drawn there.&lt;br /&gt;Write some code that uses the recs array to control where shapes will be drawn.&lt;br /&gt;Use the rect(int,int,int,int)function to begin with.&lt;br /&gt;Place a call to the repeatSectors function somewhere in the switch block of the draw function.&lt;br /&gt;Add some randomisation to make the patterns vary as much as possible.&lt;br /&gt;if you get stuck use the reference section in Processing, google what you are trying to do or check the solution provided at the end of this section.&lt;br /&gt;This is a very challenging function to write and could take a good few hours to solve but its early days yet and this will get you thinking like a programmer. When your super duper function is completed you can use your artistic flair to make it dazzling!&lt;br /&gt;************************&lt;br /&gt;void drawSectors(){&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;************************&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5716795657221614847?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5716795657221614847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk16-code-removed-second-draft.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5716795657221614847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5716795657221614847'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk16-code-removed-second-draft.html' title='Chunk16 Code Removed - Second Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/ST6bIssM3uI/AAAAAAAAADE/GVBSYbEdZA4/s72-c/circle16.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-1324148694862503639</id><published>2008-12-09T16:00:00.005Z</published><updated>2008-12-09T16:11:26.060Z</updated><title type='text'>Uncommented Standalone Code</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/ST6X1WvPcWI/AAAAAAAAAC8/dSflIwH4RtQ/s1600-h/circle15.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 308px; height: 320px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/ST6X1WvPcWI/AAAAAAAAAC8/dSflIwH4RtQ/s320/circle15.gif" alt="" id="BLOGGER_PHOTO_ID_5277822756217385314" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'm a bit bamboozled about the requirements for the first and second programs. After adding the array function the code is well over 100 lines but I think I could cut down the amount of lines by cramping the code a bit.&lt;br /&gt;Does anyone know if 100 lines is a fixed limit?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="gutter"&gt;  1:&lt;/span&gt;/*&lt;br /&gt;&lt;span class="gutter"&gt;  2:&lt;/span&gt; title: Funky Chunk 16&lt;br /&gt;&lt;span class="gutter"&gt;  3:&lt;/span&gt; description: random pattern generator&lt;br /&gt;&lt;span class="gutter"&gt;  4:&lt;/span&gt; created: December 2, 2008&lt;br /&gt;&lt;span class="gutterH"&gt;  5:&lt;/span&gt; by: Rosie Wood&lt;br /&gt;&lt;span class="gutter"&gt;  6:&lt;/span&gt; */&lt;br /&gt;&lt;span class="gutter"&gt;  7:&lt;/span&gt;// define Global variable values&lt;br /&gt;&lt;span class="gutter"&gt;  8:&lt;/span&gt;//These are constant variables and therefore they are not changed&lt;br /&gt;&lt;span class="gutter"&gt;  9:&lt;/span&gt;//by the program. Setting their value here in one place helps with maimtenance&lt;br /&gt;&lt;span class="gutterH"&gt; 10:&lt;/span&gt;int sizeWindow=600;&lt;br /&gt;&lt;span class="gutter"&gt; 11:&lt;/span&gt;int centre=sizeWindow/2;&lt;br /&gt;&lt;span class="gutter"&gt; 12:&lt;/span&gt;int xpos = centre;&lt;br /&gt;&lt;span class="gutter"&gt; 13:&lt;/span&gt;int ypos = centre;&lt;br /&gt;&lt;span class="gutter"&gt; 14:&lt;/span&gt;int patternsPerPicture=round(random(2,50));&lt;br /&gt;&lt;span class="gutterH"&gt; 15:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 16:&lt;/span&gt;boolean [] recs=new boolean[9];&lt;br /&gt;&lt;span class="gutter"&gt; 17:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 18:&lt;/span&gt;//this variable is changed frequently by the application&lt;br /&gt;&lt;span class="gutter"&gt; 19:&lt;/span&gt;int interval=30;&lt;br /&gt;&lt;span class="gutterH"&gt; 20:&lt;/span&gt;int count;&lt;br /&gt;&lt;span class="gutter"&gt; 21:&lt;/span&gt;// set the sketch window size and background&lt;br /&gt;&lt;span class="gutter"&gt; 22:&lt;/span&gt;//turn off fill so that patterns underneath can be seen&lt;br /&gt;&lt;span class="gutter"&gt; 23:&lt;/span&gt;//set the rate that the screen refreshes at (found this value was best for this application?)&lt;br /&gt;&lt;span class="gutter"&gt; 24:&lt;/span&gt;void setup(){&lt;br /&gt;&lt;span class="gutterH"&gt; 25:&lt;/span&gt;  size(sizeWindow, sizeWindow);&lt;br /&gt;&lt;span class="gutter"&gt; 26:&lt;/span&gt;  background(0);&lt;br /&gt;&lt;span class="gutter"&gt; 27:&lt;/span&gt;  stroke(204, 102, 0);//colour red&lt;br /&gt;&lt;span class="gutter"&gt; 28:&lt;/span&gt;  noFill();&lt;br /&gt;&lt;span class="gutter"&gt; 29:&lt;/span&gt;  frameRate(.2);&lt;br /&gt;&lt;span class="gutterH"&gt; 30:&lt;/span&gt;  draw();&lt;br /&gt;&lt;span class="gutter"&gt; 31:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 32:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 33:&lt;/span&gt;void draw(){&lt;br /&gt;&lt;span class="gutter"&gt; 34:&lt;/span&gt;  //local variables&lt;br /&gt;&lt;span class="gutterH"&gt; 35:&lt;/span&gt;  count=0;&lt;br /&gt;&lt;span class="gutter"&gt; 36:&lt;/span&gt;  int design=0;&lt;br /&gt;&lt;span class="gutter"&gt; 37:&lt;/span&gt;  background(0); &lt;br /&gt;&lt;span class="gutter"&gt; 38:&lt;/span&gt;  for(count=0;count&amp;lt;patternsPerPicture;count++){&lt;br /&gt;&lt;span class="gutter"&gt; 39:&lt;/span&gt;    strokeWeight(getSW());//set the strokewright to the number returned by the getSW function&lt;br /&gt;&lt;span class="gutterH"&gt; 40:&lt;/span&gt;    noFill();&lt;br /&gt;&lt;span class="gutter"&gt; 41:&lt;/span&gt;    interval=round(random(5,70));//increment by interval in while loops&lt;br /&gt;&lt;span class="gutter"&gt; 42:&lt;/span&gt;    changeColour();&lt;br /&gt;&lt;span class="gutter"&gt; 43:&lt;/span&gt;    design=round(random(1,9)); //a random numver for which design to use in the switch&lt;br /&gt;&lt;span class="gutter"&gt; 44:&lt;/span&gt;    switch(design){&lt;br /&gt;&lt;span class="gutterH"&gt; 45:&lt;/span&gt;    case 1:     &lt;br /&gt;&lt;span class="gutter"&gt; 46:&lt;/span&gt;      repeatShapes(round(random(3,70)),'2');&lt;br /&gt;&lt;span class="gutter"&gt; 47:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 48:&lt;/span&gt;    case 2:                      &lt;br /&gt;&lt;span class="gutter"&gt; 49:&lt;/span&gt;      drawCircles(round(random(20,round(random(1,50)))));     //call the drawCircles function&lt;br /&gt;&lt;span class="gutterH"&gt; 50:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 51:&lt;/span&gt;    case 3:&lt;br /&gt;&lt;span class="gutter"&gt; 52:&lt;/span&gt;      repeatShapes(round(random(1,width/2)),'2');//use the drawCircle2 function    &lt;br /&gt;&lt;span class="gutter"&gt; 53:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 54:&lt;/span&gt;    case 4:&lt;br /&gt;&lt;span class="gutterH"&gt; 55:&lt;/span&gt;      repeatShapes(width-round(random(2,width/4)),'3');&lt;br /&gt;&lt;span class="gutter"&gt; 56:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 57:&lt;/span&gt;    case 5:&lt;br /&gt;&lt;span class="gutter"&gt; 58:&lt;/span&gt;      if(round(random(4))==2){     &lt;br /&gt;&lt;span class="gutter"&gt; 59:&lt;/span&gt;      doLines();}&lt;br /&gt;&lt;span class="gutterH"&gt; 60:&lt;/span&gt;      else{drawSectors();}   &lt;br /&gt;&lt;span class="gutter"&gt; 61:&lt;/span&gt;    case 6: &lt;br /&gt;&lt;span class="gutter"&gt; 62:&lt;/span&gt;      repeatShapes(interval,'5');&lt;br /&gt;&lt;span class="gutter"&gt; 63:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 64:&lt;/span&gt;    case 7:              &lt;br /&gt;&lt;span class="gutterH"&gt; 65:&lt;/span&gt;      repeatShapes(round(random(1,120)),'2');&lt;br /&gt;&lt;span class="gutter"&gt; 66:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 67:&lt;/span&gt;    case 8:&lt;br /&gt;&lt;span class="gutter"&gt; 68:&lt;/span&gt;    default:&lt;br /&gt;&lt;span class="gutter"&gt; 69:&lt;/span&gt;      repeatShapes(width-round(random(1,width/2)),'4');//draws unfilled squares           &lt;br /&gt;&lt;span class="gutterH"&gt; 70:&lt;/span&gt;    }&lt;br /&gt;&lt;span class="gutter"&gt; 71:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt; 72:&lt;/span&gt;  patternsPerPicture=round(random(2,50));//change number of patterns for next picture&lt;br /&gt;&lt;span class="gutter"&gt; 73:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 74:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutterH"&gt; 75:&lt;/span&gt;/**function changeColour: to change the stroke colour no parameters no return value*/&lt;br /&gt;&lt;span class="gutter"&gt; 76:&lt;/span&gt;void changeColour(){&lt;br /&gt;&lt;span class="gutter"&gt; 77:&lt;/span&gt;  stroke(random(255),random(255),random(255));&lt;br /&gt;&lt;span class="gutter"&gt; 78:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 79:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutterH"&gt; 80:&lt;/span&gt;//function draws circles accepts parameter gap and uses it to increment loop untill    &lt;br /&gt;&lt;span class="gutter"&gt; 81:&lt;/span&gt;void drawCircles(int gap){&lt;br /&gt;&lt;span class="gutter"&gt; 82:&lt;/span&gt;  for(int n=0;n&amp;lt;round(random(width/2,width));n+=gap){&lt;br /&gt;&lt;span class="gutter"&gt; 83:&lt;/span&gt;    drawCircle(n);&lt;br /&gt;&lt;span class="gutter"&gt; 84:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutterH"&gt; 85:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 86:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 87:&lt;/span&gt;/**no parameters, no return valur*/&lt;br /&gt;&lt;span class="gutter"&gt; 88:&lt;/span&gt;void drawCircle2(int diameter){&lt;br /&gt;&lt;span class="gutter"&gt; 89:&lt;/span&gt;    ellipse(xpos, ypos, diameter-random(5,diameter), diameter-random(5,diameter));&lt;br /&gt;&lt;span class="gutterH"&gt; 90:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 91:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 92:&lt;/span&gt;//accepts 1 parameter&lt;br /&gt;&lt;span class="gutter"&gt; 93:&lt;/span&gt;void drawCircle3(int diameter){&lt;br /&gt;&lt;span class="gutter"&gt; 94:&lt;/span&gt;  ellipse(xpos, ypos, (diameter*random(5,diameter))/(random(5,diameter)*19), (diameter*random(5,diameter))/(random(5,diameter)*19) );&lt;br /&gt;&lt;span class="gutterH"&gt; 95:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 96:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 97:&lt;/span&gt;void drawSquares(int diameter){&lt;br /&gt;&lt;span class="gutter"&gt; 98:&lt;/span&gt;  int r= round(random(1,4));&lt;br /&gt;&lt;span class="gutter"&gt; 99:&lt;/span&gt;  rectMode(RADIUS);&lt;br /&gt;&lt;span class="gutterH"&gt;100:&lt;/span&gt;  //if/if else/else block&lt;br /&gt;&lt;span class="gutter"&gt;101:&lt;/span&gt;  if(r==1){&lt;br /&gt;&lt;span class="gutter"&gt;102:&lt;/span&gt;    noStroke();&lt;br /&gt;&lt;span class="gutter"&gt;103:&lt;/span&gt;    rectMode(CENTER);&lt;br /&gt;&lt;span class="gutter"&gt;104:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutterH"&gt;105:&lt;/span&gt;  else if(r==2){&lt;br /&gt;&lt;span class="gutter"&gt;106:&lt;/span&gt;    diameter=diameter/20;&lt;br /&gt;&lt;span class="gutter"&gt;107:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt;108:&lt;/span&gt;  else if(r==3){&lt;br /&gt;&lt;span class="gutter"&gt;109:&lt;/span&gt;    changeColour();&lt;br /&gt;&lt;span class="gutterH"&gt;110:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt;111:&lt;/span&gt;  else{&lt;br /&gt;&lt;span class="gutter"&gt;112:&lt;/span&gt;    diameter=diameter/20;&lt;br /&gt;&lt;span class="gutter"&gt;113:&lt;/span&gt;    stroke(round(random(255)),round(random(255)),round(random(255)),round(random(255)));&lt;br /&gt;&lt;span class="gutter"&gt;114:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutterH"&gt;115:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;116:&lt;/span&gt;  rect(xpos,ypos,diameter,diameter);&lt;br /&gt;&lt;span class="gutter"&gt;117:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt;118:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;119:&lt;/span&gt;//returns integer valur for stroke weight depending on framecount&lt;br /&gt;&lt;span class="gutterH"&gt;120:&lt;/span&gt;int getSW(){&lt;br /&gt;&lt;span class="gutter"&gt;121:&lt;/span&gt;  int fc=round(random(frameRate*500)/5);&lt;br /&gt;&lt;span class="gutter"&gt;122:&lt;/span&gt;  return fc%10;&lt;br /&gt;&lt;span class="gutter"&gt;123:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt;124:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutterH"&gt;125:&lt;/span&gt;void repeatShapes(int gap, char c){&lt;br /&gt;&lt;span class="gutter"&gt;126:&lt;/span&gt;  char shape=c;            &lt;br /&gt;&lt;span class="gutter"&gt;127:&lt;/span&gt;  int interval=gap;&lt;br /&gt;&lt;span class="gutter"&gt;128:&lt;/span&gt;  while(interval&amp;lt;width){//while intervel is less than the width of the window&lt;br /&gt;&lt;span class="gutter"&gt;129:&lt;/span&gt;    if(shape=='1')drawCircles(interval);&lt;br /&gt;&lt;span class="gutterH"&gt;130:&lt;/span&gt;    else if(shape=='2'){&lt;br /&gt;&lt;span class="gutter"&gt;131:&lt;/span&gt;      drawCircle2(interval);&lt;br /&gt;&lt;span class="gutter"&gt;132:&lt;/span&gt;    }//call function drawCircle2 with a random parameter&lt;br /&gt;&lt;span class="gutter"&gt;133:&lt;/span&gt;    else if(shape=='3'){&lt;br /&gt;&lt;span class="gutter"&gt;134:&lt;/span&gt;      drawCircle3(interval);&lt;br /&gt;&lt;span class="gutterH"&gt;135:&lt;/span&gt;    }&lt;br /&gt;&lt;span class="gutter"&gt;136:&lt;/span&gt;    else if(shape=='4'){&lt;br /&gt;&lt;span class="gutter"&gt;137:&lt;/span&gt;      int r=round(random(1,5));&lt;br /&gt;&lt;span class="gutter"&gt;138:&lt;/span&gt;      if(r==1){&lt;br /&gt;&lt;span class="gutter"&gt;139:&lt;/span&gt;        noStroke();&lt;br /&gt;&lt;span class="gutterH"&gt;140:&lt;/span&gt;        changeColour();&lt;br /&gt;&lt;span class="gutter"&gt;141:&lt;/span&gt;        fill(random(255),random(255),random(255));}&lt;br /&gt;&lt;span class="gutter"&gt;142:&lt;/span&gt;      drawSquares(round(interval));&lt;br /&gt;&lt;span class="gutter"&gt;143:&lt;/span&gt;    }&lt;br /&gt;&lt;span class="gutter"&gt;144:&lt;/span&gt;    else{&lt;br /&gt;&lt;span class="gutterH"&gt;145:&lt;/span&gt;      int r=round(random(1,5));&lt;br /&gt;&lt;span class="gutter"&gt;146:&lt;/span&gt;      if(r==1){&lt;br /&gt;&lt;span class="gutter"&gt;147:&lt;/span&gt;        noStroke(); &lt;br /&gt;&lt;span class="gutter"&gt;148:&lt;/span&gt;        fill(random(255),random(255),random(255));} &lt;br /&gt;&lt;span class="gutter"&gt;149:&lt;/span&gt;        drawCircle2(interval/4);     }&lt;br /&gt;&lt;span class="gutterH"&gt;150:&lt;/span&gt;    interval+=gap;}}&lt;br /&gt;&lt;span class="gutter"&gt;151:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;152:&lt;/span&gt;void doLines(){&lt;br /&gt;&lt;span class="gutter"&gt;153:&lt;/span&gt;  strokeWeight(getSW());&lt;br /&gt;&lt;span class="gutter"&gt;154:&lt;/span&gt;  for(int b=1;b&amp;lt;width;b=b+round(random(1,20))){&lt;br /&gt;&lt;span class="gutterH"&gt;155:&lt;/span&gt;    int down=round(random(width/2));&lt;br /&gt;&lt;span class="gutter"&gt;156:&lt;/span&gt;    int across=round(random(width/2));&lt;br /&gt;&lt;span class="gutter"&gt;157:&lt;/span&gt;    line(xpos,ypos,across-b,down-b);&lt;br /&gt;&lt;span class="gutter"&gt;158:&lt;/span&gt;    line(xpos,ypos,across+b+xpos,down-b);&lt;br /&gt;&lt;span class="gutter"&gt;159:&lt;/span&gt;    line(xpos,ypos,across-b,width-down+b);&lt;br /&gt;&lt;span class="gutterH"&gt;160:&lt;/span&gt;    line(xpos,ypos,across+b+xpos,width-down+b);}}&lt;br /&gt;&lt;span class="gutter"&gt;161:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;162:&lt;/span&gt;void drawCircle(int diameter){&lt;br /&gt;&lt;span class="gutter"&gt;163:&lt;/span&gt;  ellipse(xpos, ypos, diameter-interval,  diameter);&lt;br /&gt;&lt;span class="gutter"&gt;164:&lt;/span&gt;  ellipse(xpos, ypos, diameter,  diameter-interval);&lt;br /&gt;&lt;span class="gutterH"&gt;165:&lt;/span&gt;  ellipse(xpos, ypos, diameter,  diameter);&lt;br /&gt;&lt;span class="gutter"&gt;166:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt;167:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;168:&lt;/span&gt;void resetRecs(){&lt;br /&gt;&lt;span class="gutter"&gt;169:&lt;/span&gt;   for(int r=0;r&amp;lt;9;r++){&lt;br /&gt;&lt;span class="gutterH"&gt;170:&lt;/span&gt;    recs[r]=false;}}&lt;br /&gt;&lt;span class="gutter"&gt;171:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;172:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;173:&lt;/span&gt;void drawSectors(){&lt;br /&gt;&lt;span class="gutter"&gt;174:&lt;/span&gt;    resetRecs();&lt;br /&gt;&lt;span class="gutterH"&gt;175:&lt;/span&gt;   int [] midxy={(width/3)/2, (width/3)/2+width/3, (width/3)/2+width/3*2 };&lt;br /&gt;&lt;span class="gutter"&gt;176:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;177:&lt;/span&gt;  //decide on groups to use&lt;br /&gt;&lt;span class="gutter"&gt;178:&lt;/span&gt;  int corners=round(random(0,1));&lt;br /&gt;&lt;span class="gutter"&gt;179:&lt;/span&gt;  if(corners==1){&lt;br /&gt;&lt;span class="gutterH"&gt;180:&lt;/span&gt;  recs[0]=recs[2]=recs[6]=recs[8]=true;&lt;br /&gt;&lt;span class="gutter"&gt;181:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt;182:&lt;/span&gt;  int sides=round(random(0,1));&lt;br /&gt;&lt;span class="gutter"&gt;183:&lt;/span&gt;  if(sides==1){&lt;br /&gt;&lt;span class="gutter"&gt;184:&lt;/span&gt;  recs[1]=recs[3]=recs[5]=recs[7]=true;&lt;br /&gt;&lt;span class="gutterH"&gt;185:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt;186:&lt;/span&gt;  int centre=round(random(0,1));&lt;br /&gt;&lt;span class="gutter"&gt;187:&lt;/span&gt;  if(centre==1){&lt;br /&gt;&lt;span class="gutter"&gt;188:&lt;/span&gt;  recs[4]=true;&lt;br /&gt;&lt;span class="gutter"&gt;189:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutterH"&gt;190:&lt;/span&gt;  for(int r=0;r&amp;lt;9;r++){&lt;br /&gt;&lt;span class="gutter"&gt;191:&lt;/span&gt;  println("num"+r+"rec? "+recs[r]);&lt;br /&gt;&lt;span class="gutter"&gt;192:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt;193:&lt;/span&gt;  rectMode(CENTER);&lt;br /&gt;&lt;span class="gutter"&gt;194:&lt;/span&gt;  ellipseMode(CENTER);&lt;br /&gt;&lt;span class="gutterH"&gt;195:&lt;/span&gt;     int f=round(random(1,5));&lt;br /&gt;&lt;span class="gutter"&gt;196:&lt;/span&gt;     if(f==1){&lt;br /&gt;&lt;span class="gutter"&gt;197:&lt;/span&gt;    fill(random(255),random(255),random(255));}&lt;br /&gt;&lt;span class="gutter"&gt;198:&lt;/span&gt;    else{&lt;br /&gt;&lt;span class="gutter"&gt;199:&lt;/span&gt;      getSW();&lt;br /&gt;&lt;span class="gutterH"&gt;200:&lt;/span&gt;      changeColour();&lt;br /&gt;&lt;span class="gutter"&gt;201:&lt;/span&gt;    }&lt;br /&gt;&lt;span class="gutter"&gt;202:&lt;/span&gt;    int d=round(random(width/3));&lt;br /&gt;&lt;span class="gutter"&gt;203:&lt;/span&gt;    int sType=round(random(2));&lt;br /&gt;&lt;span class="gutter"&gt;204:&lt;/span&gt;    for(int n=0;n&amp;lt;9;n++){&lt;br /&gt;&lt;span class="gutterH"&gt;205:&lt;/span&gt;      if(recs[n]==true){&lt;br /&gt;&lt;span class="gutter"&gt;206:&lt;/span&gt;        int mod=n%3;&lt;br /&gt;&lt;span class="gutter"&gt;207:&lt;/span&gt;        int down=0;&lt;br /&gt;&lt;span class="gutter"&gt;208:&lt;/span&gt;        if(n&amp;gt;5)down=2;&lt;br /&gt;&lt;span class="gutter"&gt;209:&lt;/span&gt;        else if (n&amp;gt;2){down=1;}&lt;br /&gt;&lt;span class="gutterH"&gt;210:&lt;/span&gt;    &lt;br /&gt;&lt;span class="gutter"&gt;211:&lt;/span&gt;        if(sType==1){&lt;br /&gt;&lt;span class="gutter"&gt;212:&lt;/span&gt;        rect(midxy[mod], midxy[down], d, d); }&lt;br /&gt;&lt;span class="gutter"&gt;213:&lt;/span&gt;        else{&lt;br /&gt;&lt;span class="gutter"&gt;214:&lt;/span&gt;        ellipse(midxy[mod], midxy[down], d, d);}&lt;br /&gt;&lt;span class="gutterH"&gt;215:&lt;/span&gt;        println("mod: "+mod);&lt;br /&gt;&lt;span class="gutter"&gt;216:&lt;/span&gt;        println("down: "+down);&lt;br /&gt;&lt;span class="gutter"&gt;217:&lt;/span&gt;        println("across: "+midxy[mod]);&lt;br /&gt;&lt;span class="gutter"&gt;218:&lt;/span&gt;        println("down: "+midxy[down]);&lt;br /&gt;&lt;span class="gutter"&gt;219:&lt;/span&gt;    &lt;br /&gt;&lt;span class="gutterH"&gt;220:&lt;/span&gt;      }&lt;br /&gt;&lt;span class="gutter"&gt;221:&lt;/span&gt;        }&lt;br /&gt;&lt;span class="gutter"&gt;222:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;223:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;224:&lt;/span&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-1324148694862503639?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/1324148694862503639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/uncommented-standalone-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1324148694862503639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1324148694862503639'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/uncommented-standalone-code.html' title='Uncommented Standalone Code'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/ST6X1WvPcWI/AAAAAAAAAC8/dSflIwH4RtQ/s72-c/circle15.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8571729213004962367</id><published>2008-12-09T15:14:00.003Z</published><updated>2008-12-09T15:37:40.753Z</updated><title type='text'>Arrays and Modification - First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/ST6PUoDiLmI/AAAAAAAAAC0/JoXr7IEaXqo/s1600-h/circle14.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 289px; height: 298px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/ST6PUoDiLmI/AAAAAAAAAC0/JoXr7IEaXqo/s320/circle14.gif" alt="" id="BLOGGER_PHOTO_ID_5277813397837196898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;An array can be thought of as a container for a collection of objects of the same type. This container, has an index, so that each object it holds, can be fetched. We declare an array like this:&lt;br /&gt;int [] midxy;&lt;br /&gt;it can be filled in a variety of ways and its capacity can be set when it is declared and initialized:&lt;br /&gt;boolean [] recs=new boolean[9];&lt;br /&gt;It can also be initialized by listing its members:&lt;br /&gt;int [] midxy={100, 300, 500};&lt;br /&gt;A quick way of populating an array is to use a for loop:&lt;br /&gt;for(int r=0;r &lt; 9;r++){&lt;br /&gt;   recs[r]=false;}&lt;br /&gt;The array recs contains 9 boolean values and we are going to use it to design a new function for our pattern generator. So far all our patterns are positioned around the centre point of the screen, as this is an easy way of making sure the patterns are symetrical. We are going to use the recs array to draw out a symetrical pattern in a grid, like the tic tac toe game.&lt;br /&gt;Copy the following code into processing and run it.&lt;br /&gt;int [] midxy;&lt;br /&gt;boolean [] recs;&lt;br /&gt;void setup(){&lt;br /&gt; size(600, 600);&lt;br /&gt; drawA();}&lt;br /&gt;&lt;br /&gt;void drawA(){&lt;br /&gt; rectMode(CENTER);&lt;br /&gt; recs=new boolean[9];&lt;br /&gt; resetRecs();&lt;br /&gt; int [] midxy={(width/3)/2, (width/3)/2+width/3, (width/3)/2+width/3*2 };&lt;br /&gt; for(int n=0;n &lt; 3;n++){&lt;br /&gt;   for(int i=0;i &lt; 3;i++){&lt;br /&gt;     rect(midxy[i], midxy[n], width/3, width/3);}}&lt;br /&gt;   //*************************************************&lt;br /&gt;   fill(random(255),random(255),random(255));&lt;br /&gt;   //stroke(random(255),random(255),random(255));&lt;br /&gt;   strokeWeight(20);&lt;br /&gt;   //*************************************************&lt;br /&gt;   rect(midxy[1], midxy[1], width/3, width/3);  &lt;br /&gt;   //println("empty? "+midxy[0]==null);}&lt;br /&gt;&lt;br /&gt;void resetRecs(){&lt;br /&gt;  for(int r=0;r &lt; 9;r++){&lt;br /&gt;   recs[r]=false;&lt;br /&gt;   println(""+recs[r]);&lt;br /&gt; }&lt;br /&gt; println("size of recs? "+recs.length);&lt;br /&gt;}&lt;br /&gt;As you can see this is a quick sketch of our new shape function. Experiment by commenting and uncommenting the code between the lines of asterisks and changing the value of the stroke weight. The statement after the last line of asterisks is drawing the square at the centre of the screen. It is using the value in midxy[1] for its centre of origin. Change one of the first 2 values in the rect function to a zero. Change both values to 2 and see if you can place the square in each position in the grid. It would get quite tedious typing values like (width/3)/2+width/3*2 so we have placed them in an array.&lt;br /&gt;The values in midxy will find the centre of each of the 9 squares no matter what the size of the display window is. (But it must be a square!) Try changing the size of the display window in the setup method.&lt;br /&gt;In order to keep our pattern symmetrical we are going to place the 9 squares into 3 groups. There will be a corner group, a side group and the central square on its own. The 9 squares dont all have to be used in the pattern, so we are going to use boolean values, to indicate whether the squares are used or not. A boolean value can be true or false and we will do the equivalent of tossing a coin to decide.&lt;br /&gt;Our first step will be to move the code from our experiment into the chunk 16 program. If we type /* */ we can simply paste in all the experimental code between the asterisks and Processing will ignore it.&lt;br /&gt;Try to make a new function that uses the recs array to help manage drawing the 9 squares in our grid. Call the function drawSectors or any name you like.&lt;br /&gt;We already have a function for populating the recs array with default values at the start of the function.&lt;br /&gt;Use random numbers to decide whether each of the 3 groups are populated.&lt;br /&gt;Write some code that sets the value of the relevant array position to true if a shape will be drawn there.&lt;br /&gt;Write some code that uses the recs array to control where shapes will be drawn.&lt;br /&gt;Use the rect(int,int,int,int)function to begin with.&lt;br /&gt;Place a call to the repeatSectors function somewhere in the switch block of the draw function.&lt;br /&gt;Add some randomisation to make the patterns vary as much as possible.&lt;br /&gt;if you get stuck use the reference section in Processing, Google what you are trying to do, or check the solution provided at the end of this section.&lt;br /&gt;This is a very challenging function to write and could take a good few hours to solve, but its early days yet and this will get you thinking like a programmer. When your super duper function is completed you can use your artistic flair to make it dazzling!&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8571729213004962367?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8571729213004962367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/arrays-and-modification-first-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8571729213004962367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8571729213004962367'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/arrays-and-modification-first-draft.html' title='Arrays and Modification - First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/ST6PUoDiLmI/AAAAAAAAAC0/JoXr7IEaXqo/s72-c/circle14.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-4877977606392805236</id><published>2008-12-08T23:11:00.004Z</published><updated>2008-12-09T00:37:47.643Z</updated><title type='text'>Revised Code</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.solundrian.com/procs/randomizer3/applet/randomizer3.jar"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 301px; height: 320px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/ST29OmjCVJI/AAAAAAAAACs/mKSrSSEWhgY/s320/circle13.gif" alt="" id="BLOGGER_PHOTO_ID_5277582396911408274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="gutter"&gt;  1:&lt;/span&gt;int sizeWindow=600;&lt;br /&gt;&lt;span class="gutter"&gt;  2:&lt;/span&gt;int centre=sizeWindow/2;&lt;br /&gt;&lt;span class="gutter"&gt;  3:&lt;/span&gt;int xpos = centre;&lt;br /&gt;&lt;span class="gutter"&gt;  4:&lt;/span&gt;int ypos = centre;&lt;br /&gt;&lt;span class="gutterH"&gt;  5:&lt;/span&gt;int patternsPerPicture=round(random(2,50));&lt;br /&gt;&lt;span class="gutter"&gt;  6:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;  7:&lt;/span&gt;int interval=30;&lt;br /&gt;&lt;span class="gutter"&gt;  8:&lt;/span&gt;int count;&lt;br /&gt;&lt;span class="gutter"&gt;  9:&lt;/span&gt;void setup(){&lt;br /&gt;&lt;span class="gutterH"&gt; 10:&lt;/span&gt;  size(sizeWindow, sizeWindow);&lt;br /&gt;&lt;span class="gutter"&gt; 11:&lt;/span&gt;  background(0);&lt;br /&gt;&lt;span class="gutter"&gt; 12:&lt;/span&gt;  stroke(204, 102, 0);//colour red&lt;br /&gt;&lt;span class="gutter"&gt; 13:&lt;/span&gt;  noFill();&lt;br /&gt;&lt;span class="gutter"&gt; 14:&lt;/span&gt;  frameRate(.2);&lt;br /&gt;&lt;span class="gutterH"&gt; 15:&lt;/span&gt;  draw();}&lt;br /&gt;&lt;span class="gutter"&gt; 16:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 17:&lt;/span&gt;void draw(){&lt;br /&gt;&lt;span class="gutter"&gt; 18:&lt;/span&gt;  count=0;&lt;br /&gt;&lt;span class="gutter"&gt; 19:&lt;/span&gt;  int design=0;&lt;br /&gt;&lt;span class="gutterH"&gt; 20:&lt;/span&gt;  background(0);   &lt;br /&gt;&lt;span class="gutter"&gt; 21:&lt;/span&gt;  for(count=0;count&amp;lt;patternsPerPicture;count++){&lt;br /&gt;&lt;span class="gutter"&gt; 22:&lt;/span&gt;    strokeWeight(getSW());//set the strokewright to the number returned by the getSW function&lt;br /&gt;&lt;span class="gutter"&gt; 23:&lt;/span&gt;    noFill();&lt;br /&gt;&lt;span class="gutter"&gt; 24:&lt;/span&gt;    interval=round(random(5,70));//increment by interval in while loops&lt;br /&gt;&lt;span class="gutterH"&gt; 25:&lt;/span&gt;    changeColour();&lt;br /&gt;&lt;span class="gutter"&gt; 26:&lt;/span&gt;    design=round(random(1,9)); //a random numver for which design to use in the switch&lt;br /&gt;&lt;span class="gutter"&gt; 27:&lt;/span&gt;    switch(design){&lt;br /&gt;&lt;span class="gutter"&gt; 28:&lt;/span&gt;    case 1:       &lt;br /&gt;&lt;span class="gutter"&gt; 29:&lt;/span&gt;      repeatShapes(round(random(3,70)),'2');&lt;br /&gt;&lt;span class="gutterH"&gt; 30:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 31:&lt;/span&gt;    case 2:                        &lt;br /&gt;&lt;span class="gutter"&gt; 32:&lt;/span&gt;      drawCircles(round(random(20,round(random(1,50)))));     //call the drawCircles function&lt;br /&gt;&lt;span class="gutter"&gt; 33:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 34:&lt;/span&gt;    case 3:&lt;br /&gt;&lt;span class="gutterH"&gt; 35:&lt;/span&gt;      repeatShapes(round(random(1,width/2)),'2');//use the drawCircle2 function      &lt;br /&gt;&lt;span class="gutter"&gt; 36:&lt;/span&gt;      break;  &lt;br /&gt;&lt;span class="gutter"&gt; 37:&lt;/span&gt;    case 4:&lt;br /&gt;&lt;span class="gutter"&gt; 38:&lt;/span&gt;      repeatShapes(width-round(random(2,width/4)),'3');&lt;br /&gt;&lt;span class="gutter"&gt; 39:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutterH"&gt; 40:&lt;/span&gt;    case 5:        &lt;br /&gt;&lt;span class="gutter"&gt; 41:&lt;/span&gt;      doLines();          &lt;br /&gt;&lt;span class="gutter"&gt; 42:&lt;/span&gt;    case 6:   &lt;br /&gt;&lt;span class="gutter"&gt; 43:&lt;/span&gt;      repeatShapes(interval,'5');&lt;br /&gt;&lt;span class="gutter"&gt; 44:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutterH"&gt; 45:&lt;/span&gt;    case 7:                &lt;br /&gt;&lt;span class="gutter"&gt; 46:&lt;/span&gt;      repeatShapes(round(random(1,40)),'2');&lt;br /&gt;&lt;span class="gutter"&gt; 47:&lt;/span&gt;      break;&lt;br /&gt;&lt;span class="gutter"&gt; 48:&lt;/span&gt;    case 8:&lt;br /&gt;&lt;span class="gutter"&gt; 49:&lt;/span&gt;    default:&lt;br /&gt;&lt;span class="gutterH"&gt; 50:&lt;/span&gt;      repeatShapes(width-round(random(1,width/2)),'4');//draws unfilled squares             &lt;br /&gt;&lt;span class="gutter"&gt; 51:&lt;/span&gt;    }}&lt;br /&gt;&lt;span class="gutter"&gt; 52:&lt;/span&gt;  patternsPerPicture=round(random(2,50));}&lt;br /&gt;&lt;span class="gutter"&gt; 53:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 54:&lt;/span&gt;void changeColour(){&lt;br /&gt;&lt;span class="gutterH"&gt; 55:&lt;/span&gt;  stroke(random(255),random(255),random(255));&lt;br /&gt;&lt;span class="gutter"&gt; 56:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 57:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 58:&lt;/span&gt;void drawCircles(int gap){&lt;br /&gt;&lt;span class="gutter"&gt; 59:&lt;/span&gt;  for(int n=0;n&amp;lt;round(random(width/2,width));n+=gap){  &lt;br /&gt;&lt;span class="gutterH"&gt; 60:&lt;/span&gt;    drawCircle(n);}}&lt;br /&gt;&lt;span class="gutter"&gt; 61:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 62:&lt;/span&gt;void drawCircle2(int diameter){&lt;br /&gt;&lt;span class="gutter"&gt; 63:&lt;/span&gt;    ellipse(xpos, ypos, diameter-random(5,diameter), diameter-random(5,diameter));  }&lt;br /&gt;&lt;span class="gutter"&gt; 64:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutterH"&gt; 65:&lt;/span&gt;void drawCircle3(int diameter){&lt;br /&gt;&lt;span class="gutter"&gt; 66:&lt;/span&gt;  ellipse(xpos, ypos, (diameter*random(5,diameter))/(random(5,diameter)*19), (diameter*random(5,diameter))/(random(5,diameter)*19) );&lt;br /&gt;&lt;span class="gutter"&gt; 67:&lt;/span&gt;}&lt;br /&gt;&lt;span class="gutter"&gt; 68:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 69:&lt;/span&gt;void drawSquares(int diameter){&lt;br /&gt;&lt;span class="gutterH"&gt; 70:&lt;/span&gt;  int r= round(random(1,4));&lt;br /&gt;&lt;span class="gutter"&gt; 71:&lt;/span&gt;  rectMode(RADIUS);&lt;br /&gt;&lt;span class="gutter"&gt; 72:&lt;/span&gt;  if(r==1){&lt;br /&gt;&lt;span class="gutter"&gt; 73:&lt;/span&gt;    noStroke();&lt;br /&gt;&lt;span class="gutter"&gt; 74:&lt;/span&gt;    rectMode(CENTER);}&lt;br /&gt;&lt;span class="gutterH"&gt; 75:&lt;/span&gt;  else if(r==2){&lt;br /&gt;&lt;span class="gutter"&gt; 76:&lt;/span&gt;    diameter=diameter/20;}&lt;br /&gt;&lt;span class="gutter"&gt; 77:&lt;/span&gt;  else if(r==3){&lt;br /&gt;&lt;span class="gutter"&gt; 78:&lt;/span&gt;    changeColour();}&lt;br /&gt;&lt;span class="gutter"&gt; 79:&lt;/span&gt;  else{&lt;br /&gt;&lt;span class="gutterH"&gt; 80:&lt;/span&gt;    diameter=diameter/20;&lt;br /&gt;&lt;span class="gutter"&gt; 81:&lt;/span&gt;    stroke(round(random(255)),round(random(255)),round(random(255)),round(random(255)));}&lt;br /&gt;&lt;span class="gutter"&gt; 82:&lt;/span&gt;  rect(xpos,ypos,diameter,diameter);}&lt;br /&gt;&lt;span class="gutter"&gt; 83:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 84:&lt;/span&gt;int getSW(){&lt;br /&gt;&lt;span class="gutterH"&gt; 85:&lt;/span&gt;  int fc=round(random(frameRate*500)/5);&lt;br /&gt;&lt;span class="gutter"&gt; 86:&lt;/span&gt;  return fc%10;&lt;br /&gt;&lt;span class="gutter"&gt; 87:&lt;/span&gt;  }&lt;br /&gt;&lt;span class="gutter"&gt; 88:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 89:&lt;/span&gt;void repeatShapes(int gap, char c){&lt;br /&gt;&lt;span class="gutterH"&gt; 90:&lt;/span&gt;  char shape=c;              &lt;br /&gt;&lt;span class="gutter"&gt; 91:&lt;/span&gt;  int interval=gap;&lt;br /&gt;&lt;span class="gutter"&gt; 92:&lt;/span&gt;  while(interval&amp;lt;width){//while intervel is less than the width of the window&lt;br /&gt;&lt;span class="gutter"&gt; 93:&lt;/span&gt;    if(shape=='1')drawCircles(interval);&lt;br /&gt;&lt;span class="gutter"&gt; 94:&lt;/span&gt;    else if(shape=='2'){&lt;br /&gt;&lt;span class="gutterH"&gt; 95:&lt;/span&gt;      drawCircle2(interval);&lt;br /&gt;&lt;span class="gutter"&gt; 96:&lt;/span&gt;    }//call function drawCircle2 with a random parameter&lt;br /&gt;&lt;span class="gutter"&gt; 97:&lt;/span&gt;    else if(shape=='3'){&lt;br /&gt;&lt;span class="gutter"&gt; 98:&lt;/span&gt;      drawCircle3(interval);}&lt;br /&gt;&lt;span class="gutter"&gt; 99:&lt;/span&gt;    else if(shape=='4'){&lt;br /&gt;&lt;span class="gutterH"&gt;100:&lt;/span&gt;      int r=round(random(1,5));&lt;br /&gt;&lt;span class="gutter"&gt;101:&lt;/span&gt;      if(r==1){&lt;br /&gt;&lt;span class="gutter"&gt;102:&lt;/span&gt;        noStroke();&lt;br /&gt;&lt;span class="gutter"&gt;103:&lt;/span&gt;        changeColour();&lt;br /&gt;&lt;span class="gutter"&gt;104:&lt;/span&gt;        fill(random(255),random(255),random(255));}&lt;br /&gt;&lt;span class="gutterH"&gt;105:&lt;/span&gt;      drawSquares(round(interval));}&lt;br /&gt;&lt;span class="gutter"&gt;106:&lt;/span&gt;    else{&lt;br /&gt;&lt;span class="gutter"&gt;107:&lt;/span&gt;      int r=round(random(1,5));&lt;br /&gt;&lt;span class="gutter"&gt;108:&lt;/span&gt;      if(r==1){&lt;br /&gt;&lt;span class="gutter"&gt;109:&lt;/span&gt;        noStroke();   &lt;br /&gt;&lt;span class="gutterH"&gt;110:&lt;/span&gt;        fill(random(255),random(255),random(255));}   &lt;br /&gt;&lt;span class="gutter"&gt;111:&lt;/span&gt;        drawCircle2(interval/4);     }&lt;br /&gt;&lt;span class="gutter"&gt;112:&lt;/span&gt;    interval+=gap;}}&lt;br /&gt;&lt;span class="gutter"&gt;113:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;114:&lt;/span&gt;void doLines(){&lt;br /&gt;&lt;span class="gutterH"&gt;115:&lt;/span&gt;  strokeWeight(getSW());&lt;br /&gt;&lt;span class="gutter"&gt;116:&lt;/span&gt;  for(int b=1;b&amp;lt;width;b=b+round(random(1,20))){&lt;br /&gt;&lt;span class="gutter"&gt;117:&lt;/span&gt;    int down=round(random(width/2));&lt;br /&gt;&lt;span class="gutter"&gt;118:&lt;/span&gt;    int across=round(random(width/2));&lt;br /&gt;&lt;span class="gutter"&gt;119:&lt;/span&gt;    line(xpos,ypos,across-b,down-b);&lt;br /&gt;&lt;span class="gutterH"&gt;120:&lt;/span&gt;    line(xpos,ypos,across+b+xpos,down-b);&lt;br /&gt;&lt;span class="gutter"&gt;121:&lt;/span&gt;    line(xpos,ypos,across-b,width-down+b);&lt;br /&gt;&lt;span class="gutter"&gt;122:&lt;/span&gt;    line(xpos,ypos,across+b+xpos,width-down+b);}}&lt;br /&gt;&lt;span class="gutter"&gt;123:&lt;/span&gt;&lt;br /&gt;&lt;span class="gutter"&gt;124:&lt;/span&gt;void drawCircle(int diameter){&lt;br /&gt;&lt;span class="gutterH"&gt;125:&lt;/span&gt;  ellipse(xpos, ypos, diameter-interval,  diameter);&lt;br /&gt;&lt;span class="gutter"&gt;126:&lt;/span&gt;  ellipse(xpos, ypos, diameter,  diameter-interval);&lt;br /&gt;&lt;span class="gutter"&gt;127:&lt;/span&gt;  ellipse(xpos, ypos, diameter,  diameter);&lt;br /&gt;&lt;span class="gutter"&gt;128:&lt;/span&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-4877977606392805236?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/4877977606392805236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/revised-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4877977606392805236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4877977606392805236'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/revised-code.html' title='Revised Code'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/ST29OmjCVJI/AAAAAAAAACs/mKSrSSEWhgY/s72-c/circle13.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5951246468266182063</id><published>2008-12-08T23:04:00.009Z</published><updated>2008-12-09T00:23:57.514Z</updated><title type='text'>Switch Block - First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.solundrian.com/procs/randomizer3/applet/randomizer3.jar"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 256px; height: 265px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ST2pSQ39IyI/AAAAAAAAACk/HhQ0EOOK3_Q/s320/circle12.gif" alt="Version 3 is harder on the eyes" id="BLOGGER_PHOTO_ID_5277560469580489506" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Our next type of code block uses a switch, to determine which block of code to run. In Java the switch value must be an integer, a byte, a short, char or enumerated type.&lt;br /&gt;Its basic outline follows this pattern:&lt;br /&gt;&lt;br /&gt;switch(int){&lt;br /&gt;case 1:&lt;br /&gt;statements;&lt;br /&gt;break;&lt;br /&gt;case 2:&lt;br /&gt;case 3:&lt;br /&gt;statements;&lt;br /&gt;break;&lt;br /&gt;case 4:&lt;br /&gt;statements;&lt;br /&gt;return(someValue);&lt;br /&gt;case 9:&lt;br /&gt;case 5:&lt;br /&gt;default: statements;&lt;br /&gt;}&lt;br /&gt;In this example, if the switch statement has a value of 1, 3, or 4 then the statements in the case blocks for 1, 3 or 4 will execute. To stop them executing the code in the other cases, break is used to exit the switch. In the case of the switch having a value of 4 the loop is exited by returning a value. Break and return allow the switch block to be exited cleanly.&lt;br /&gt;If switch has a value of 2 it doesnt have a code block of its own and continues so it executes the case 3 code block before exiting with break.&lt;br /&gt;If the switch has a value of 5, 9 or some number that doesnt have a case statement then the default case will carried out before the block is exited. Notice that the order of the case statements doesnt matter, as can be seen with case 9.&lt;br /&gt;Enumerated types can also be used and might be a nifty modification for chunk 16's  program. We will just look at a simple example of how this could be implemented:&lt;br /&gt;enum Shape{SQUARE, CIRCLE, CFILLED, SFILLED, LINE}&lt;br /&gt;Shape currentShape=CFILLED;&lt;br /&gt;switch(currentShape){&lt;br /&gt;case CIRCLE: doThis; break;&lt;br /&gt;case SQUARE: doThis; break;&lt;br /&gt;case CFILLED: doThis; break;&lt;br /&gt;default: println("Mot Implemented Yet!");//we add the default here                                                        //because we havent written the                                              //code for the other cases yet&lt;br /&gt;}&lt;br /&gt;In chunk 16 we have a large case statement (Line 40) which has cases for switch values of 1-9.&lt;br /&gt;The design variable used by the switch is a random number between 1 and 9 inclusive.&lt;br /&gt;Lets try some modifications to make chunk 16 more maintainable.&lt;br /&gt;We would prefer it if the pattern always starts with a plain black background! Remove the statement on line 36 and add background(0) at line 35.&lt;br /&gt;So now we have:&lt;br /&gt;//local variables&lt;br /&gt;int count=0;&lt;br /&gt;int design=0;&lt;br /&gt;background(0);&lt;br /&gt;for(count=0;count&lt;patternsperpicture;count++){&gt;&lt;br /&gt;at the start of the draw method.&lt;br /&gt;We can remove the line code in case 5 to its own function(line 63). Lets try omitting the break statement so the lines function is always covered up by the pattern in case 6.&lt;br /&gt;Wow that is much better! We will leave lines in now!&lt;br /&gt;&lt;br /&gt;case 5:          //lovely lines!&lt;br /&gt;         doLines();    &lt;br /&gt;   case 6:&lt;br /&gt;            ...&lt;br /&gt;Place the doLines function with the other functions&lt;br /&gt;void doLines(){&lt;br /&gt;       strokeWeight(getSW());&lt;br /&gt;       for(int b=1;b&lt;width;b=b+round(random(1,20))){&gt;&lt;br /&gt;         int down=round(random(width/2));&lt;br /&gt;         int across=round(random(width/2));&lt;br /&gt;         line(xpos,ypos,across-b,down-b);&lt;br /&gt;         line(xpos,ypos,across+b+xpos,down-b);&lt;br /&gt;         line(xpos,ypos,across-b,width-down+b);&lt;br /&gt;         line(xpos,ypos,across+b+xpos,width-down+b);}&lt;br /&gt;}&lt;br /&gt;Looking at our case statements we can see that cases 1,3,4,6,7 and 9 all use some dupkicate code. Our switch block would be much neater and easier to maintain if we could encapsulate this mess in a function!&lt;br /&gt;We will move case 1's code to a function to begin with...&lt;br /&gt;case 1: &lt;br /&gt;          repeatShapes();&lt;br /&gt;          break;&lt;br /&gt;Place the repeatShapes function with the other functions&lt;br /&gt;void repeatShapes(){&lt;br /&gt;while(interval&lt;width){ while="" intervel="" is="" less="" than="" width="" of="" the="" window=""&gt;&lt;br /&gt;   drawCircle2(interval-round(random(40,width/2)));&lt;br /&gt;   interval+=round(random(3,70)); }}&lt;br /&gt;The code still works correctly when we run it so this change is ok&lt;br /&gt;The only difference between case 1 and case 3 is the interval variable. We can accomodate this by passing it as a parameter to the repeatShapes function...&lt;br /&gt;It is bow possible to remove all the while loops that use the drawCircles2 Function with the repeatShapes(gap) function. We are left with the while loops that use the drawSquares and drawCircle3 functions. Lets add a new parameter to the repeat shapes function so that we can deal with those cases too.&lt;br /&gt;Right, phew we now have a very versatile repeatShapes function but(theres always a but!) the program takes about a second longer to start. We will ignore this for the moment...&lt;br /&gt;We can remove the noFill() statements for the filled shape cases and replace them with a noFill() statement at the start of the for loop code block.&lt;br /&gt;If the case that makes filled circles didnt change colour so often we might see some more interesting shapes created. I added a 50/50 chance of this happening, to the else statement in the drawShapes method. See if you can work out how this works in the repeatShapes function.&lt;br /&gt;By tweaking and adjusting the repeatShapes function and removing some repetitive code from the case statements, our switch block now looks like this:&lt;br /&gt;switch(design){&lt;br /&gt;   case 1: &lt;br /&gt;          repeatShapes(round(random(3,70)),'2');&lt;br /&gt;          break;&lt;br /&gt;   case 2:                  &lt;br /&gt;         drawCircles(round(random(20,round(random(1,50)))));&lt;br /&gt;      break;&lt;br /&gt;   case 3:&lt;br /&gt;          repeatShapes(round(random(1,width/2)),'2');&lt;br /&gt;      break;&lt;br /&gt;   case 4:&lt;br /&gt;          repeatShapes(width-round(random(2,width/4)),'3');&lt;br /&gt;      break;&lt;br /&gt;   case 5:          //lovely lines!&lt;br /&gt;          doLines();    &lt;br /&gt;   case 6:&lt;br /&gt;         repeatShapes(round(random(2,200)),'5');&lt;br /&gt;         break;&lt;br /&gt;   case 7:&lt;br /&gt;          repeatShapes(round(random(1,40)),'2');&lt;br /&gt;          break;&lt;br /&gt;   case 8:&lt;br /&gt;   default:&lt;br /&gt;           repeatShapes(width-round(random(1,width/2)),'4');      &lt;br /&gt;  }&lt;br /&gt;The one remaining change we could attempt is to do something about the cases where large filled shapes are drawn over the top of our funky patterns. Later in our lessons, we will learn how to use transparent colours, so for the moment lets leave our switch statement as it is.&lt;br /&gt;If you examine the switch block in the getSW function, you may notice something strange... The whole switch block can be replaced by one statement!&lt;br /&gt;The getSW function now looks like this:&lt;br /&gt;&lt;br /&gt;int getSW(){&lt;br /&gt;int fc=round(random(frameRate*500)/5);&lt;br /&gt;return fc%10;&lt;br /&gt;}&lt;br /&gt;Our code is now much leaner ans easier to maintain now and this will help us when we start the next modification which will involve arrays.&lt;/width){&gt;&lt;/width;b=b+round(random(1,20))){&gt;&lt;/patternsperpicture;count++){&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5951246468266182063?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5951246468266182063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/switch-block-first-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5951246468266182063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5951246468266182063'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/switch-block-first-draft.html' title='Switch Block - First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Xfr7yTwHuG4/ST2pSQ39IyI/AAAAAAAAACk/HhQ0EOOK3_Q/s72-c/circle12.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2497403641228868655</id><published>2008-12-08T13:23:00.012Z</published><updated>2008-12-08T15:28:52.959Z</updated><title type='text'>For Loop - First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ST0k9mdwsJI/AAAAAAAAACc/IBHlbGoof20/s1600-h/circle11.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 305px; height: 320px;" src="http://2.bp.blogspot.com/_Xfr7yTwHuG4/ST0k9mdwsJI/AAAAAAAAACc/IBHlbGoof20/s320/circle11.gif" alt="" id="BLOGGER_PHOTO_ID_5277414979064082578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The for loop allows us to specify the number of times a code block will repeat. We use an int type variable to define the loop's iteration. A for loop takes a start value, an exit loop conditional clause and the amount, the looping integer will be changed by, in each iteration of the loop. For loops can be incremented or decremented as the loop is traversed.&lt;br /&gt;It sounds a lot more complex than it is in practice!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;for(int n=0;n==10;n++)    &lt;span style="font-family:arial;"&gt;//starts at 0 - stops at 10 - increments by 1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{             &lt;span style="font-family:arial;"&gt;//code block to be repeated is contained within curly brackets&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    function1(n);&lt;span style="font-family:arial;"&gt;//performs some operation&lt;/span&gt;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;&lt;br /&gt;a=+n;        &lt;span style="font-family:arial;"&gt;//performs some other operation (can contain many statements)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} &lt;span style="font-family:arial;"&gt;             //  for loop ends&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The code block to be executed, need not use the integer that is used in the loop, and can instead, perform some operation, a certain number of times.&lt;br /&gt;The first two statements in the first line of a for loop always end in a semi colon. The first statement initialises the integer, in this example the integer is declared and initialised within the loop, making the integers scope local in the loop. However the integer can be declared elsewhere, thus changing its scope.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int n;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;for (n=10;n &lt;= 100;n=n+10){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  function1(n);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;println("number's final value: "+n);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this next loop the value of for's integer is decreased in each iteration&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;for(int n=10;n &gt; 0;n--){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   println(""+n);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;println("Blast Off!");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Chunk 16 uses a for loop to control how many patterns are used to make a picture:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;for(count=0;count &lt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;patternsPerPicture;count++){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:courier new;"&gt;a great many statements to repeat!}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;As long as count's value, is less than the constant patternsPerPicture the statements in the for loop will execute. Each time the loop is repeated the value of n is increased by one. If we changed the loop to start at one, then we would need to change the conditional to count &lt;=patternsPerPicture+1; When the for loop is finished the value of patternsPerPicture is changed to a random number between 2 and 50, the variables count and design are reset to zero and the for loop is entered again, with the new exit value condition. (patternsPerPicture)   &lt;br /&gt;&lt;br /&gt;Another example of the for loop can be seen in the drawCircles(int) function. Here the value of n is increased by the gap parameter, which is sent by the calling statement. So in each iteration, the drawCircle(int) method is called with n incremented by the value of gap which should produce a larger circle in each repetition of the loop. This for loop stops at a random number between the centre and edge of the display window.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2497403641228868655?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2497403641228868655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/for-loop-first-draft.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2497403641228868655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2497403641228868655'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/for-loop-first-draft.html' title='For Loop - First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Xfr7yTwHuG4/ST0k9mdwsJI/AAAAAAAAACc/IBHlbGoof20/s72-c/circle11.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-246317910150327799</id><published>2008-12-08T00:26:00.004Z</published><updated>2008-12-08T00:47:10.204Z</updated><title type='text'>do While - First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STxruqIvbZI/AAAAAAAAACU/pBRpuI_eQD8/s1600-h/circle10.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 246px; height: 257px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STxruqIvbZI/AAAAAAAAACU/pBRpuI_eQD8/s320/circle10.gif" alt="" id="BLOGGER_PHOTO_ID_5277211312700485010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A do while loop is very much like an upside down while loop. Do while loops are not very popular and are used when we need a block of code to execute at least once. This means that the statement block is executed once before the conditional clause is checked by the program.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The layout of a do while loop has the following structure:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;do{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   do this statement&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   do that statement&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;while(condition)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;do{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   drawCircle();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   drawSquare();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;while(count &lt;&gt;&lt;/pre&gt;We haven't used a do while loop in chunk 16 but this would be very easy to implement if we needed it.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-246317910150327799?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/246317910150327799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/do-while-first-draft.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/246317910150327799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/246317910150327799'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/do-while-first-draft.html' title='do While - First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/STxruqIvbZI/AAAAAAAAACU/pBRpuI_eQD8/s72-c/circle10.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-4019341474512836695</id><published>2008-12-07T23:40:00.006Z</published><updated>2008-12-08T00:12:23.823Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='while'/><category scheme='http://www.blogger.com/atom/ns#' term='chunk16'/><category scheme='http://www.blogger.com/atom/ns#' term='Processing.'/><title type='text'>While Loops - First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STxiO0SVWeI/AAAAAAAAACM/4_9yE5306LA/s1600-h/circle9.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 258px; height: 272px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STxiO0SVWeI/AAAAAAAAACM/4_9yE5306LA/s320/circle9.gif" alt="" id="BLOGGER_PHOTO_ID_5277200870064609762" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;While blocks allow us to repeat a section of code, until a condition or conditions become true or false. The opening clause contains the condition and this is followed by a statement block. Statement blocks, in looping structures, are always enclosed by curly brackets, unless there is only one such statement. Sometimes a while statement is used to increment a simple counter. until it has a certain value.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;while(condition/conditions){do this}//while condition is true do this&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;while(!condition){do this}                           //while not condition do this&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;br /&gt;int count=0;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;while(count &lt; face="courier new="&gt;&lt;br /&gt; callFunction(); //call function&lt;/face="courier&gt;&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;&lt;br /&gt; count++;}       //increase count's value by one&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:georgia;"&gt;Here the loop is repeated 10 times. counts value is increased by one in each iteration of the while loop. It starts with value 0 and stops at value 10. Because count's value must be less than ten in the conditional clause, the statement block is not executed again and the code continues to the next statement, after the while block.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;while(!input==valid){getInput();}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;This will call the getInput() function, until the value of input is equal to the value of valid. (Here valid is probably a boolean variable with a value of true). &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;Examples of while loops in Chunk 16 are on lines: 42, 51 and 57.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;The draw method has a lot of while methods that seem to be performing a similar function. The code looks like it could be optimised. We will try moving out this repetitious code to a function in a later section of Chunk 16.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-4019341474512836695?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/4019341474512836695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/while-loops-first-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4019341474512836695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4019341474512836695'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/while-loops-first-draft.html' title='While Loops - First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/STxiO0SVWeI/AAAAAAAAACM/4_9yE5306LA/s72-c/circle9.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-1605942567775685461</id><published>2008-12-07T13:49:00.009Z</published><updated>2008-12-07T19:20:39.888Z</updated><title type='text'>Loops and the if Statement - First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STwh3rw6h0I/AAAAAAAAACE/TwPa1GQ3DCc/s1600-h/circle8.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 226px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STwh3rw6h0I/AAAAAAAAACE/TwPa1GQ3DCc/s320/circle8.gif" alt="" id="BLOGGER_PHOTO_ID_5277130103895787330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;If there were no loops in our code, then our programs wouldn't last long, or they would have to contain a huge amount of repetitive code.&lt;br /&gt;Looping structures all consist of the same basic format. A conditional statement. followed by the block of code to repeat.&lt;br /&gt;An if statement isnt really a looping construct, but as it follows the same type of format, we will discuss it here.&lt;br /&gt;The basic form of an  if statement is as follows:&lt;br /&gt;if(condition/s){do this}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if(a==10){&lt;/span&gt;         //if a is equal to 10 THEN&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;a=0;} &lt;/span&gt;               //do this&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if(a &gt;=10&amp;amp;&amp;amp;b==100){&lt;/span&gt; //if a is greater than 10 and b has a value of 10 THEN&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;a=0;&lt;/span&gt;              //do this&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;b=0;}&lt;/span&gt;            //and do this&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if(a&gt;=10&amp;amp;&amp;amp;b==100)||(!isEnabled){&lt;/span&gt;//as above OR isEnabled is false&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;a=0;&lt;/span&gt;                                                                                         //do this&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;isEnabled=false;}&lt;/span&gt;                                //and do this&lt;br /&gt;&lt;br /&gt;The functionality of an if block can be extended by adding an else block.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if(a &lt;&gt;        //if a is less than 100 THEN&lt;br /&gt; &lt;span style="font-family:courier new;"&gt;a++;}&lt;/span&gt;             //let a=a+1 (increment a)&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;else{&lt;/span&gt;                 //otherwise (if a is greater or equal to 100)&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; a=0;}&lt;/span&gt;            //do this&lt;br /&gt;&lt;br /&gt;The if statements can be even further extended, with the else if block. You can use as many else if blocks as you like. The else and else if blocks cant be used on their own and must be proceeded by an if statement. Great care should be taken to ensure that the brackets are in the right places.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if(a &lt; face="courier new"&gt;  if(a &lt; =50){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    a=+2;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  else if(a &lt;&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    a++;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;else{a=0;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Examples of using if, else if and else consructs in chunk 16, can be seen on lines 36 and 124.&lt;br /&gt;All looping structures have a conditional statement and an executable block, that is only carried out, if the condtion holds.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-1605942567775685461?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/1605942567775685461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/loops-and-if-statement-first-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1605942567775685461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1605942567775685461'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/loops-and-if-statement-first-draft.html' title='Loops and the if Statement - First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/STwh3rw6h0I/AAAAAAAAACE/TwPa1GQ3DCc/s72-c/circle8.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3903641681908693261</id><published>2008-12-07T13:49:00.006Z</published><updated>2008-12-07T16:06:24.616Z</updated><title type='text'>Functions First Draft</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STv0YwlTHHI/AAAAAAAAAB8/qKxjdAL7yNQ/s1600-h/circle7.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 309px; height: 320px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STv0YwlTHHI/AAAAAAAAAB8/qKxjdAL7yNQ/s320/circle7.gif" alt="" id="BLOGGER_PHOTO_ID_5277080094590049394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Functions are extremely useful structures, that allow us to use the same code in various places, by calling a function's signature. The signature of a function is its first line. If we have a function with the signature:&lt;br /&gt;void drawCircles(int a)&lt;br /&gt;then we call it like so:&lt;br /&gt;drawCircles(400);&lt;br /&gt;If there is a function with the same name but a different signature it is known as an overloaded function:&lt;br /&gt;drawCircles(int a, String col)&lt;br /&gt;we could call the second overloaded function like so:&lt;br /&gt;drawCircles(400, "red");&lt;br /&gt;Code that is repeated frequently is an indication that a function is required. The repetitive portion of the code should be moved into a function with any parameters required. This helps with code reuse, making the program easier to maintain and cuts down the program's length. Any errors/modifications are confined to one place and can be easily corrected.&lt;br /&gt;There are three basic types of functions:&lt;br /&gt;A simple function is usually used to change some global variable's value. It doesn't accept any parameters and returns no value. The changeColour() function line 105 provides us with an example. It has a void return type and empty parameter brackets.&lt;br /&gt;Some functions can be passed messages, informing them of value/s to change or use. drawCircles3(int) on line 118 accepts an integer which it uses to draw a circle, using the ellipses method.&lt;br /&gt;A function can be used to perform some calculation and return a value. These type of functions must contain the return type in their signature. The getSW function on line 135 returns an int value, which can be used to set the stroke width. The signature has type int to denote its return type:&lt;br /&gt;int getSW()&lt;br /&gt;A function can also accept parameters &lt;span style="font-weight: bold;"&gt;and&lt;/span&gt; return a value. We havent used this type of user defined function in chunk 16.&lt;br /&gt;As well as allowing us to create user defined functions, Processing has its own inbuilt functions, which is probably the main reason for using it.&lt;br /&gt;Some builtin Processing functions are:&lt;br /&gt;The size function, accepts two integers, which set the size of the display window in the setup method.&lt;br /&gt;The rect(int, int, int, int) function, accepts four parameters, that are used to draw a rectangle. The first two parameters are the coordinates for the rectangle's position and the remaining values, set the rectangles width and height.&lt;br /&gt;The random function is an overloaded function, because it can accept either one &lt;span style="font-weight: bold;"&gt;or&lt;/span&gt; two parameters. It can return a float or an integer. In chunk 16 we mostly use integers, so we need to round up any floats returned by random. We pass the value returned by the random(int, int) function into the round(float) function to obtain an integer. Examples of using round(random(int, int)) can be found in many places in Chunk16 as it outputs randomized patterns. Some examples of values that are randomised using the random function are: stroke width, colour, height. width, interval and patternsPerPicture.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3903641681908693261?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3903641681908693261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/functions-first-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3903641681908693261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3903641681908693261'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/functions-first-draft.html' title='Functions First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/STv0YwlTHHI/AAAAAAAAAB8/qKxjdAL7yNQ/s72-c/circle7.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-4365818556058749943</id><published>2008-12-07T13:49:00.003Z</published><updated>2008-12-07T14:14:50.239Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='chunk16'/><category scheme='http://www.blogger.com/atom/ns#' term='randomizer'/><category scheme='http://www.blogger.com/atom/ns#' term='variables'/><title type='text'>Variables First Draft</title><content type='html'>In programming everything has to have a unique identifier, the processor will remember the values stored for each variable but will we?&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STvWtJiFPsI/AAAAAAAAAB0/b_qn1OJIF3g/s1600-h/circle6.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: right; cursor: pointer; width: 305px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STvWtJiFPsI/AAAAAAAAAB0/b_qn1OJIF3g/s320/circle6.gif" alt="" id="BLOGGER_PHOTO_ID_5277047459535994562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Giving variables significant names really cuts down on maintenance and the amount of commenting needed. The first character in a name should usually be a letter. Numbers and symbols wont work. An underscore can be used but this should be used to denote special cases. As long as the first character is a letter though, we will not go wrong. Its traditional for normal variables to start with a lowercase letter and to capitalise the first letter of each subsequent word making up the name. e.g.&lt;br /&gt;account&lt;br /&gt;goldAccount&lt;br /&gt;superDuperAccount&lt;br /&gt;This is known as camelCase format&lt;br /&gt;Variable values are usually 'variable' and are changed within the program, but occasionally variables whose values dont change are needed. These are called constants because their value is constant and never changes. Constants are usually uppercase e.g.&lt;br /&gt;MAXROWS&lt;br /&gt;MINHEIGHT&lt;br /&gt;NUMMONSTERS&lt;br /&gt;Later on we will be using a structure known as a class, classes are used to define object types and they should always start with an uppercase letter. e.g:&lt;br /&gt;Shape&lt;br /&gt;Room&lt;br /&gt;Person&lt;br /&gt;We use built in classes to specify each variable's type and the most used types are String, int, float and boolean: e.g.:&lt;br /&gt;String name;&lt;br /&gt;int width;&lt;br /&gt;float amount;&lt;br /&gt;boolean isVisible;&lt;br /&gt;Variable types need to be declared before the program starts. Later their values need to be declared e.g.:&lt;br /&gt;name="circle";&lt;br /&gt;width=800;&lt;br /&gt;They can also be declared and initialised at the same time:&lt;br /&gt;int float=0.01;&lt;br /&gt;boolean isVisible=false;&lt;br /&gt;Giving a variable a value is known as assignment, and always uses the = operator.&lt;br /&gt;You must be very careful if you are comparing values to make sure that you use == and not = as they have very different consequences!&lt;br /&gt;a=6+4; (result 10)&lt;br /&gt;a==6+4 (result true or false-depending on the value of a, if a = 10 then true)&lt;br /&gt;When comparing strings it is usual to use the equals() method for comparison. This is because == will only be true if the strings compared belong to the same object. If we have two strings a and b and they both have the same value then they will not be equal when using ==.&lt;br /&gt;a="value";&lt;br /&gt;b="value";&lt;br /&gt;a==b result is false&lt;br /&gt;a.equals(b) result is true&lt;br /&gt;The scope of a variable affects where it is recognised.&lt;br /&gt;Global variables are declared at the start of the program and can therefore be used in any code block. The variables in lines 11-18 are global.&lt;br /&gt;Variables declared within a code block are known as local variables and are only usable within that block. The local variables declared on lines 33 and 34 are usable at any point within the draw function. None of the other functions are aware of their existence.&lt;br /&gt;Local variables, declared within different blocks, may have the same identifier, but they will refer to different objects.&lt;br /&gt;The integer n in the drawCircles(int) function is declared within a for loop. Line 110. If we were to try using it anywhere outside the for block, it would not be recognised. If we wanted to access its value in the drawCircles(int) function we would need to declare it outside the for block. eg:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;void drawCircles(int gap){&lt;br /&gt;       int n;&lt;br /&gt;       for(n=0;n&amp;lt round(random(width/2,width));n+=gap){&lt;br /&gt;          drawCircle(n);                                }&lt;br /&gt;       println("Final value of n: "+n);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-4365818556058749943?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/4365818556058749943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/variables-first-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4365818556058749943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/4365818556058749943'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/variables-first-draft.html' title='Variables First Draft'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/STvWtJiFPsI/AAAAAAAAAB0/b_qn1OJIF3g/s72-c/circle6.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5268121181070774057</id><published>2008-12-06T13:29:00.008Z</published><updated>2008-12-06T17:45:35.288Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='chunk16'/><category scheme='http://www.blogger.com/atom/ns#' term='contents'/><category scheme='http://www.blogger.com/atom/ns#' term='outline'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='Processing.'/><title type='text'>Outline</title><content type='html'>&lt;span style="font-style: italic;"&gt;The proposed outline of Chunk 16&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STq5qH4cKtI/AAAAAAAAABs/6GpSZEBkkhs/s1600-h/circle5.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 385px; height: 400px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STq5qH4cKtI/AAAAAAAAABs/6GpSZEBkkhs/s320/circle5.gif" alt="" id="BLOGGER_PHOTO_ID_5276734046739376850" border="0" /&gt;&lt;/a&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="gutter"&gt; 1:&lt;/span&gt;&lt;b&gt;Comments&lt;/b&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 2:&lt;/span&gt;  one line&lt;br /&gt;&lt;span class="gutter"&gt; 3:&lt;/span&gt;  many lines&lt;br /&gt;&lt;span class="gutter"&gt; 4:&lt;/span&gt;  placement&lt;br /&gt;&lt;span class="gutterH"&gt; 5:&lt;/span&gt;&lt;b&gt;Variables&lt;/b&gt;&lt;br /&gt;&lt;span class="gutter"&gt; 6:&lt;/span&gt;  Types&lt;br /&gt;&lt;span class="gutter"&gt; 7:&lt;/span&gt;  String&lt;br /&gt;&lt;span class="gutter"&gt; 8:&lt;/span&gt;  int&lt;br /&gt;&lt;span class="gutter"&gt; 9:&lt;/span&gt;  boolean&lt;br /&gt;&lt;span class="gutter"&gt;11:&lt;/span&gt;  naming conventions&lt;br /&gt;&lt;span class="gutter"&gt;12:&lt;/span&gt;  camelCase&lt;br /&gt;&lt;span class="gutter"&gt;13:&lt;/span&gt;  CONSTANTS&lt;br /&gt;&lt;span class="gutter"&gt;14:&lt;/span&gt;  Classes&lt;br /&gt;&lt;span class="gutterH"&gt;15:&lt;/span&gt;  Global&lt;br /&gt;&lt;span class="gutter"&gt;16:&lt;/span&gt;  Local&lt;br /&gt;&lt;span class="gutter"&gt;17:&lt;/span&gt;  Scope&lt;br /&gt;&lt;span class="gutter"&gt;18:&lt;/span&gt;  assignment&lt;br /&gt;&lt;span class="gutter"&gt;19:&lt;/span&gt;  comparison&lt;br /&gt;&lt;span class="gutterH"&gt;20:&lt;/span&gt;&lt;b&gt;Functions&lt;/b&gt;&lt;br /&gt;&lt;span class="gutter"&gt;21:&lt;/span&gt;  void&lt;br /&gt;&lt;span class="gutter"&gt;21:&lt;/span&gt;  calling&lt;br /&gt;&lt;span class="gutter"&gt;22:&lt;/span&gt;  passing messages (parameters)&lt;br /&gt;&lt;span class="gutter"&gt;23:&lt;/span&gt;  return values&lt;br /&gt;&lt;span class="gutter"&gt;24:&lt;/span&gt;  built in functions&lt;br /&gt;&lt;span class="gutterH"&gt;25:&lt;/span&gt;&lt;b&gt;Looping&lt;/b&gt;&lt;br /&gt;&lt;span class="gutter"&gt;26:&lt;/span&gt;  conditional brackets&lt;br /&gt;&lt;span class="gutter"&gt;27:&lt;/span&gt;  code block brackets&lt;br /&gt;&lt;span class="gutter"&gt;28:&lt;/span&gt;  brackets must be nested&lt;br /&gt;&lt;span class="gutter"&gt;29:&lt;/span&gt;  if&lt;br /&gt;&lt;span class="gutterH"&gt;30:&lt;/span&gt;   condition/s&lt;br /&gt;&lt;span class="gutter"&gt;31:&lt;/span&gt;    statement block&lt;br /&gt;&lt;span class="gutter"&gt;32:&lt;/span&gt;    else&lt;br /&gt;&lt;span class="gutter"&gt;33:&lt;/span&gt;    else if&lt;br /&gt;&lt;span class="gutter"&gt;34:&lt;/span&gt;  while&lt;br /&gt;&lt;span class="gutterH"&gt;35:&lt;/span&gt;   condition/s&lt;br /&gt;&lt;span class="gutter"&gt;36:&lt;/span&gt;    statement block&lt;br /&gt;&lt;span class="gutter"&gt;37:&lt;/span&gt;    counter&lt;br /&gt;&lt;span class="gutter"&gt;38:&lt;/span&gt;  do while&lt;br /&gt;&lt;span class="gutter"&gt;39:&lt;/span&gt;    statement block&lt;br /&gt;&lt;span class="gutterH"&gt;40:&lt;/span&gt;    condition/s&lt;br /&gt;&lt;span class="gutter"&gt;41:&lt;/span&gt;   for&lt;br /&gt;&lt;span class="gutter"&gt;42:&lt;/span&gt;     start-until-increment n&lt;br /&gt;&lt;span class="gutter"&gt;43:&lt;/span&gt;     use n&lt;br /&gt;&lt;span class="gutter"&gt;44:&lt;/span&gt;  switch&lt;br /&gt;&lt;span class="gutterH"&gt;45:&lt;/span&gt;    case&lt;br /&gt;&lt;span class="gutter"&gt;46:&lt;/span&gt;    default&lt;br /&gt;&lt;span class="gutter"&gt;47:&lt;/span&gt;    break&lt;br /&gt;&lt;span class="gutter"&gt;48:&lt;/span&gt;    return&lt;br /&gt;&lt;span class="gutter"&gt;49:&lt;/span&gt;&lt;b&gt;Arrays&lt;/b&gt;&lt;br /&gt;&lt;span class="gutterH"&gt;50:&lt;/span&gt;   declaration&lt;br /&gt;&lt;span class="gutter"&gt;51:&lt;/span&gt;    initialising&lt;br /&gt;&lt;span class="gutter"&gt;52:&lt;/span&gt;    using&lt;br /&gt;&lt;span class="gutter"&gt;53:&lt;/span&gt;&lt;b&gt;Chunk 16 workflow&lt;/b&gt;&lt;br /&gt;&lt;span class="gutter"&gt;54:&lt;/span&gt;&lt;b&gt;Modifying Chunk 16&lt;/b&gt;&lt;br /&gt;&lt;span class="gutterH"&gt;55:&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5268121181070774057?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5268121181070774057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/outline.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5268121181070774057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5268121181070774057'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/outline.html' title='Outline'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/STq5qH4cKtI/AAAAAAAAABs/6GpSZEBkkhs/s72-c/circle5.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-2522313898930571758</id><published>2008-12-06T13:29:00.007Z</published><updated>2008-12-06T17:34:37.745Z</updated><title type='text'>Start Draft Chunk16</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STq1FQMeJjI/AAAAAAAAABc/qb9nywvEzyU/s1600-h/circle3.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: right; cursor: pointer; width: 320px; height: 226px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STq1FQMeJjI/AAAAAAAAABc/qb9nywvEzyU/s320/circle3.gif" alt="" id="BLOGGER_PHOTO_ID_5276729015269205554" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;The Chunk 16 application draws a random picture to the screen about every second. It weighs in at a little over 100 lines and can be run as an applet, or an application, by simply clicking on the appropriate link. There is no need to struggle with applet permissions, digitally signing jar files or setting up a jnlp file for Java WebStart. As someone who uses Java on a regular basis, Processing is like a breath of fresh air and I wish I had discovered it sooner! In this chapter we will be looking at the basic construction of a Processing application and it should help clarify the basics of programming, so you are ready to tackle the special powers of Processing. We will just go through each topic and explain the basic syntax.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Comments&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STq2rYqpcKI/AAAAAAAAABk/xkaYGo6mbRs/s1600-h/circle4.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 199px; height: 204px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/STq2rYqpcKI/AAAAAAAAABk/xkaYGo6mbRs/s320/circle4.gif" alt="" id="BLOGGER_PHOTO_ID_5276730769889915042" border="0" /&gt;&lt;/a&gt;If you are anything like me you will want to dive in and get some coding done with as little fuss as possible. This may produce some good work but what happens months later after coding lots of other stuff and you have no recollection of this odd looking code? This is where comments come in.&lt;br /&gt;Comments help explain what is happening in your code and should be used copiously. The five minutes it takes to write them now could save you hours in the future. I am one of the biggest culprits of writing uncommented code, so I know what I'm talking about!&lt;br /&gt;There are three basic types of comments.&lt;br /&gt;// spans one line so this is commented and will be ignored by processing&lt;br /&gt;but this is not and will probably throw an error.&lt;br /&gt;The oyher type&lt;br /&gt;/*spans more than&lt;br /&gt;one line and can contain anything you&lt;br /&gt;like. Iy is very useful for testing if a statement in your code is really needed&lt;br /&gt;and also for commenting out blocks of code you may use later but dont&lt;br /&gt;need at the moment. */end of comment&lt;br /&gt;I have used this on line 63 to comment out a line drawing block. I dont like what it does to the patterns but with a little editing it could maybe be improved. To enable the line drawing just remove the /* at the start and the */ at the end and run it, if you think you can improve it, go ahead, if you will maybe imptove it later then just make it into a comment again, otherwise just delete the block and maybe replace it with something else.&lt;br /&gt;We will not be using the last type of comment as it is usually used to make HTML documentation for Java classes.&lt;br /&gt;/**We have no classes here so we dont use it*/&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-2522313898930571758?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/2522313898930571758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/start-draft-chunk16.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2522313898930571758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/2522313898930571758'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/start-draft-chunk16.html' title='Start Draft Chunk16'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/STq1FQMeJjI/AAAAAAAAABc/qb9nywvEzyU/s72-c/circle3.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-3766773589863034097</id><published>2008-12-05T18:28:00.008Z</published><updated>2008-12-06T12:16:53.370Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='randomizer'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='applet'/><category scheme='http://www.blogger.com/atom/ns#' term='Processing.'/><category scheme='http://www.blogger.com/atom/ns#' term='mass writing'/><title type='text'>Chunk16 - Source Code</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.solundrian.com/randomizer/applet/randomizer.jar"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 289px; height: 292px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STlzq2jFMPI/AAAAAAAAABU/TPKG90-RbkA/s320/circle2.gif" alt="" id="BLOGGER_PHOTO_ID_5276375618475602162" border="0" /&gt;&lt;/a&gt;Thanks to Martin, I downloaded JEdit, this makes it much easier to cut and paste the code. After installing JEdit the plug in manager can install codeToHTML.&lt;br /&gt;JEdit adds line numbers too, so this should also help explain the relevant statements in the text.I cant see there being much changes apart from making the filled circles smaller when they are at the top of the picture.&lt;br /&gt;Clicking on the picture will start the randomizer application (If you have a Java runtime environment installed...)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;STYLE TYPE="text/css"&gt;&lt;!--&lt;br /&gt;.syntax0 {&lt;br /&gt;color: #000000;&lt;br /&gt;}&lt;br /&gt;.syntax1 {&lt;br /&gt;color: #cc0000;&lt;br /&gt;}&lt;br /&gt;.syntax2 {&lt;br /&gt;color: #ff8400;&lt;br /&gt;}&lt;br /&gt;.syntax3 {&lt;br /&gt;color: #6600cc;&lt;br /&gt;}&lt;br /&gt;.syntax4 {&lt;br /&gt;color: #cc6600;&lt;br /&gt;}&lt;br /&gt;.syntax5 {&lt;br /&gt;color: #ff0000;&lt;br /&gt;}&lt;br /&gt;.syntax6 {&lt;br /&gt;color: #9966ff;&lt;br /&gt;}&lt;br /&gt;.syntax7 {&lt;br /&gt;background: #ffffcc;&lt;br /&gt;color: #ff0066;&lt;br /&gt;}&lt;br /&gt;.syntax8 {&lt;br /&gt;color: #006699;&lt;br /&gt;font-weight: bold;&lt;br /&gt;}&lt;br /&gt;.syntax9 {&lt;br /&gt;color: #009966;&lt;br /&gt;font-weight: bold;&lt;br /&gt;}&lt;br /&gt;.syntax10 {&lt;br /&gt;color: #0099ff;&lt;br /&gt;font-weight: bold;&lt;br /&gt;}&lt;br /&gt;.syntax11 {&lt;br /&gt;color: #66ccff;&lt;br /&gt;font-weight: bold;&lt;br /&gt;}&lt;br /&gt;.syntax12 {&lt;br /&gt;color: #02b902;&lt;br /&gt;}&lt;br /&gt;.syntax13 {&lt;br /&gt;color: #ff00cc;&lt;br /&gt;}&lt;br /&gt;.syntax14 {&lt;br /&gt;color: #cc00cc;&lt;br /&gt;}&lt;br /&gt;.syntax15 {&lt;br /&gt;color: #9900cc;&lt;br /&gt;}&lt;br /&gt;.syntax16 {&lt;br /&gt;color: #6600cc;&lt;br /&gt;}&lt;br /&gt;.syntax17 {&lt;br /&gt;color: #0000ff;&lt;br /&gt;}&lt;br /&gt;.syntax18 {&lt;br /&gt;color: #000000;&lt;br /&gt;font-weight: bold;&lt;br /&gt;}&lt;br /&gt;.gutter {&lt;br /&gt;background: #dbdbdb;&lt;br /&gt;color: #000000;&lt;br /&gt;}&lt;br /&gt;.gutterH {&lt;br /&gt;background: #dbdbdb;&lt;br /&gt;color: #990066;&lt;br /&gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;/STYLE&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;&lt;SPAN CLASS="gutter"&gt;  1:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;/*&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  2:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;title:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;Funky&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;Chunk&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;16&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  3:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;description:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;random&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;pattern&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;generator&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  4:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;created:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;December&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;2,&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;2008&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;  5:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;by:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;Rosie&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;Wood&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  6:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;*/&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  7:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  8:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;define&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;Global&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;variable&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;values&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;  9:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;These&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;are&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;constant&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;variables&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;and&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;therefore&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;they&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;are&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;not&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;changed&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 10:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;by&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;program.&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;Setting&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;their&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;value&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;here&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;in&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;one&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;place&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;helps&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;with&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;maimtenance&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 11:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; sizeWindow&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;600&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 12:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; centre&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;sizeWindow&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 13:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; xpos &lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt; centre;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 14:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; ypos &lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt; centre;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 15:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; patternsPerPicture&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;50&lt;/SPAN&gt;));&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 16:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 17:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;this&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;variable&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;is&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;changed&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;frequently&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;by&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;application&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 18:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; interval&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;30&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 19:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 20:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;set&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;sketch&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;window&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;size&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;and&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;background&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 21:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;turn&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;off&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;fill&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;so&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;that&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;patterns&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;underneath&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;can&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;be&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;seen&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 22:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;set&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;rate&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;that&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;screen&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;refreshes&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;at&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;(found&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;this&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;value&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;was&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;best&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;for&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;this&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;application?)&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 23:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax10"&gt;setup&lt;/SPAN&gt;()&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 24:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;size&lt;/SPAN&gt;(sizeWindow, sizeWindow);&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 25:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;background&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 26:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;stroke&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;204&lt;/SPAN&gt;, &lt;SPAN CLASS="syntax5"&gt;102&lt;/SPAN&gt;, &lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;);&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;colour&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;red&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 27:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;noFill&lt;/SPAN&gt;();&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 28:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax6"&gt;frameRate&lt;/SPAN&gt;(.&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 29:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax10"&gt;draw&lt;/SPAN&gt;();&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 30:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 31:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax10"&gt;draw&lt;/SPAN&gt;()&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;  &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 32:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;local&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;variables&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 33:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; count&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 34:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; design&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 35:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;for&lt;/SPAN&gt;(count&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;;count&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;patternsPerPicture;count&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 36:&lt;/SPAN&gt;        &lt;SPAN CLASS="syntax8"&gt;if&lt;/SPAN&gt;(count&lt;SPAN CLASS="syntax18"&gt;%&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;100&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax9"&gt;background&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;); &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;set&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;backgound&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;black&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;sometimes&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 37:&lt;/SPAN&gt;        interval&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;70&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;increment&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;by&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;interval&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;in&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;while&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;loops&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 38:&lt;/SPAN&gt;        &lt;SPAN CLASS="syntax6"&gt;changeColour&lt;/SPAN&gt;();&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 39:&lt;/SPAN&gt;        design&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;9&lt;/SPAN&gt;)); &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;a&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;random&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;numver&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;for&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;which&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;design&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;use&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;in&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;switch&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 40:&lt;/SPAN&gt;        &lt;SPAN CLASS="syntax9"&gt;switch&lt;/SPAN&gt;(design)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 41:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;:         &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 42:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;while&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;intervel&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;is&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;less&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;than&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;of&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;window&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 43:&lt;/SPAN&gt;                &lt;SPAN CLASS="syntax6"&gt;drawCircle2&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;40&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;)));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;call&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;drawCircle2&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;with&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;a&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;random&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;parameter&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 44:&lt;/SPAN&gt;                interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;3&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;70&lt;/SPAN&gt;)); &lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;          &lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 45:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 46:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;:                          &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 47:&lt;/SPAN&gt;                &lt;SPAN CLASS="syntax6"&gt;drawCircles&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;20&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;50&lt;/SPAN&gt;)))));     &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;call&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;drawCircles&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 48:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 49:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;3&lt;/SPAN&gt;:&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 50:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax9"&gt;strokeWeight&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax6"&gt;getSW&lt;/SPAN&gt;());&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;set&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;strokewright&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;number&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;returned&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;by&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;getSW&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 51:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;    &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 52:&lt;/SPAN&gt;               &lt;SPAN CLASS="syntax6"&gt;drawCircle2&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;)));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;use&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;drawCircle2&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 53:&lt;/SPAN&gt;               interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 54:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;    &lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 55:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;4&lt;/SPAN&gt;:&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 56:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax9"&gt;strokeWeight&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax6"&gt;getSW&lt;/SPAN&gt;());&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 57:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;   &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 58:&lt;/SPAN&gt;                 &lt;SPAN CLASS="syntax6"&gt;drawCircle3&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;4&lt;/SPAN&gt;)));&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 59:&lt;/SPAN&gt;                 interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;30&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 60:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 61:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;:                        &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;As&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;this&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;case&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;doesnt&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;have&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;a&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;break&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;it&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;uses&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;same&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;code&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;as&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;case&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;6&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 62:&lt;/SPAN&gt;                                        &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;following&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;code&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;can&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;be&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;uncommented&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;add&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;lines&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;but&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;I&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;dont&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;like&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;them&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;much&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 63:&lt;/SPAN&gt;              &lt;SPAN CLASS="syntax1"&gt;/*&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;strokeWeight(getSW());&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 64:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;for(int&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;b=1;b&amp;lt;width;b=b+round(random(1,20))){&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 65:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;int&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;down=round(random(width/2));&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 66:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;int&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;across=round(random(width/2));&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 67:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;line(xpos,ypos,across-b,down-b);&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 68:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;line(xpos,ypos,across+b+xpos,down-b);&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 69:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;line(xpos,ypos,across-b,width-down+b);&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 70:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;line(xpos,ypos,across+b+xpos,width-down+b);}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 71:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;break;&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 72:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax1"&gt;*/&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 73:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;6&lt;/SPAN&gt;:        &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 74:&lt;/SPAN&gt;              &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;   &lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 75:&lt;/SPAN&gt;              &lt;SPAN CLASS="syntax9"&gt;fill&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;),&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;),&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;)); &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;use&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;a&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;random&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;colour&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;fill&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;circle&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 76:&lt;/SPAN&gt;                 &lt;SPAN CLASS="syntax6"&gt;drawCircle2&lt;/SPAN&gt;(interval);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 77:&lt;/SPAN&gt;                 interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;200&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 78:&lt;/SPAN&gt;              &lt;SPAN CLASS="syntax9"&gt;noFill&lt;/SPAN&gt;();&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;switch&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;off&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;fill&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 79:&lt;/SPAN&gt;            &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 80:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;7&lt;/SPAN&gt;:  &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 81:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 82:&lt;/SPAN&gt;                 &lt;SPAN CLASS="syntax6"&gt;drawCircle2&lt;/SPAN&gt;(interval);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 83:&lt;/SPAN&gt;                 interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;40&lt;/SPAN&gt;);&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 84:&lt;/SPAN&gt;            &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 85:&lt;/SPAN&gt;          &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;8&lt;/SPAN&gt;:&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 86:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;  &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 87:&lt;/SPAN&gt;           &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 88:&lt;/SPAN&gt;                 &lt;SPAN CLASS="syntax9"&gt;fill&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;),&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;),&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;fill&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;squares&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;with&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;a&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;random&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;colour&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 89:&lt;/SPAN&gt;                 &lt;SPAN CLASS="syntax6"&gt;drawSquares&lt;/SPAN&gt;((&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;100&lt;/SPAN&gt;))));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;call&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;drawSquares&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;with&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;a&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;random&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;number&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 90:&lt;/SPAN&gt;                 interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;100&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;400&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;made&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;this&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;interval&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;larger&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;stop&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;filled&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;squares&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;covering&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;over&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;preceeding&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;patterns&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 91:&lt;/SPAN&gt;                 &lt;SPAN CLASS="syntax9"&gt;noFill&lt;/SPAN&gt;();&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 92:&lt;/SPAN&gt;               &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 93:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 94:&lt;/SPAN&gt;           &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;9&lt;/SPAN&gt;:&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt; 95:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;while&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 96:&lt;/SPAN&gt;               &lt;SPAN CLASS="syntax6"&gt;changeColour&lt;/SPAN&gt;();&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 97:&lt;/SPAN&gt;               &lt;SPAN CLASS="syntax6"&gt;drawSquares&lt;/SPAN&gt;(interval&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;)));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;draws&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;unfilled&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;squares&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 98:&lt;/SPAN&gt;               interval&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;20&lt;/SPAN&gt;;&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt; 99:&lt;/SPAN&gt;             &lt;SPAN CLASS="syntax8"&gt;break&lt;/SPAN&gt;;  &lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;100:&lt;/SPAN&gt;         &lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;101:&lt;/SPAN&gt;           patternsPerPicture&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;50&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;change&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;number&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;of&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;patterns&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;for&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;next&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;picture&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;102:&lt;/SPAN&gt;         &lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;103:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;104:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;change&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;the&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;stroke&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;colour&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;doesnt&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;accept&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;parameter&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;and&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;doesnt&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;return&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;anything&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;105:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;changeColour&lt;/SPAN&gt;()&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;106:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;stroke&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;),&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;),&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;107:&lt;/SPAN&gt; &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;108:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;function&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;draws&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;circles&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;accepts&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;parameter&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;gap&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;and&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;uses&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;it&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;to&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;increment&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;loop&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;untill&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;109:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;drawCircles&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; gap)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;110:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax8"&gt;for&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; n&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;0&lt;/SPAN&gt;;n&lt;SPAN CLASS="syntax18"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax14"&gt;width&lt;/SPAN&gt;));n&lt;SPAN CLASS="syntax18"&gt;+&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;gap)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;    &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;111:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax6"&gt;drawCircle&lt;/SPAN&gt;(n);&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;112:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;113:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;no&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;parameters,&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;no&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;return&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;valur&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;114:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;drawCircle2&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; diameter)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;115:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;ellipse&lt;/SPAN&gt;(xpos, ypos, diameter&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,diameter), diameter&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,diameter));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;  &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;116:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;117:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;accepts&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;1&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;parameter&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;118:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;drawCircle3&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; diameter)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;119:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;ellipse&lt;/SPAN&gt;(xpos, ypos, (diameter&lt;SPAN CLASS="syntax18"&gt;*&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,diameter))&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,diameter)&lt;SPAN CLASS="syntax18"&gt;*&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;19&lt;/SPAN&gt;), (diameter&lt;SPAN CLASS="syntax18"&gt;*&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,diameter))&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;,diameter)&lt;SPAN CLASS="syntax18"&gt;*&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;19&lt;/SPAN&gt;) );&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;  &lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;120:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;121:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;drawSquares&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; diameter)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt; &lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;122:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; r&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt; &lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;4&lt;/SPAN&gt;));&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;123:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;if/ifelse/else&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;block&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;124:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax8"&gt;if&lt;/SPAN&gt;(r&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;125:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax9"&gt;rectMode&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax13"&gt;CENTER&lt;/SPAN&gt;);&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;126:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax8"&gt;else&lt;/SPAN&gt; &lt;SPAN CLASS="syntax8"&gt;if&lt;/SPAN&gt;(r&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;127:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax9"&gt;rectMode&lt;/SPAN&gt;(RADIUS);&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;128:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax8"&gt;else&lt;/SPAN&gt; &lt;SPAN CLASS="syntax8"&gt;if&lt;/SPAN&gt;(r&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;3&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;129:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax6"&gt;changeColour&lt;/SPAN&gt;();&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;130:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax8"&gt;else&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;131:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax9"&gt;stroke&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;)),&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;)),&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;)),&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;255&lt;/SPAN&gt;)));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;132:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax9"&gt;rect&lt;/SPAN&gt;(xpos,ypos,diameter,diameter);&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;133:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;134:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;returns&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;integer&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;valur&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;for&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;stroke&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;weight&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;depending&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;on&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;framecount&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;135:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;getSW&lt;/SPAN&gt;()&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;136:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; fc&lt;SPAN CLASS="syntax18"&gt;=&lt;/SPAN&gt;&lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(frameRate&lt;SPAN CLASS="syntax18"&gt;*&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;500&lt;/SPAN&gt;)&lt;SPAN CLASS="syntax18"&gt;/&lt;/SPAN&gt;&lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;137:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax2"&gt;//&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;case&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;statement&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;with&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;default&lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt; &lt;/SPAN&gt;&lt;SPAN CLASS="syntax2"&gt;value&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;138:&lt;/SPAN&gt;    &lt;SPAN CLASS="syntax9"&gt;switch&lt;/SPAN&gt;(fc)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;139:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;140:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;2&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;141:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;3&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;3&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;142:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;4&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;4&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;143:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;5&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;144:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;6&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;6&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;145:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;7&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;7&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;146:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;8&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;8&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;147:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;case&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;9&lt;/SPAN&gt;:&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax5"&gt;9&lt;/SPAN&gt;;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;148:&lt;/SPAN&gt;      &lt;SPAN CLASS="syntax8"&gt;default&lt;/SPAN&gt; :&lt;SPAN CLASS="syntax8"&gt;return&lt;/SPAN&gt; &lt;SPAN CLASS="syntax9"&gt;round&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;random&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax5"&gt;1&lt;/SPAN&gt;,&lt;SPAN CLASS="syntax5"&gt;4&lt;/SPAN&gt;));&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;149:&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutterH"&gt;150:&lt;/SPAN&gt;&lt;SPAN CLASS="syntax8"&gt;void&lt;/SPAN&gt; &lt;SPAN CLASS="syntax6"&gt;drawCircle&lt;/SPAN&gt;(&lt;SPAN CLASS="syntax9"&gt;int&lt;/SPAN&gt; diameter)&lt;SPAN CLASS="syntax18"&gt;{&lt;/SPAN&gt;&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;151:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;ellipse&lt;/SPAN&gt;(xpos, ypos, diameter,  diameter);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;152:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;ellipse&lt;/SPAN&gt;(xpos, ypos, diameter&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;interval,  diameter);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;153:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;ellipse&lt;/SPAN&gt;(xpos, ypos, diameter,  diameter&lt;SPAN CLASS="syntax18"&gt;-&lt;/SPAN&gt;interval);&lt;br /&gt;&lt;SPAN CLASS="gutter"&gt;154:&lt;/SPAN&gt;  &lt;SPAN CLASS="syntax9"&gt;ellipse&lt;/SPAN&gt;(xpos, ypos, diameter,  diameter);&lt;SPAN CLASS="syntax18"&gt;}&lt;/SPAN&gt;&lt;br /&gt;&lt;/PRE&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-3766773589863034097?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/3766773589863034097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk16-source-code.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3766773589863034097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/3766773589863034097'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk16-source-code.html' title='Chunk16 - Source Code'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/STlzq2jFMPI/AAAAAAAAABU/TPKG90-RbkA/s72-c/circle2.gif' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-66897653343348511</id><published>2008-12-05T13:16:00.006Z</published><updated>2008-12-05T14:01:23.087Z</updated><title type='text'>chunk 16 source code</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STkxDctY9hI/AAAAAAAAABM/e34isUWzXIY/s1600-h/circle1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 273px; height: 287px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STkxDctY9hI/AAAAAAAAABM/e34isUWzXIY/s320/circle1.gif" alt="" id="BLOGGER_PHOTO_ID_5276302373757187602" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I tried adding lines and triangles to the application but it was not an improvement. If the lines occurred on the last frame then it just spoiled the patterns underneath. Without using trigonometry to calculate the points on the outer circle the triangles just looked like scribbles. This would also have meant more lines of code.&lt;br /&gt;The code as it stands comes to 101 lines. This is after cramping up some code so it fits on one line e.g.&lt;br /&gt;if(condition){statement}&lt;br /&gt;instead of:&lt;br /&gt;if(condition){&lt;br /&gt;          statement}&lt;br /&gt;When I write code, I tend not to spread out brackets, so they line up. I try to ensure that statements line up properly, in blocks and if there is a problem with loops, it is easy to line up the brackets to trace errors. This is just my personal preference and the code could be ammended for other formatting tastes...&lt;br /&gt;Here is the uncommented source code as it stands at the moment. It may be changed a little over the coming weeks but I dont see there being any major changes. My next post will contain the commented code and then I will begin the text for chunk 16.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int sizeWindow=600;&lt;br /&gt;int centre=sizeWindow/2;&lt;br /&gt;int xpos = centre;&lt;br /&gt;int ypos = centre;&lt;br /&gt;int interval=30;&lt;br /&gt;void setup(){&lt;br /&gt; size(sizeWindow, sizeWindow);&lt;br /&gt; background(0);&lt;br /&gt; stroke(204, 102, 0);//colour red&lt;br /&gt; noFill();&lt;br /&gt; frameRate(.2);&lt;br /&gt; draw();}&lt;br /&gt;void draw(){ &lt;br /&gt;     int count=0;&lt;br /&gt;     int design=0;&lt;br /&gt;     for(count=0;count &lt; round(random(10,width));count++){&lt;br /&gt;       if(count%100==0)background(0);&lt;br /&gt;       println(design);&lt;br /&gt;       interval=round(random(5,70));&lt;br /&gt;       changeColour();&lt;br /&gt;       design=round(random(1,9));   &lt;br /&gt;       switch(design){&lt;br /&gt;         case 1:        &lt;br /&gt;            while(interval &lt; width){ &lt;br /&gt;               drawCircle2(interval-round(random(40,width/2)));//500/400&lt;br /&gt;               interval+=round(random(3,70)); }         &lt;br /&gt;            break;&lt;br /&gt;         case 2:drawCircles(round(random(20,round(random(1,50)))));    &lt;br /&gt;            break;&lt;br /&gt;         case 3:&lt;br /&gt;         strokeWeight(getSW());&lt;br /&gt;            while(interval &lt; width){   &lt;br /&gt;              drawCircle2(interval-round(random(1,width/2)));&lt;br /&gt;              interval+=round(random(1,width/2));}&lt;br /&gt;            break;   &lt;br /&gt;         case 4:&lt;br /&gt;         strokeWeight(getSW());&lt;br /&gt;            while(interval &lt; width){  &lt;br /&gt;                drawCircle2(interval-round(random(2,width/4)));&lt;br /&gt;                interval+=round(random(1,30));}&lt;br /&gt;            break;&lt;br /&gt;         case 5:&lt;br /&gt;         case 6:       &lt;br /&gt;             while(interval &lt; width){  &lt;br /&gt;             fill(random(255),random(255),random(255));&lt;br /&gt;                drawCircle2(interval);&lt;br /&gt;                interval+=20;}&lt;br /&gt;             noFill();&lt;br /&gt;           break;&lt;br /&gt;         case 7: &lt;br /&gt;            while(interval &lt; width){&lt;br /&gt;                drawCircle2(interval);&lt;br /&gt;                interval+=random(1,40);}&lt;br /&gt;           break;&lt;br /&gt;         case 8:&lt;br /&gt;            changeColour();&lt;br /&gt;            while(interval &lt; width){  &lt;br /&gt;                drawSquares(interval-(width+round(random(1,10))));&lt;br /&gt;                interval+=round(random(1,50));}&lt;br /&gt;            break;&lt;br /&gt;          case 9:&lt;br /&gt;            while(interval &lt; width){&lt;br /&gt;              changeColour();&lt;br /&gt;              drawSquares(interval-round(random(1,width/2)));&lt;br /&gt;              interval+=20;}&lt;br /&gt;            changeColour();&lt;br /&gt;            drawSquares(interval-width+(round(random(1,10))));&lt;br /&gt;            break;}}}     &lt;br /&gt;void changeColour(){&lt;br /&gt; stroke(random(255),random(255),random(255));}     &lt;br /&gt;void drawCircles(int gap){&lt;br /&gt; for(int n=0;n &lt; sizeWindow;n+=gap){    drawCircle(n);}}&lt;br /&gt;void drawCircle2(int diameter){&lt;br /&gt; ellipse(xpos, ypos, diameter-random(5,diameter), diameter-random(5,diameter));} &lt;br /&gt;void drawCircle3(int diameter){&lt;br /&gt; ellipse(xpos, ypos, diameter-interval,  diameter+interval);} &lt;br /&gt;void drawSquares(int diameter){&lt;br /&gt; int r= round(random(1,4));&lt;br /&gt; if(r==1){rectMode(CENTER);}&lt;br /&gt; else if(r==2){rectMode(RADIUS);}&lt;br /&gt; else if(r==3){changeColour();}&lt;br /&gt; else{stroke(round(random(255)),round(random(255)),round(random(255)),round random(255)));}&lt;br /&gt;   rect(xpos,ypos,diameter,diameter);}&lt;br /&gt;int getSW(){&lt;br /&gt;   int fc=round(random(frameRate*500)/5);&lt;br /&gt;   switch(fc){&lt;br /&gt;     case 1:return 1;&lt;br /&gt;     case 2:return 2;&lt;br /&gt;     case 3:return 3;&lt;br /&gt;     case 4:return 4;&lt;br /&gt;     case 5:return 5;&lt;br /&gt;     case 6:return 6;&lt;br /&gt;     case 7:return 7;&lt;br /&gt;     case 8:return 8;&lt;br /&gt;     case 9:return 9;&lt;br /&gt;     default :return round(random(1,4));}}&lt;br /&gt;void drawCircle(int diameter){&lt;br /&gt; ellipse(xpos, ypos, diameter,  diameter);&lt;br /&gt; ellipse(xpos, ypos, diameter-interval,  diameter);&lt;br /&gt; ellipse(xpos, ypos, diameter,  diameter-interval);&lt;br /&gt; ellipse(xpos, ypos, diameter,  diameter);}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-66897653343348511?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/66897653343348511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk-16-source-code.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/66897653343348511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/66897653343348511'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/chunk-16-source-code.html' title='chunk 16 source code'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/STkxDctY9hI/AAAAAAAAABM/e34isUWzXIY/s72-c/circle1.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-7601569444942682991</id><published>2008-12-04T20:58:00.000Z</published><updated>2008-12-04T21:19:48.150Z</updated><title type='text'>funky chunk 16 version 2</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SThGx6kR9-I/AAAAAAAAABE/5NZQtwAmUNk/s1600-h/circles3.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 312px; height: 320px;" src="http://3.bp.blogspot.com/_Xfr7yTwHuG4/SThGx6kR9-I/AAAAAAAAABE/5NZQtwAmUNk/s320/circles3.gif" alt="" id="BLOGGER_PHOTO_ID_5276044786813499362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The first version of the program was ok but the code was a bit of a mess. I edited the code and made one of the case statements do random fills. I'm really not sure if this is an improvement or not.&lt;br /&gt;I must admit that maths and me dont speak to each other , unless really necessary. Some of the drawings in version 1 looked mathematically unsound to me, so I 'tweaked' them a bit. Some of the code was taking more away from the number than possible but no errors were thrown and they seemed to work. After editing a bit, the maths look better but there seems to be less "shimmer".&lt;br /&gt;The old version can be viewed as an applet &lt;a href="http://www.solundrian.com/procs/randomizer/applet/index.html"&gt;here&lt;/a&gt; or launched as a standalone application straight from &lt;a href="http://www.solundrian.com/procs/randomizer/applet/randomizer.jar"&gt;here&lt;/a&gt;.&lt;br /&gt;The new version can be viewed as an applet &lt;a href="http://www.solundrian.com/randomizer/applet/index.html"&gt;here&lt;/a&gt; or launched as a standalone application straight from &lt;a href="http://www.solundrian.com/randomizer/applet/randomizer.jar"&gt;here&lt;/a&gt;.&lt;br /&gt;I think its amazing how easy it is to launch a standalone application! You just need to link to the jar file and it runs on the clients pc. They can even choose to download the application and run it whenever they like offline.!&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-7601569444942682991?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/7601569444942682991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/funky-chunk-16-version-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7601569444942682991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7601569444942682991'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/funky-chunk-16-version-2.html' title='funky chunk 16 version 2'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Xfr7yTwHuG4/SThGx6kR9-I/AAAAAAAAABE/5NZQtwAmUNk/s72-c/circles3.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-9120260131643888665</id><published>2008-12-03T12:39:00.000Z</published><updated>2008-12-04T20:57:23.005Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='randomizer'/><category scheme='http://www.blogger.com/atom/ns#' term='applet'/><category scheme='http://www.blogger.com/atom/ns#' term='ellipses'/><category scheme='http://www.blogger.com/atom/ns#' term='Processing.'/><title type='text'>So Simple to Program!</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SThEDoerjaI/AAAAAAAAAA8/iNF3pQdRkCQ/s1600-h/nine.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 316px; height: 320px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/SThEDoerjaI/AAAAAAAAAA8/iNF3pQdRkCQ/s320/nine.gif" alt="" id="BLOGGER_PHOTO_ID_5276041792660934050" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I coded the basic outline of the program for chunk 16. This only took a few hours to write and its amazing the amount of work achieved with very little research.&lt;br /&gt;The code is in a right mess and needs to be commented and edited.&lt;br /&gt;I will need to ensure that it conforms to the 100 lines constraint.&lt;br /&gt;I dont think the comments are included in the line count but I will check.&lt;br /&gt;The application draws a random pattern about every second. Colour, stroke weight and pattern function are completely randomized and this makes the application very interesting to watch. I could end up looking at it for hours!&lt;br /&gt;The code is very simple and I have tried to keep it consistent with what the user will know after reading up to page 192.&lt;br /&gt;I have only used the ellipses and rect functions so far but I may add some triangle and line functions if they are an improvement.&lt;br /&gt;I discovered that the content of the draw function is drawn to the screen when the function has ended and I couldnt find an easy way of drawing a line at a time, that would fit in with the rest of the application.&lt;br /&gt;This is no great disadvantage, as by using a for next loop the program can run many functions before each frame is drawn to the screen.&lt;br /&gt;I couldn't get over how easy it was to put the program up on my web site. The viewers can watch the applet, run the standalone application or download a copy of the standalone, so they can run it totally separate from a browser and offline.&lt;br /&gt;The applet runs with no problems in Internet Explorer but there is a permission problem when using FireFox. I'm not sure if this could be a problem with an absolute URL as it objects to host 'solundrian.com'.  I'll try fixing this today...&lt;br /&gt;I think it will be quite easy at some point to adjust the application, allowing the user to save some of their favourite pics so they can be viewed later.&lt;br /&gt;You can see the finished randomizer &lt;a href="http://www.solundrian.com/procs/randomizer/applet/index.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-9120260131643888665?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/9120260131643888665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/so-simple-to-program.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/9120260131643888665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/9120260131643888665'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/so-simple-to-program.html' title='So Simple to Program!'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/SThEDoerjaI/AAAAAAAAAA8/iNF3pQdRkCQ/s72-c/nine.gif' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-6853276769850907994</id><published>2008-12-01T13:34:00.000Z</published><updated>2008-12-01T14:38:10.407Z</updated><title type='text'>drawCircles</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STPrM8OrHgI/AAAAAAAAAAc/Pw18lLe8LJw/s1600-h/circles2_1.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 305px; height: 320px;" src="http://4.bp.blogspot.com/_Xfr7yTwHuG4/STPrM8OrHgI/AAAAAAAAAAc/Pw18lLe8LJw/s320/circles2_1.gif" alt="" id="BLOGGER_PHOTO_ID_5274818196139613698" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I started working on the program for chunk 16.&lt;br /&gt;Functions to change colour randomly, draw a circle and draw a set of circles were written.&lt;br /&gt;I have run into an unexpected problem:&lt;br /&gt;When drawing the circles I wanted a slight pause between each iteration.&lt;br /&gt;This would acheive a hypnotic affect as each circle changes colour.&lt;br /&gt;Instead the circles are all changing colour at the same time.&lt;br /&gt;I even tried using threads but this was unsuccessful too.&lt;br /&gt;I tried redrawing the circles and found what Greenberg terms as a "happy accident". By changing one of the diameters an interesting variation on plain circles was discovered.&lt;br /&gt;I also played with changing the stroke weight but again there is no pause between each change.&lt;br /&gt;I think &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STPr5N_bBtI/AAAAAAAAAAk/Q7LWTp0KsmE/s1600-h/circles2.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 149px; height: 157px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STPr5N_bBtI/AAAAAAAAAAk/Q7LWTp0KsmE/s320/circles2.gif" alt="" id="BLOGGER_PHOTO_ID_5274818956821726930" border="0" /&gt;&lt;/a&gt;I will need to read a little more of the book to find a solution to this problem.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;By using the 'pre' tag, it is easy to cut and paste the code from processing into the blog, but lesser/greater than needs to be changed to '&amp; noSpaces lt/&amp;noSpaces gt' and some spurious errors must be edited.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// define Global variable values&lt;br /&gt;//set centre for circles&lt;br /&gt;int sizeWindow=300;&lt;br /&gt;int max=1000;&lt;br /&gt;int centre=sizeWindow/2;&lt;br /&gt;int xpos = centre;&lt;br /&gt;int ypos = centre;&lt;br /&gt;int maxDiameter=sizeWindow;&lt;br /&gt;int interval=30;&lt;br /&gt;&lt;br /&gt;// set the sketch window size and background&lt;br /&gt;void setup(){&lt;br /&gt;size(sizeWindow, sizeWindow);&lt;br /&gt;background(0);&lt;br /&gt;stroke(204, 102, 0);//colour red&lt;br /&gt;noFill();&lt;br /&gt;frameRate(.3);&lt;br /&gt;draw();}&lt;br /&gt;&lt;br /&gt;void draw(){ &lt;br /&gt;     changeColour();     &lt;br /&gt;     drawCircles(interval);}       &lt;br /&gt;&lt;br /&gt;void changeColour(){&lt;br /&gt; stroke(random(255),random(255),random(255));&lt;br /&gt;}&lt;br /&gt;    &lt;br /&gt;void drawCircles(int gap){&lt;br /&gt; for(int n=0;n&amp;lt maxdiameter;n+=gap){ &lt;br /&gt;    drawCircle(n);}}&lt;br /&gt;&lt;br /&gt;//create ellipse&lt;br /&gt;void drawCircle(int diameter){&lt;br /&gt;  sw="1;&lt;br /&gt;  // while(sw&lt;=10){&lt;br /&gt;  // strokeWeight(sw);       &lt;br /&gt;  ellipse(xpos, ypos, diameter,  diameter);   &lt;br /&gt;  ellipse(xpos, ypos, diameter-interval,  diameter);  &lt;br /&gt;  ellipse(xpos, ypos, diameter,  diameter-interval);   &lt;br /&gt;  ellipse(xpos, ypos, diameter,  diameter);  &lt;br /&gt;  // sw+=1;  } &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-6853276769850907994?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/6853276769850907994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/12/drawcircles.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6853276769850907994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/6853276769850907994'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/12/drawcircles.html' title='drawCircles'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xfr7yTwHuG4/STPrM8OrHgI/AAAAAAAAAAc/Pw18lLe8LJw/s72-c/circles2_1.gif' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-7591371079976764614</id><published>2008-11-28T16:11:00.000Z</published><updated>2008-11-28T17:04:49.159Z</updated><title type='text'>Starting to Process</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STAkgXmRoRI/AAAAAAAAAAU/ds451iH0IBU/s1600-h/circles1.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 276px; height: 303px;" src="http://1.bp.blogspot.com/_Xfr7yTwHuG4/STAkgXmRoRI/AAAAAAAAAAU/ds451iH0IBU/s320/circles1.gif" alt="" id="BLOGGER_PHOTO_ID_5273755302159819026" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I finally managed to pick up the book from Waterstones.&lt;br /&gt;I am basically playing with the program but thinking along the lines of explaining the basic programming concepts in Processing.&lt;br /&gt;To start with, I thought I would look at a very simple program that involves a lot of repetition and cant easily be extended.&lt;br /&gt;&lt;br /&gt;//create ellipses&lt;br /&gt;ellipse(xpos, ypos, 10,  10);&lt;br /&gt;ellipse(xpos, ypos, 20, 20);&lt;br /&gt;ellipse(xpos, ypos, 30, 30);&lt;br /&gt;ellipse(xpos, ypos, 40, 40);&lt;br /&gt;ellipse(xpos, ypos, 50, 50);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code could first be moved to a function with no return value.&lt;br /&gt;A for next loop could could be used to specify the diameter of the circle.&lt;br /&gt;An if statement could be used to stop the loop when the diameter is greater than the height/width of window.&lt;br /&gt;This could be replaced with a while loop and later by a do while loop.&lt;br /&gt;A hypnotical effect could be produced by changing the colour of the stroke as it draws each circle.&lt;br /&gt;It could be demonstrated how easy it is to change all the circles by changing only one value eg stroke weight/gap etc.&lt;br /&gt;Finally a function that accepts parameters and returns an array of circles could be demonstrated.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-7591371079976764614?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/7591371079976764614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/11/starting-to-process.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7591371079976764614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/7591371079976764614'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/11/starting-to-process.html' title='Starting to Process'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xfr7yTwHuG4/STAkgXmRoRI/AAAAAAAAAAU/ds451iH0IBU/s72-c/circles1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-1748827694846608568</id><published>2008-11-18T10:11:00.000Z</published><updated>2008-11-18T10:17:14.894Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='virus'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='XOR'/><title type='text'>Java Virus - Help Please</title><content type='html'>I have picked up a really nasty virus that is showing huge squares in all my Java applications.&lt;br /&gt;It uses an applet I think and may use XOR bits. Ive been trying to fix it for the last 2 days. I've ran about every software tool imaginable, deleted old java versions and trawled the web, but still no joy.&lt;br /&gt;If anyone knows how to clean this up, please get in touch!&lt;br /&gt;email: codecoaster@googlemail.com&lt;br /&gt;&lt;br /&gt;Rosie&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-1748827694846608568?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/1748827694846608568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/11/java-virus-help-please.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1748827694846608568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/1748827694846608568'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/11/java-virus-help-please.html' title='Java Virus - Help Please'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-5990682691682447237</id><published>2008-11-16T13:18:00.000Z</published><updated>2008-11-16T14:26:19.627Z</updated><title type='text'>Aargh - No OU Library</title><content type='html'>Reading through some blogs from other Mass Writing authors, it came to my attention that "the book" was available in the OU online library - Safari book section. Great News! I love the Safari facility,having used it for years to research a vast array of technical subjects.&lt;br /&gt;I logged into student home and went to the Safari section. Up came the "You are not authorised" message. Oh no! Why did I go and graduate! Tears hair out. How on earth can I preserve my street cred, when I dont even have access to the information I need, when I need it.&lt;br /&gt;To hubby: "Any chance of an early Xmas present".....&lt;br /&gt;Reply: "As long as it isnt another book".....&lt;br /&gt;I went to the &lt;a href="http://safari.oreilly.com/"&gt;Safari Books Online&lt;/a&gt; site intending to set up a subscription. Good Grief! &lt;span&gt;$252.99 per year + VAT ... for the limited to 10 books option.&lt;br /&gt;Not today, thank you very much!&lt;br /&gt;I know this would sound like a bargain, to someone in paid work, but at the moment I cant justify this expense.  &lt;br /&gt;I will just have to pick up my hard copy and suffer the indignity of wearing glasses(when I can find them) and actually manually turning pages!&lt;br /&gt;I'm sure I received an offer of a subscription to the &lt;a href="http://www.acm.org/membership/benefits"&gt;ACM digital library&lt;/a&gt; that included subscription to &lt;a href="http://www.skillsoft.com/Books24x7/Subscriptions_and_Pricing/Individual.asp"&gt;24/7&lt;/a&gt; too, hmm...&lt;br /&gt;Wow, I looked up the link for ACM and it seems they are offering subscription to Safari, 24/7 and Skillsoft courses as part of their Professional Membership package. To join you need to have a BSc or have worked for 2 years in the IT industry. The price of the whole package is only $99, which is within my budget for a xmas present!&lt;br /&gt;So OU students enjoy your wonderful free library while you can!&lt;br /&gt;I hope the 600 books from Safari includes "the book"!&lt;br /&gt;Oh well have to go order a library!&lt;br /&gt;Back when I get a copy of the book&lt;br /&gt;Sorry, this post might be a bit off topic but it might help someone&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-5990682691682447237?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/5990682691682447237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/11/aargh-no-ou-library.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5990682691682447237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/5990682691682447237'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/11/aargh-no-ou-library.html' title='Aargh - No OU Library'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-128928392953659508</id><published>2008-10-22T15:03:00.000+01:00</published><updated>2008-10-22T15:26:15.546+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Waterstones'/><category scheme='http://www.blogger.com/atom/ns#' term='Processing.'/><title type='text'>Processing and Blogs</title><content type='html'>I downloaded the Processing IDE and had a look at the examples.&lt;br /&gt;I was very pleased to learn you can generate applets and applications at the click of a button. There is some way to use the generated code in standard Java programs too, but I havent had time to check this out yet.&lt;br /&gt;Some of the graphics in processing are amazing but I do worry that the coding necessary, may be beyond my limited capabilities.&lt;br /&gt;The Processing IDE can use some pretty nifty libraries, and seems to make Glide and 3D graphics a lot easier to implement.&lt;br /&gt;I went to Waterstones to order the book and the very helpful assistant explained delivery might take 2-3 weeks. When I explained what it was for he put it in as a special order and this might speed it up a little. The book cost 37.99 so I only had to contribute 2.99.&lt;br /&gt;I received the First Mailing from Darrel, and will have a look at the links there shortly. I added the links for the Mass Writing Blogs, to FireFox's FastDial plugin. This will make it easy to find them later.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-128928392953659508?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/128928392953659508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/10/processing-and-blogs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/128928392953659508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/128928392953659508'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/10/processing-and-blogs.html' title='Processing and Blogs'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6667097412706957271.post-8710834360351493335</id><published>2008-10-17T17:55:00.000+01:00</published><updated>2008-10-17T18:56:14.882+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='guinness book'/><category scheme='http://www.blogger.com/atom/ns#' term='solundria'/><category scheme='http://www.blogger.com/atom/ns#' term='record'/><category scheme='http://www.blogger.com/atom/ns#' term='mass writing'/><title type='text'>Making a Start</title><content type='html'>I have done a fair amount of Java Programming and have used the Graphics class a fair bit, but this area of Java was mostly self taught. My introduction to Java graphics was the Timothy Budd course book for M301.&lt;br /&gt;I have researched various graphic concepts in the past, but I always come back to the standard Java awt graphics package because of its simplicity.  I have been intending to start using the Graphics 2D class, as I think I understand most of its methods.&lt;br /&gt;Maths is something I studied way back in MU120, but trigonometry and algebra are now just a foggy memory. This is a pity as I think they would make some interesting effects.&lt;br /&gt;I have a web site where my Java RPG Game &lt;a href="http://www.solundrian.com"&gt;Solundria&lt;/a&gt; can be launched with Web Start. The game is in serious need of a graphical makeover, so I am hoping that the study of Processing may help me accomplish this.&lt;br /&gt;I put a blog post up on &lt;a href="http://www.38minutes.co.uk/profile/RosieWood"&gt;my page&lt;/a&gt; on 38 minutes (a digital Media Web Site) about the OU record attempt. &lt;br /&gt;I did a bit of browsing and started to read a sample chapter of the Processing book, but it seemed to time out or something. The Processing methods were not as bad as I had expected and I cant wait for the book voucher to arrive, so I can try some new stuff out.&lt;br /&gt;Its maybe a forlorn hope but I'd like to make some kind of business when I eventually (if ever...) finish Solundria. I will have to examine the licence for the Processing classes as they are Open Source. Even if they cant be used in my game some of the methods are very similar to Java, so I think it will still be a worthwhile learning experience.&lt;div class="blogger-post-footer"&gt;http://www.solundrian.com
FREE Java RPG game&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6667097412706957271-8710834360351493335?l=rwoublog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rwoublog.blogspot.com/feeds/8710834360351493335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rwoublog.blogspot.com/2008/10/making-start.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8710834360351493335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6667097412706957271/posts/default/8710834360351493335'/><link rel='alternate' type='text/html' href='http://rwoublog.blogspot.com/2008/10/making-start.html' title='Making a Start'/><author><name>CodeCoaster</name><uri>http://www.blogger.com/profile/14315478939824269137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_Xfr7yTwHuG4/SUFluEQuRuI/AAAAAAAAADY/wHhWJJQaRp4/S220/me7.JPG'/></author><thr:total>0</thr:total></entry></feed>
