tag:blogger.com,1999:blog-66670974127069572712024-03-06T06:16:06.111+00:00OU Mass Writing - Rosie WoodCodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.comBlogger63125tag:blogger.com,1999:blog-6667097412706957271.post-87173798736414492472010-10-14T12:47:00.003+01:002010-10-14T12:52:24.060+01:00Tapulla Release on Android Market<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfBfx_qppnNfkRwR6T-LNwLxzWoYo5T5iyoIpa5ZWY09lFoXqbv_z6UWp4ScNuUIFJZLzviMLCcraepyRatAe426LvtncX_1zKKUUCb7C4mtN72dmYdCgOCAKyeZ2BaGmtJ88pxjOmEFQ/s1600/lev2.png"><img style="cursor: pointer; width: 120px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfBfx_qppnNfkRwR6T-LNwLxzWoYo5T5iyoIpa5ZWY09lFoXqbv_z6UWp4ScNuUIFJZLzviMLCcraepyRatAe426LvtncX_1zKKUUCb7C4mtN72dmYdCgOCAKyeZ2BaGmtJ88pxjOmEFQ/s200/lev2.png" alt="" id="BLOGGER_PHOTO_ID_5527867915828273826" border="0" /></a><br />After much fun and hard work, I am proud to announce that I have released a game on the Android Market!<br />It was written using Processing's Android Tool<br />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.<br />Tapulla only costs 2 pounds and is well worth it! (Well, I would say that wouldn't I :))<br />More levels free on next update too!<br />More info on the <a href="http://solundria.com/">website</a><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-29316239623470764372010-06-03T09:51:00.003+01:002010-06-03T10:57:07.302+01:00Processing in Android - Very DesirableMy chunks for the OU book are finally done and I posted the last errata today...phew!<br /> 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.<br /> 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.<br /> 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.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij7vSDU2_4CpV0NZrZYfAUoLC2ZHj1CHa_eZE5-s_vCepmqEm4yWrFkgeBpiPUCQ6L0EVVPeeyx7hOrx6iG94i93doK_p05UKWfEvEcf1YIMSf-a3QbHbyb-rdH_FFgcQ-y_mUUZVFJBI/s1600/c16.png"><img style="cursor: pointer; width: 200px; height: 142px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij7vSDU2_4CpV0NZrZYfAUoLC2ZHj1CHa_eZE5-s_vCepmqEm4yWrFkgeBpiPUCQ6L0EVVPeeyx7hOrx6iG94i93doK_p05UKWfEvEcf1YIMSf-a3QbHbyb-rdH_FFgcQ-y_mUUZVFJBI/s200/c16.png" alt="" id="BLOGGER_PHOTO_ID_5478483148911127346" border="0" /></a><br /><span style="font-style: italic;">Chunk 16 on Android Emulator</span><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-21251526003249773832010-01-05T10:12:00.018+00:002010-01-18T14:29:36.052+00:00Chunk 55I will be completing Chunk 55 which explains how polynomials can be used to draw different types of curves in Processing.<br />The<a href="http://barrymasswriting.blogspot.com/2008/10/introducing-polynomials.html"> introduction to polynomials</a> 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.<br /><br /><span style="font-weight: bold;">Text for Chunk 55</span> <span style="font-style: italic;">following Barry's introduction.</span><br /><br />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)<br />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 <span style="font-weight: bold;">3</span>.<br />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.<br />Monomial expressions have only one term, binomials have 2 and trinomials 3.<br />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.<br />Polynomials of 2 degrees are called quadratics<br />Polynomials of 3 degrees are called cubics<br />Polynomials of 4 degrees are called quartics<br />Polynomials of 5 degrees are called quintics<br />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.<br />Polynomials with an <span style="font-weight: bold;">even numbered degree</span> in their leading term, always enter and leave in the <span style="font-weight: bold;">same direction</span>. ie up or down. Therefore, quadratic polynomials are always parabolas.<br />If the <span style="font-weight: bold;">coefficient is even</span>, then the curve will enter and leave at the top of the graph and if the<span style="font-weight: bold;"> coefficient is odd,</span> it will enter and leave at the bottom.<br />Polynomials with an <span style="font-weight: bold;">odd numbered degree</span> in their leading term, however, have curves that start and end in<span style="font-weight: bold;"> opposite directions</span>. An <span style="font-weight: bold;">odd numbered</span> leading degree with a <span style="font-weight: bold;">positive coefficient,</span> will have a curve that starts at the bottom and exits at the top, while a <span style="font-weight: bold;">negative coefficient,</span> will have its starting curve coming in from the top and exiting at the bottom.<br />To plot <span style="font-weight: bold;">quadratic polynomials</span>, 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.<br />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.<br />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.<br />An example quadratic such as:<br /><span style="font-style: italic;">y=</span> <span style="font-style: italic;">6xsquared-7x+10</span> In Processing is written as:<br /><span style="font-style: italic;">y= 6* pow(x, 2)-7*x + 10;<br />We know that the Processing display screen's coordinates start at the upper left corner,<br />which is the opposite of a Cartesion Grid's layout, therefore we plot x and y with the statement: </span>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<br />to place the curves centrally in our display window. The ratio uses our maximum coEfficient to<br />calculate the spacing for our plots. As our maximum coEfficient is 50 we work out the scale with<br />the statement:<br /><span style="font-size:85%;"><span style="font-family:courier new;">float ratio = height/(50*pow(loopLimit-1, 2)-50*loopLimit-1 + 100);</span></span><br /><span style="font-style: italic;">The statements: </span><span style="font-family:courier new;">for (int i=-xShift; i<loopLimit; i++){</span> <span style="font-family:courier new;">y = coEfficient* pow(x, 2)-7*x + 1;</span> <span style="font-family:courier new;">point(x+xShift, yShift-y*ratio);</span> <span style="font-family:courier new;">}</span><br />would draw one curve with plots of x and y for our chosen quadratic expression.<br /><span>In this sketch, we will replace the leading term's coEfficient, with a variable between 2 and 50, in a for next loop. </span><span>This will give us a graph of nested parabolas with a variable coEfficient.<br />A</span><span>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.</span><span style="font-style: italic;"><span style="font-style: italic;"><br /></span><br /></span><span style="font-family:arial;"><span style="font-style: italic;"><span style="font-style: italic;"><span style="font-family:courier new;"></span></span></span></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgSeN0Eh_pwrIjYhxRLC8CqfLH4K_7nEl8je6KMKDGxlc2nRTlLPmK7Nr0XXbXC15_XfS76mp6TsVgsbm5UFvkfyR1MAxpfWk5vnRWTqCiDDNqmloIW3J_1I9oJxrHrNmHb5uHrmX5ZEQ/s1600-h/yup.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 298px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgSeN0Eh_pwrIjYhxRLC8CqfLH4K_7nEl8je6KMKDGxlc2nRTlLPmK7Nr0XXbXC15_XfS76mp6TsVgsbm5UFvkfyR1MAxpfWk5vnRWTqCiDDNqmloIW3J_1I9oJxrHrNmHb5uHrmX5ZEQ/s320/yup.png" alt="" id="BLOGGER_PHOTO_ID_5425639264890899938" border="0" /></a><br /> <span style="font-style: italic;">graph of </span><span style="font-style: italic;">y=</span> <span style="font-style: italic;">coEfficient*xsquared-7x+10</span><br /> where coEfficient=2 To 50<br />When we add a plot of a quadratic parabola, with a negative coefficient in its leading term, we end up with this graph:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA4FxsrwnG6cDXyol-F2Op4Nlnc687p7-k8x2JJmX7AQOf1NCkCkuM-21HHkVsaQRRodm_8Jsb9hNKmThRfHw7xOHLCm6xJyj7G-Q8P5xQcZNdu8CcdYnD1yr3jUexDGmyiYjIyYF9vyM/s1600-h/ydown.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 298px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA4FxsrwnG6cDXyol-F2Op4Nlnc687p7-k8x2JJmX7AQOf1NCkCkuM-21HHkVsaQRRodm_8Jsb9hNKmThRfHw7xOHLCm6xJyj7G-Q8P5xQcZNdu8CcdYnD1yr3jUexDGmyiYjIyYF9vyM/s320/ydown.png" alt="" id="BLOGGER_PHOTO_ID_5425651927247727330" border="0" /></a><br /><span style="font-style: italic;"> graph of </span><span style="font-style: italic;">y=</span> <span style="font-style: italic;">coEfficient*xsquared-7x+10</span> and <br /><span style="font-style: italic;"> </span><span style="font-style: italic;">y=</span> -<span style="font-style: italic;">coEfficient*xsquared-7x+10</span><br /><br /><span style="font-weight: bold; font-style: italic;">Code for final quadratic sketch:</span><br />/*author: Rosie Wood<br />January 2010*/<br />size(400, 400);<br />background(255);<br />strokeWeight(3);<br />float x = 0, y = 0;<br />int loopLimit = 200;<br />//shifts curve to the right<br />int xShift = width/2;<br />int yShift = height/2;<br />/*As explained in Greenberg if magic numbers are used, the curves can<br />be too large for the display window. He used the<br />polynomial and plugged in the loop limit to get the maximum. This<br />way if the window size changes, the program should still work.<br />In this sketch I have tried to get a ratio that will work as long<br />as the leading term's coEfficient is <=50 the second term coefficient<br />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<br />although the beginning and end of the curves could be outwith the<br />boundaries of the display window*/<br />float ratio = height/(50*pow(loopLimit-1, 2)-50*loopLimit-1 + 100);<br />int coEfficient=0;<br />for(coEfficient=2;coEfficient<50;coEfficient++){<br />stroke(random(255),random(255),random(255));<br />for (int i=-xShift; i<loopLimit; i++){<br /><br />x = i;<br />/*Here the coefficient of the leading term is positive so the parabola<br />should enter and leave at the top*/<br /><br />y = coEfficient* pow(x, 2)-7*x + 1;<br />point(x+xShift, yShift-y*ratio);<br />/*Here the coefficient of the leading term is negative so the parabola<br />should enter and leave at the bottom*/<br /><br />y = -coEfficient* pow(x, 2)-7*x + 1;<br />point(x+xShift, yShift-y*ratio);<br />}}<br /><br /><span style="font-weight: bold;">Cubic Polynomials<br /></span>When graphing polynomials, the maximum number of bumps is equal to the degree of the polynomial-1. i.e. n-1<span style="font-weight: bold;"> ,</span><span> where n =the degree of the leading term</span><span style="font-weight: bold;">. </span><br />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).<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbVjHqCdTAX5dx6lEYau18d0O0fpAsuS2B7FtOpwqV576pfcrebvG2NJ_R9NcBhb83ewyvw01MwKgVlrdFvaEFBe3DFWWOamLDwrUCnC32_7c-seYwSFXOk1gKbCNNNn05hiFsZC1eGDo/s1600-h/cubic.png"><img style="cursor: pointer; width: 186px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbVjHqCdTAX5dx6lEYau18d0O0fpAsuS2B7FtOpwqV576pfcrebvG2NJ_R9NcBhb83ewyvw01MwKgVlrdFvaEFBe3DFWWOamLDwrUCnC32_7c-seYwSFXOk1gKbCNNNn05hiFsZC1eGDo/s200/cubic.png" alt="" id="BLOGGER_PHOTO_ID_5426559407718132674" border="0" /></a><br /><span style="font-size:85%;"><span style="font-style: italic;">Cubic Polynomial with a </span></span><span style="font-size:85%;"><span style="font-style: italic;"> </span></span><span style="font-size:85%;"><br /><span style="font-style: italic;">positive coefficient in it's </span></span><span style="font-size:85%;"><br /><span style="font-style: italic;">leading term.</span></span><span style="font-style: italic;"><br /></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhypRmMexSlug0-p9TqVfU6ulJxFx7Zdp38sI1Eczz5ZE7Z6PveVOWcFLbnV_hkcEjJsmZD3B7kFDLtsXEAtR-GdERK0ByE8aa1zUu6QI7uLH4nIYf8LNvk8eV9_TTf2MQ3aCm_H7CzEgk/s1600-h/cubic3.png"><img style="cursor: pointer; width: 186px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhypRmMexSlug0-p9TqVfU6ulJxFx7Zdp38sI1Eczz5ZE7Z6PveVOWcFLbnV_hkcEjJsmZD3B7kFDLtsXEAtR-GdERK0ByE8aa1zUu6QI7uLH4nIYf8LNvk8eV9_TTf2MQ3aCm_H7CzEgk/s200/cubic3.png" alt="" id="BLOGGER_PHOTO_ID_5426560187741116850" border="0" /></a><br /><span style="font-size:85%;"><span style="font-style: italic;">Cubic Polynomial with a</span></span><br /><span style="font-size:85%;"><span style="font-style: italic;">negative coefficient in it's</span></span><br /> <span style="font-size:85%;"><span style="font-style: italic;">leading term.</span></span> <span style="font-style: italic;font-size:85%;" > </span><span style="font-style: italic;"><br /></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQlO3vxnuS7Jpm48VMHTVNdeK5Yev0KrtzPNr1Z4PTNLxAy53t_lH41M7C5GalRMt1NAHhXYJBB4AeQgtaVEWez7-pmK_DxQrLi3qNzunVxeW9iG1w1l5SxAKeAxVkQO_Q85QdJEY8QRc/s1600-h/cubic2.png"><img style="cursor: pointer; width: 186px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQlO3vxnuS7Jpm48VMHTVNdeK5Yev0KrtzPNr1Z4PTNLxAy53t_lH41M7C5GalRMt1NAHhXYJBB4AeQgtaVEWez7-pmK_DxQrLi3qNzunVxeW9iG1w1l5SxAKeAxVkQO_Q85QdJEY8QRc/s200/cubic2.png" alt="" id="BLOGGER_PHOTO_ID_5426560466483022738" border="0" /></a><br /><span style="font-size:85%;"><span style="font-style: italic;">This sketch shows both types<br />of polynomials</span></span><span style="font-size:85%;"><span style="font-style: italic;"> together. </span></span><br /><span style="font-style: italic;"><br />To be co</span><span style="font-style: italic;">n</span><span style="font-style: italic;">t</span><span style="font-style: italic;">i</span><span style="font-style: italic;">nued......</span><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com1tag:blogger.com,1999:blog-6667097412706957271.post-8800542204917925302009-08-19T16:16:00.003+01:002009-08-19T16:25:24.781+01:00Unwanted AdsI 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!<br /><br />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!<br /><br />Also the advert that has, "Look how good I look at 'my age'". I dont go online to be subjected to catty comments.:p<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-37811596997530273852009-08-11T17:42:00.002+01:002009-08-11T17:59:23.966+01:00Fingers CrossedI'm hoping that Darrel has managed to edit Chunk 16 OK as the last I heard there were some problems....gulp<br />I do think that a live forum would have made communication easier on the project.<br />Is it alright to put some of the applets on our own sites?<br />If we don't include the source code, I think it would help sales of the forthcoming OU Processing book. <br />I don't know about the rest of you, but I really miss writing for my OU Processing blog...<br />I've been busy trying to do search optimization on <a href="http://www.solundrian.com/">Solundria</a><br />I know this is a shameless plug but there's a lot of good content there! Honest...<br />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.<br />Details are available in this blog somewhere.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com1tag:blogger.com,1999:blog-6667097412706957271.post-82744936979244146682009-05-27T23:09:00.003+01:002009-05-27T23:16:26.435+01:00Chunk 16 - Product LineZazzle.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.<br />I intend adding some more products and will perhaps use Chunk 46 images too.<br />Watch this space for more funky chunky products!<br /><br /><embed src="http://www.zazzle.co.uk/utl/getpanel?tl=codecoaster%27s%20Store%20at%20Zazzle&ch=codecoaster&at=238119637416211284&st=POPULARITY" flashvars="path=http://www.zazzle.co.uk/assets/swf/zp/skins" wmode="transparent" type="application/x-shockwave-flash" width="450" height="300"></embed><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-22223047112537094582009-04-08T17:08:00.004+01:002009-04-08T18:33:15.702+01:00Mix Up<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwZyroOUoSRzbxy9G36u19nO7cRbdtN1dNI2F9Eta_tqQnzkNeg7PRwSsvjX58wdaSG9hkm_ke-r1Z_a9DiRHTqZrxAWCnt_B0CC13V9QVYvS1EsmMjBwRh6Q_on90p0nuBfGYtzLnouU/s1600-h/mix7.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 152px; height: 152px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwZyroOUoSRzbxy9G36u19nO7cRbdtN1dNI2F9Eta_tqQnzkNeg7PRwSsvjX58wdaSG9hkm_ke-r1Z_a9DiRHTqZrxAWCnt_B0CC13V9QVYvS1EsmMjBwRh6Q_on90p0nuBfGYtzLnouU/s320/mix7.gif" alt="" id="BLOGGER_PHOTO_ID_5322353894984084498" border="0" /></a>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.<br /></p> <p> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ8ndWXwpGNnsaPSmzkp6XeMfI59f09VyErxehOdrGBsXoioXofjwWvhyphenhyphenFQQnIkiztg8Uoa7LI-k_mWYo-C0PXSuPo0a3gWcqiXrxcyBwv4sLZYVQsRD2S0kABlw_5JanvVt0zbC9zDoI/s1600-h/mix30.gif"><img style="cursor: pointer; width: 131px; height: 131px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ8ndWXwpGNnsaPSmzkp6XeMfI59f09VyErxehOdrGBsXoioXofjwWvhyphenhyphenFQQnIkiztg8Uoa7LI-k_mWYo-C0PXSuPo0a3gWcqiXrxcyBwv4sLZYVQsRD2S0kABlw_5JanvVt0zbC9zDoI/s320/mix30.gif" alt="" id="BLOGGER_PHOTO_ID_5322355471099937762" border="0" /></a>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.:<br /> save("name"+n+".gif");<br />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:<br />if(n==20)exit();<br />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.<br />Next we write a simple sketch to use the Chunk46 images as a mask on the Chunk 16 images. (or vica versa)<br /><br />Here is the code for the masking program:<br /><span style="font-size:85%;"><span style="font-family:courier new;">int n=0;</span> <span style="font-family:courier new;">void setup(){</span> <span style="font-family:courier new;">size(700, 700);</span> <span style="font-family:courier new;">frameRate(.2);</span> <span style="font-family:courier new;">}</span> <span style="font-family:courier new;">void draw(){</span> <span style="font-family:courier new;">n++;</span> <span style="font-family:courier new;">if(n>50)n=0;</span> <span style="font-family:courier new;">PImage img = loadImage("c"+n+".jpg");</span> <span style="font-family:courier new;">PImage i= loadImage("line"+n+".gif");</span> <span style="font-family:courier new;">//PImage img= loadImage("line20.gif");</span> <span style="font-family:courier new;">image(i, 0, 0, 700, 700);</span> <span style="font-family:courier new;">filter(GRAY);</span> <span style="font-family:courier new;">loadPixels();</span> <span style="font-family:courier new;">img.mask(pixels);</span> <span style="font-family:courier new;">image(img, 0, 0, 700, 700);</span> <span style="font-family:courier new;">save("mix"+n+".gif");</span> <span style="font-family:courier new;">}</span></span></p><p>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. </p><p>The new images will be saved in the new sketch's folder.</p><p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCUobGMSaXurT5RDll-YtbmrZXvWl7qqQT_83XF0iXtlWiajEB_dOo7eHELulvpdzhhhUAdoUhwU3PwexF-ZDr2iNN2l7-K67UEYYulHdwIhGG2Eu58L_UXz3Ka8BPQ2aFJ7WfOjkRKhE/s1600-h/mix13.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCUobGMSaXurT5RDll-YtbmrZXvWl7qqQT_83XF0iXtlWiajEB_dOo7eHELulvpdzhhhUAdoUhwU3PwexF-ZDr2iNN2l7-K67UEYYulHdwIhGG2Eu58L_UXz3Ka8BPQ2aFJ7WfOjkRKhE/s400/mix13.gif" alt="" id="BLOGGER_PHOTO_ID_5322374670740137026" border="0" /></a></p><p><br /></p><p> </p> <p> </p><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com1tag:blogger.com,1999:blog-6667097412706957271.post-19641244119684726212009-04-04T20:49:00.004+01:002009-04-04T20:57:22.733+01:00Chunk 46 - Program CompletedThe 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.<br /><object width="400" height="300"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4004230&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=ff9933&fullscreen=1"><embed src="http://vimeo.com/moogaloop.swf?clip_id=4004230&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=ff9933&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="http://vimeo.com/4004230">Chunk 46 - HeadLines</a> from <a href="http://vimeo.com/user1140029">Rosie Wood</a> on <a href="http://vimeo.com/">Vimeo</a>.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-53573944260710326362009-04-04T15:07:00.013+01:002009-04-04T16:14:26.844+01:00Chunk 46 - Optional ModificationsThis 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.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEialwZMiIKGWDfYtpPdJbHcdmRCnw25UAlFWHhBjn87AqqaKdB878wHiAsjfLNcsciTbkY_U6jFlTvSRB8y4-r3tV3xOCkhHoNkpIANsqnkA2tfCW6XGiY9RT-OeFGAbmGetBXqsY800t4/s1600-h/line13.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEialwZMiIKGWDfYtpPdJbHcdmRCnw25UAlFWHhBjn87AqqaKdB878wHiAsjfLNcsciTbkY_U6jFlTvSRB8y4-r3tV3xOCkhHoNkpIANsqnkA2tfCW6XGiY9RT-OeFGAbmGetBXqsY800t4/s200/line13.gif" alt="" id="BLOGGER_PHOTO_ID_5320838828798863746" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtLB2uwxlAvqQ1gmV4BF1zJDP-naDH-FS4W62-cF-rsqFVzrYLBWJaHwgaPA931UKgI1FDwBMFDG7ralqPDmkThPD6p9hyyIec9mgdhvCWHkmW9On3l4DPUx-Fp1OGNQZcqBlzBY1MRw/s1600-h/line5.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtLB2uwxlAvqQ1gmV4BF1zJDP-naDH-FS4W62-cF-rsqFVzrYLBWJaHwgaPA931UKgI1FDwBMFDG7ralqPDmkThPD6p9hyyIec9mgdhvCWHkmW9On3l4DPUx-Fp1OGNQZcqBlzBY1MRw/s200/line5.gif" alt="" id="BLOGGER_PHOTO_ID_5320838056805993746" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMo4p24NGxSaWa6EarFxxLRncIdkqt8zhq-J1RozgbkJTlO7UrKTzhhdqFebqqcDKmXcOvM9PBYVM9HU5pk5Hc33-ivWlUggRjyu8ziC2C7TC6J_O9O5bTOj5ivqbU9wacKDaIfi5E-GQ/s1600-h/line12.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMo4p24NGxSaWa6EarFxxLRncIdkqt8zhq-J1RozgbkJTlO7UrKTzhhdqFebqqcDKmXcOvM9PBYVM9HU5pk5Hc33-ivWlUggRjyu8ziC2C7TC6J_O9O5bTOj5ivqbU9wacKDaIfi5E-GQ/s200/line12.gif" alt="" id="BLOGGER_PHOTO_ID_5320838396188066530" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgErMk3kqYK7pypCkVWkfyhE_vwV-1b5b0lGKy-eCupNTX_ZAgGqZAI_AWjhhbgL7jJC7A37ajfceXKJUx9cDCKLny4wnURlb1zm2SgvO3qOeNFuCLnLW08ThtP8VI2GPu-rOocnL5-g3g/s1600-h/line22.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgErMk3kqYK7pypCkVWkfyhE_vwV-1b5b0lGKy-eCupNTX_ZAgGqZAI_AWjhhbgL7jJC7A37ajfceXKJUx9cDCKLny4wnURlb1zm2SgvO3qOeNFuCLnLW08ThtP8VI2GPu-rOocnL5-g3g/s200/line22.gif" alt="" id="BLOGGER_PHOTO_ID_5320842830052109954" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhT7IrIRsxWTPVl3pz7fBDD2NBs30YBECF6kRYUQI6rGkvQqKpwzzSbS5NI30RNGq08N0-HhlavnBH91lgOx5GhEUya-TAQOTl8fu0fX-UtVhFAcfEKCe0teUe3D0oIB90oT6Q9XfJZEYc/s1600-h/line15.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhT7IrIRsxWTPVl3pz7fBDD2NBs30YBECF6kRYUQI6rGkvQqKpwzzSbS5NI30RNGq08N0-HhlavnBH91lgOx5GhEUya-TAQOTl8fu0fX-UtVhFAcfEKCe0teUe3D0oIB90oT6Q9XfJZEYc/s200/line15.gif" alt="" id="BLOGGER_PHOTO_ID_5320841417526132802" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGZGufH_RZXjKcYaTvzlXPEcgNbd1mp5HwRLdf54VM0JsaWtHAp-9ZomE04rswUwZBhSyNgjYbLjZrSh422_xK5qFbjSZNwkKvxjDCD3qwSzHwUomazXbQFm_wjqLJFazh5qrtqFXi1e4/s1600-h/line16.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGZGufH_RZXjKcYaTvzlXPEcgNbd1mp5HwRLdf54VM0JsaWtHAp-9ZomE04rswUwZBhSyNgjYbLjZrSh422_xK5qFbjSZNwkKvxjDCD3qwSzHwUomazXbQFm_wjqLJFazh5qrtqFXi1e4/s200/line16.gif" alt="" id="BLOGGER_PHOTO_ID_5320840811034678338" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimWlF6rT6nq8a0lzMGddNNS64XHfroXRwYoXk_ck-umkbfIBVhODwHG_-ML4NupHKEO3kIiMGVqGo0VAkCNapXVJKT7RNlaQLcVjj3E_xH03FWexS8HvhgjiBgig26zj0wTdFDW70W9T8/s1600-h/line40.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimWlF6rT6nq8a0lzMGddNNS64XHfroXRwYoXk_ck-umkbfIBVhODwHG_-ML4NupHKEO3kIiMGVqGo0VAkCNapXVJKT7RNlaQLcVjj3E_xH03FWexS8HvhgjiBgig26zj0wTdFDW70W9T8/s200/line40.gif" alt="" id="BLOGGER_PHOTO_ID_5320846633560616530" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLUMk_OnGd826QgV4LlkjYWXz9Op6hwbKhUysoWXXK0SM3I1Re42SggEe1yp6DAUIkAPD0vId7qHfZgw2M1Tmdo-NTE9hVxxEFtOqMMZEAKs0CSXyrbCrvCiaAvqkbP301uOT4kwQmlCY/s1600-h/line37.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLUMk_OnGd826QgV4LlkjYWXz9Op6hwbKhUysoWXXK0SM3I1Re42SggEe1yp6DAUIkAPD0vId7qHfZgw2M1Tmdo-NTE9hVxxEFtOqMMZEAKs0CSXyrbCrvCiaAvqkbP301uOT4kwQmlCY/s200/line37.gif" alt="" id="BLOGGER_PHOTO_ID_5320844932330647666" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPTSFfyjCwsnofDWl7r7-jAbyByyEHkjJZe92bcnC99o0vrnFBlCxNg4z7FGhygTJ4v08gRLcXF0sHYuvnFoR3pFt07AdzfUaZWzlVfKwWMgoSC44CqviKEQALPPHfzBJwRPupm2nIXis/s1600-h/line36.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPTSFfyjCwsnofDWl7r7-jAbyByyEHkjJZe92bcnC99o0vrnFBlCxNg4z7FGhygTJ4v08gRLcXF0sHYuvnFoR3pFt07AdzfUaZWzlVfKwWMgoSC44CqviKEQALPPHfzBJwRPupm2nIXis/s200/line36.gif" alt="" id="BLOGGER_PHOTO_ID_5320845315758705410" border="0" /></a>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 <a href="http://www.solundrian.com/procs/forLoop.pde">THE CODE</a> .<br />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.<br />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!<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-73276969851456494382009-04-03T15:33:00.007+01:002009-04-04T14:27:25.197+01:00Ch46 - An Array of Difficult ChoicesAfter careful consideration of how to implement the choices available for pattern 7 we decide to use an array to hold the available choices.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC6IPZ_N-IOvxwqOXvagbdtUYdQgP1uiw8nv20_WO1CFhOLId4RqUTMCQdqZba8Bj0NAY2QSX3cA7ADfjGFxPMrC25o8wd7d8QGngOdxwQBzZIEwkf-t1wt6jsmb3Pc6PnXdJvQB0K5d4/s1600-h/line41.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC6IPZ_N-IOvxwqOXvagbdtUYdQgP1uiw8nv20_WO1CFhOLId4RqUTMCQdqZba8Bj0NAY2QSX3cA7ADfjGFxPMrC25o8wd7d8QGngOdxwQBzZIEwkf-t1wt6jsmb3Pc6PnXdJvQB0K5d4/s200/line41.gif" alt="" id="BLOGGER_PHOTO_ID_5320474611439118258" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZaYIs0zR1nbjbUKZfqfNVlZwh7trA1BrXRs8gzOOMY6FxUNIJBuH8KhDLCTmFh25LTuJCJp59OZn9m9P_VtKEkDA2FsBQliOJJXN39zPLcQM8O8epfSGDYGGepRqZ-mzIMWIYmKbSHs4/s1600-h/line21.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZaYIs0zR1nbjbUKZfqfNVlZwh7trA1BrXRs8gzOOMY6FxUNIJBuH8KhDLCTmFh25LTuJCJp59OZn9m9P_VtKEkDA2FsBQliOJJXN39zPLcQM8O8epfSGDYGGepRqZ-mzIMWIYmKbSHs4/s200/line21.gif" alt="" id="BLOGGER_PHOTO_ID_5320473969418222946" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdopGo3M9GmY-Jo-MpyZD8XgaMqRdlwMawixv46vqUKwRkWGKVD3UlLevWL_RThrlVWoxCidEnpJPmepIpVJxw6zXSqsd6DvCpkNVu9B7Ci44si54bT0fl1JLsGMX52uxrTsGXXEvekH0/s1600-h/line28.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdopGo3M9GmY-Jo-MpyZD8XgaMqRdlwMawixv46vqUKwRkWGKVD3UlLevWL_RThrlVWoxCidEnpJPmepIpVJxw6zXSqsd6DvCpkNVu9B7Ci44si54bT0fl1JLsGMX52uxrTsGXXEvekH0/s200/line28.gif" alt="" id="BLOGGER_PHOTO_ID_5320474210376894914" border="0" /></a>boolean [] segments={false,false,false,false,false,false,false,false};<br />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.<br /><br /><span style="font-size:85%;"><span style="font-family:courier new;">void oops(){</span><br /><span style="font-family:courier new;"> resetSegs();</span><br /><span style="font-family:courier new;"> for(int n=0;n<8;n++){</span><br /><span style="font-family:courier new;"> if(round(random(1))==0){segments[n]=true;} </span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;"> println(segments);</span><br /><span style="font-family:courier new;"> if(segments[0]==true){</span><br /><span style="font-family:courier new;"> line(0,height-y,y,y);}//oopsleft down</span><br /><span style="font-family:courier new;"> if(segments[1]==true){</span><br /><span style="font-family:courier new;"> line(width-x,0,x,x);}//oopsup right</span><br /><span style="font-family:courier new;"> if(segments[2]==true){</span><br /><span style="font-family:courier new;"> line(x,0,width-x,x);}//oopsup left</span><br /><span style="font-family:courier new;"> if(segments[3]==true){</span><br /><span style="font-family:courier new;"> line(width,y,y,height-y);}//oopsright down</span><br /><span style="font-family:courier new;"> if(segments[4]==true){</span><br /><span style="font-family:courier new;"> line(width,height-y,y,y);}//oopsrightup</span><br /><span style="font-family:courier new;"> if(segments[5]==true){</span><br /><span style="font-family:courier new;"> line(width-x,height,x,x);}//oopsdown left</span><br /><span style="font-family:courier new;"> if(segments[6]==true){</span><br /><span style="font-family:courier new;"> line(x,height,width-x,x);}//oopsdown right</span><br /><span style="font-family:courier new;"> if(segments[7]==true){</span><br /><span style="font-family:courier new;"> line(0,y,y,height-y);}//oopsleft up</span><br /><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;">void resetSegs(){</span><br /><span style="font-family:courier new;"> for(int n=0;n<segments.length;n++){><span style="font-size:85%;"><br /><span style="font-family:courier new;"> segments[n]=false;</span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;">}</span><br /></span><span style=";font-family:georgia;font-size:100%;" >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:<br /></span><span style=";font-family:courier new;font-size:100%;" ><span style="font-size:85%;">while(count<patsperpic){</span><span style=";font-family:courier new;font-size:100%;" ><span style="font-size:85%;"><br /><span style="font-weight: bold;">resetSegs();</span><br /><span style="font-weight: bold;"> for(int n=0;n<8;n++){</span><br /><span style="font-weight: bold;"> if(round(random(1))==0){segments[n]=true;} </span><br /><span style="font-weight: bold;"> }</span><br />changeColour();</span><br /></span><span style="font-family:verdana;">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...</span><br /><span style="font-family:verdana;">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.<br /><a href="http://www.solundrian.com/procs/ch46.pde">Example Source Code</a> with space for 2 new patterns<br />The next section is optional and involves adding new patterns from another program's for loop.<br /></span><br /></span></span></span><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-80783144710528173752009-04-02T20:44:00.009+01:002009-04-03T16:47:21.041+01:00Chunk 46 - StructureIn this section we will move our patterns into functions and decide how each function will control the symmetry of its own pattern.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipIxjanBuAi5i-Bu2uBtEbCP57WCrrq0w42cOxvm6hnQPSn-gMGvJJ63dDNT-sut3xc7kHa2U66Fne5swRKC00PEjzx6BLV9d3rzbrm6hrnUFjXn_HL5yJm4EKyEPuX3UhoTB1nByMGGM/s1600-h/line43.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipIxjanBuAi5i-Bu2uBtEbCP57WCrrq0w42cOxvm6hnQPSn-gMGvJJ63dDNT-sut3xc7kHa2U66Fne5swRKC00PEjzx6BLV9d3rzbrm6hrnUFjXn_HL5yJm4EKyEPuX3UhoTB1nByMGGM/s200/line43.gif" alt="" id="BLOGGER_PHOTO_ID_5320415920388110002" border="0" /></a><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO8paxzI3JZxQ_j1M_2RaLF1Qnd6PTFDQiWpJSO4j3OBSjZtrH0QdRspGrubuywxkHTGPfpF1zpy_GWwKaB82S3UZ9TVzsv6PPNcjPXs5XR6IY3ESIX13JT2T9YAAwAAuVyu2hnh1z2nY/s1600-h/line35.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO8paxzI3JZxQ_j1M_2RaLF1Qnd6PTFDQiWpJSO4j3OBSjZtrH0QdRspGrubuywxkHTGPfpF1zpy_GWwKaB82S3UZ9TVzsv6PPNcjPXs5XR6IY3ESIX13JT2T9YAAwAAuVyu2hnh1z2nY/s200/line35.gif" alt="" id="BLOGGER_PHOTO_ID_5320189899158643618" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuRKxmmqF2pTQIw9FLsDdQ0ENAEdOLEP6RgXluoxZzi-zg3nXWkeotIKkkjZ76zOnEnvjqD56XHy9OKEzjuGiQodyQZHKHcKEMHYjjDaiDOmIgSVTsBNVF9D7McwFDMEqy6e3E5-aLa_I/s1600-h/line38.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuRKxmmqF2pTQIw9FLsDdQ0ENAEdOLEP6RgXluoxZzi-zg3nXWkeotIKkkjZ76zOnEnvjqD56XHy9OKEzjuGiQodyQZHKHcKEMHYjjDaiDOmIgSVTsBNVF9D7McwFDMEqy6e3E5-aLa_I/s200/line38.gif" alt="" id="BLOGGER_PHOTO_ID_5320190137526033682" border="0" /></a></div>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.<br />Here is a list of the variables we might end up with:<br /><br /><span style="font-size:85%;"><span style="font-family:courier new;">int numLines=20;//changing this controls the amount of lines in a statement</span><br /><span style="font-family:courier new;">int stepH=0; //used in for loop for vertical steps</span><br /><span style="font-family:courier new;">int stepW=0; //used in for loop for horizontal steps</span><br /><span style="font-family:courier new;">int n=0; //allows the value of n to be accessed from the functions</span><br /><span style="font-family:courier new;">int x=0; //horizontal step </span><br /><span style="font-family:courier new;">int y=0; // vertical step</span><br /><span style="font-family:courier new;">int rannum=0; //a random number between 0 and 2</span><br /><span style="font-family:courier new;">int design=1; //an integer to identify the case statement to execute</span><br /><span style="font-family:courier new;">int count=0; //used to compare with the number of patterns per picture</span><br /><span style="font-family:courier new;">int drawCount=0; //counts how many patterns have been displayed so far</span><br /></span><br />Here is the basic structure of the application:<br /><br /><span style="font-size:85%;"><span style="font-family:courier new;">void setup(){</span><br /><span style="font-family:courier new;"> size(400, 400);</span><br /><span style="font-family:courier new;"> stepH=height/numLines;</span><br /><span style="font-family:courier new;"> stepW=width/numLines;</span><br /><span style="font-family:courier new;"> strokeWeight(1);</span><br /><span style="font-family:courier new;"> smooth();</span><br /><span style="font-family:courier new;"> frameRate(30);</span><br /><span style="font-family:courier new;">}</span><br /><br /><span style="font-family:courier new;">void draw(){</span><br /><span style="font-family:courier new;"> patsPerPic=round(random(2,7));</span><br /><span style="font-family:courier new;"> background(0);</span><br /><span style="font-family:courier new;"> count=0;</span><br /><span style="font-family:courier new;"> n=0;</span><br /><span style="font-family:courier new;"> while(count&ltpatsperpic){><br /><span style="font-family:courier new;"> changeColour();</span><br /><span style="font-family:courier new;"> rannum=round(random(2));</span><br /><span style="font-family:courier new;"> design=round(random(2));<br /><pre><br /><code><br />for(x=0;x <width+1;x=x+stepw){<br />for y=0;y<height+1;y+=stepH){"></code><br /></pre><br /><br /></span><span style="font-family:courier new;"> </span><span style="font-family:courier new;">switch(design){</span><br /><span style="font-family:courier new;"> case 0: function0(); break;</span><br /><span style="font-family:courier new;"> case 1: function1(); break;</span><br /><span style="font-family:courier new;"> case 2:function2();break;</span><br /><span style="font-family:courier new;"> } } }//end of fors</span><br /><span style="font-family:courier new;">count++;</span><br /><span style="font-family:courier new;"> }//end of while</span><br /><span style="font-family:courier new;">drawCount++;</span><br /><span style="font-family:courier new;">}//end of draw</span><br /><br /><span style="font-family:courier new;">void changeColour(){</span><br /><span style="font-family:courier new;"> stroke(random(255),random(255),random(255),random(255));</span><br /><span style="font-family:courier new;">}</span><br /><br /><span style="font-family:courier new;">void function0(){</span><br /><span style="font-family:courier new;"> line(whatever);</span><br /><span style="font-family:courier new;">}</span><br /><span style="font-family:courier new;">void function1(){</span><br /><span style="font-family:courier new;"> line(whatever);</span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;">void function2(){</span><br /><span style="font-family:courier new;"> line(whatever);</span><br /><span style="font-family:courier new;"> }</span><br /></span><br /><span style="font-family:arial;">Lets look at one of our functions and how the value of rannum decides which patterns are drawn.<br /><br /><span style="font-size:85%;"><span style="font-family:courier new;">void bigArches(){</span><br /><span style="font-family:courier new;"> //rannum=0;</span><br /><span style="font-family:courier new;"> if(rannum==1||rannum==0){</span><br /><span style="font-family:courier new;"> line(x,0,width,x);//large mesh ur</span><br /><span style="font-family:courier new;"> line(0,y,y,width);}</span><br /><span style="font-family:courier new;"> if(rannum==2||rannum==0){</span><br /><span style="font-family:courier new;"> line(0,height-y,y,0);//large mesh u l</span><br /><span style="font-family:courier new;"> line(width,height-y,y,height);} </span><br /><span style="font-family:courier new;">}</span></span><br />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.<br />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.<br />e.g. </span><span style="font-size:85%;"><span style="font-family:courier new;">switch(3){</span></span><br />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.<br /><span style="font-size:85%;"><span style="font-family:courier new;">void inwards(){</span><br /><span style="font-family:courier new;"> line(0,0,height-y,y);//inwards l d</span><br /><span style="font-family:courier new;"> line(width,height,y,height-y);//inwards r u</span><br /><span style="font-family:courier new;"> line(0,height,y,y);//inwards l u</span><br /><span style="font-family:courier new;"> line(width,0,y,y);//inwards r d</span><br /><span style="font-family:courier new;">}</span><br /></span>This means that when this design is chosen it will always show the four statements in its pattern,<br />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.<br /><span style="font-size:85%;"><span style="font-family:courier new;">void butterfly(){</span><br /><span style="font-family:courier new;"> int rannum=round(random(6));</span><br /><span style="font-family:courier new;"> if(rannum==1||rannum==5||rannum==0)</span><br /><span style="font-family:courier new;"> line(x,height-y,width-x,0);</span><br /><span style="font-family:courier new;"> if(rannum==2||rannum==5||rannum==0)</span><br /><span style="font-family:courier new;"> line(x,y,width-x,height);</span><br /><span style="font-family:courier new;"> if(rannum==3||rannum==6||rannum==0)</span><br /><span style="font-family:courier new;"> line(width,width-y,x,y);</span><br /><span style="font-family:courier new;"> if(rannum==4||rannum==6||rannum==0)</span><br /><span style="font-family:courier new;"> line(0,y,x,height-y);</span><br /><span style="font-family:courier new;">}</span><br /></span>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.<br /><span style="font-size:85%;"><span style="font-family:courier new;">void butterfly(){</span><br /><span style="font-family:courier new;"> if(rannum==1||rannum==0){</span><br /><span style="font-family:courier new;"> line(x,height-y,width-x,0);</span><br /><span style="font-family:courier new;"> line(x,y,width-x,height);}</span><br /><span style="font-family:courier new;"> if(rannum==2||rannum2==0){</span><br /><span style="font-family:courier new;"> line(width,width-y,x,y);//butterfly r</span><br /><span style="font-family:courier new;"> line(0,y,x,height-y);}}</span><br /></span>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.<br /><span style="font-size:85%;"><span style="font-family:courier new;">void triangle3(){</span><br /><span style="font-family:courier new;"> if(rannum==1||rannum==0){ </span><br /><span style="font-family:courier new;"> line(0,0,y,height);//ray uld</span><br /><span style="font-family:courier new;"> line(0,0,width,height-y);//ray ulr </span><br /><span style="font-family:courier new;"> line(width-x,0,width,height);//ray d r u </span><br /><span style="font-family:courier new;"> line(0,y,width,height);//ray d r l</span><br /><span style="font-family:courier new;"> }</span><br /><span style="font-family:courier new;"> if(rannum==2||rannum==0){ </span><br /><span style="font-family:courier new;"> line(width,0,0,height-y);//ray u r l</span><br /><span style="font-family:courier new;"> line(width,0,height-y,height);//ray u r d </span><br /><span style="font-family:courier new;"> line(0,height,width-x,0);// dl u </span><br /><span style="font-family:courier new;"> line(0,height,width,height-y);//ray d l r</span><br /><span style="font-family:courier new;"> }}</span></span><br />On the other hand we may decide that it is worth the added complexity if it brings some quality to our application.<br />Implementing pattern 7 will warrant some careful consideration.<br /></span><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-75894900332979429292009-04-01T09:10:00.026+01:002009-04-03T16:46:10.577+01:00Chunk46 - Line Patterns<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf6xwKg8ssvSm-55Jet_kxX37g4ATDO0I8wxkBNumr9Z9XXeVcO7g22KdeSupwQNapn9ZEAOjInIywocop71hZZcCaQRsAhwoINYm4S4VySCIrquoXR-9CxGm4kVBzi3QnY4n97RQDfy0/s1600-h/patterns.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 263px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf6xwKg8ssvSm-55Jet_kxX37g4ATDO0I8wxkBNumr9Z9XXeVcO7g22KdeSupwQNapn9ZEAOjInIywocop71hZZcCaQRsAhwoINYm4S4VySCIrquoXR-9CxGm4kVBzi3QnY4n97RQDfy0/s320/patterns.jpg" alt="" id="BLOGGER_PHOTO_ID_5319633027417889570" border="0" /></a>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.<br />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.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNQ5k0vgIzXvNr7a9vRjh-00Hb8VdHVbJfNK_dMQ_lMYEsxbSUDLIfNkC26r9-GRUVW_cGgK5wrVhPuEUMVwe54azL5a0kmKp0pIo9MqR0NasMnuWThS2VCHnECwXBuURVZXVq0EsfSlA/s1600-h/pat4.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNQ5k0vgIzXvNr7a9vRjh-00Hb8VdHVbJfNK_dMQ_lMYEsxbSUDLIfNkC26r9-GRUVW_cGgK5wrVhPuEUMVwe54azL5a0kmKp0pIo9MqR0NasMnuWThS2VCHnECwXBuURVZXVq0EsfSlA/s200/pat4.gif" alt="" id="BLOGGER_PHOTO_ID_5319638689295016834" border="0" /></a><br />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.<br />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).<br />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.<br />Lets look at their symmetry:<br />Pattern 5:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOWIvlfRVbODASGP4cBof1adxCDLiT3g3syuVkR0Y1pQVUYDigqdYbxDhIJU-YLvFwH61SQTGxOWXAP227Q89dWq34HzWgcWYieUVpRJj3ppiIzRixR84Tqe7g9KIEgZvcgSxZ8wJ37_w/s1600-h/stripesA.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOWIvlfRVbODASGP4cBof1adxCDLiT3g3syuVkR0Y1pQVUYDigqdYbxDhIJU-YLvFwH61SQTGxOWXAP227Q89dWq34HzWgcWYieUVpRJj3ppiIzRixR84Tqe7g9KIEgZvcgSxZ8wJ37_w/s200/stripesA.gif" alt="" id="BLOGGER_PHOTO_ID_5319646593226897666" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL_vWrGGxSBlKvGOD3mRIw_sV0ZhAoK0PL8H9p7IEtxiXs_FfmxOs7PiCGn_v3L0J3M8RqFOdTtP551lcxCYad0RqBwZNx5PrPEEtq4oOxtnHOHwnTePL_iciBUAEdOneYUYab1LivTKE/s1600-h/stripesB.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL_vWrGGxSBlKvGOD3mRIw_sV0ZhAoK0PL8H9p7IEtxiXs_FfmxOs7PiCGn_v3L0J3M8RqFOdTtP551lcxCYad0RqBwZNx5PrPEEtq4oOxtnHOHwnTePL_iciBUAEdOneYUYab1LivTKE/s200/stripesB.gif" alt="" id="BLOGGER_PHOTO_ID_5319647160412374610" border="0" /></a><br /><br />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.<br />Pattern 6:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihzObUt1_tjmRAWDuLH3CZUGjxT2taAslrGvnBMD0JmVIOo5wg_v4tbO0B-qkSkti6B9EkhrPq3tK1QTX5oG_cAQpSUaOzqfDl6wJPouBPyOvuaHa9vMk2UMGqRYn8V65PV34ng743msQ/s1600-h/bt1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihzObUt1_tjmRAWDuLH3CZUGjxT2taAslrGvnBMD0JmVIOo5wg_v4tbO0B-qkSkti6B9EkhrPq3tK1QTX5oG_cAQpSUaOzqfDl6wJPouBPyOvuaHa9vMk2UMGqRYn8V65PV34ng743msQ/s200/bt1.gif" alt="" id="BLOGGER_PHOTO_ID_5319649854909579074" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKjwLyosUqLl7r6SE28rnYgTOPpWf0xyY-SjhDAqs4bsSBnNpRBcJRxfgtcV8DvBmxZ6FdISbsMSC4gO8kLmc2FxiaU5fvlUZD1SBCN75itwj0fDavPAvgrv3yyf_UNFvJfGgzwyWOy0Q/s1600-h/bt2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKjwLyosUqLl7r6SE28rnYgTOPpWf0xyY-SjhDAqs4bsSBnNpRBcJRxfgtcV8DvBmxZ6FdISbsMSC4gO8kLmc2FxiaU5fvlUZD1SBCN75itwj0fDavPAvgrv3yyf_UNFvJfGgzwyWOy0Q/s200/bt2.gif" alt="" id="BLOGGER_PHOTO_ID_5319649986662670034" border="0" /></a><br /><br />Again we can choose vertical, horizontal or total symmetry.<br />Pattern 11:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirJE0XWWoqN8s26uIkT07s3Kso9xHlzGjXu4xzufrIxg8P7UYsfYaTZxR1JJke9Ni6rQZ2hPpisfb_Etaeg9sWjTXn3cEo3ApeVBgqyzAWdtOo32PKh-7jhN2rDARsv9h8Z-7vVHoXTMk/s1600-h/tap2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirJE0XWWoqN8s26uIkT07s3Kso9xHlzGjXu4xzufrIxg8P7UYsfYaTZxR1JJke9Ni6rQZ2hPpisfb_Etaeg9sWjTXn3cEo3ApeVBgqyzAWdtOo32PKh-7jhN2rDARsv9h8Z-7vVHoXTMk/s200/tap2.gif" alt="" id="BLOGGER_PHOTO_ID_5319690325816700498" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3FSvvzxU9ZIO_7J5JZLU1-0K5e2flseTEhWQBFH7Szv9DT3c3JMU99VBsVJFZgWZu6VRAwHuUOJdvm2sL9wUL4QaxSALkDEp4t_PWoR6rqquoukj4lYJXGp9oZl1Rep3qMWQTIM6bDQ/s1600-h/tap1.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3FSvvzxU9ZIO_7J5JZLU1-0K5e2flseTEhWQBFH7Szv9DT3c3JMU99VBsVJFZgWZu6VRAwHuUOJdvm2sL9wUL4QaxSALkDEp4t_PWoR6rqquoukj4lYJXGp9oZl1Rep3qMWQTIM6bDQ/s200/tap1.gif" alt="" id="BLOGGER_PHOTO_ID_5319693081654949650" border="0" /></a><br />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.<br /><br />Each pattern in our next group requires 4 statements to be drawn and has other display options. Lets look at them one by one:<br />Pattern 2:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnAqVEWmRxP9wOtj5Hvw0o5PvFCDMgUX6Yv_hmQwvWXEHu6eika4UrzSmGTuPn-08teTrOTQZbjyu4CUVIeBWxzFxB5zfFybtQRW5YFxvZtzsZHiOWMFYl6Mnsy7HJw6W1Ky3nJIEZ-m8/s1600-h/honeycomb1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnAqVEWmRxP9wOtj5Hvw0o5PvFCDMgUX6Yv_hmQwvWXEHu6eika4UrzSmGTuPn-08teTrOTQZbjyu4CUVIeBWxzFxB5zfFybtQRW5YFxvZtzsZHiOWMFYl6Mnsy7HJw6W1Ky3nJIEZ-m8/s200/honeycomb1.gif" alt="" id="BLOGGER_PHOTO_ID_5319653248273480658" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1XbnXdgBpHaKS6DzpDuZcx_vvEzGhQo9q34MjpDlIc9tbo7biVWHc_Vy7Q1xUfeTb_-h7neer8F9EmtVgIpbx_HUpMAe3FGx0f-arjlxgJhogG1lOrXzLGX5XGjm_NnIJ33oSvHx_wQw/s1600-h/honeycomb2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1XbnXdgBpHaKS6DzpDuZcx_vvEzGhQo9q34MjpDlIc9tbo7biVWHc_Vy7Q1xUfeTb_-h7neer8F9EmtVgIpbx_HUpMAe3FGx0f-arjlxgJhogG1lOrXzLGX5XGjm_NnIJ33oSvHx_wQw/s200/honeycomb2.gif" alt="" id="BLOGGER_PHOTO_ID_5319653385139408130" border="0" /></a><br /><br />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".<br />Pattern 3:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTN9TfCHro8Lw06y51xx4jJL-9rZyq2sAlWFpjE2owc4zNSrh-CV_0NoQsAz-F_Pk3h80b9MP4R3PW4oIpgzf4QhKHalW0afMiiWP2aE9jovn15qRvvPZHNHIQw2AFvB9ExKyPDFisFAU/s1600-h/dStripes1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTN9TfCHro8Lw06y51xx4jJL-9rZyq2sAlWFpjE2owc4zNSrh-CV_0NoQsAz-F_Pk3h80b9MP4R3PW4oIpgzf4QhKHalW0afMiiWP2aE9jovn15qRvvPZHNHIQw2AFvB9ExKyPDFisFAU/s200/dStripes1.gif" alt="" id="BLOGGER_PHOTO_ID_5319657061648919154" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4k_EMrWkOe-9zh3pHybgIP0Oyos3drc4hc9DMsAs2aaPYTmHGJTpIBKC5Y9wSy2GAmrORG6F2tG0eWHdT2U8eDqx1vaZHy5CSi8qncM8b2Y8AQhjIHwMfQxRFGzhITiQv5exuTry-drk/s1600-h/dStripes2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4k_EMrWkOe-9zh3pHybgIP0Oyos3drc4hc9DMsAs2aaPYTmHGJTpIBKC5Y9wSy2GAmrORG6F2tG0eWHdT2U8eDqx1vaZHy5CSi8qncM8b2Y8AQhjIHwMfQxRFGzhITiQv5exuTry-drk/s200/dStripes2.gif" alt="" id="BLOGGER_PHOTO_ID_5319657189361537250" border="0" /></a><br /><br />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.<br />Pattern 8:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4ZK44Y0kTNhvYNhslsJ-7YQEYE6FDqHUYnP2heJK5RhyphenhyphendzRFwYGOhag0SsUq0ZQ6gmeR_RwLzfVyJoG14Itv52gygdl6Mj_sT0egm7phfsfFKNcLZTh6XR8OGfPS-GvctSQcUH_wsMrM/s1600-h/SR1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4ZK44Y0kTNhvYNhslsJ-7YQEYE6FDqHUYnP2heJK5RhyphenhyphendzRFwYGOhag0SsUq0ZQ6gmeR_RwLzfVyJoG14Itv52gygdl6Mj_sT0egm7phfsfFKNcLZTh6XR8OGfPS-GvctSQcUH_wsMrM/s200/SR1.gif" alt="" id="BLOGGER_PHOTO_ID_5319660429041212450" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ9sokGnb5AUs9cKWOqVK-gBNCxrrGqVpVBoodI-zu2YThXhnRSY2GaYvUoy3DfEEzdGYRUsFhxtiIVieDIVNrHFmnp8DIIAS9g9C8PM4dhdIZ9uM2JfgL4ruv-vXNJ6dWSYFDibp2VLQ/s1600-h/SR2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ9sokGnb5AUs9cKWOqVK-gBNCxrrGqVpVBoodI-zu2YThXhnRSY2GaYvUoy3DfEEzdGYRUsFhxtiIVieDIVNrHFmnp8DIIAS9g9C8PM4dhdIZ9uM2JfgL4ruv-vXNJ6dWSYFDibp2VLQ/s200/SR2.gif" alt="" id="BLOGGER_PHOTO_ID_5319679575618996002" border="0" /></a><br /><br />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.<br />Pattern 9:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe7L6l59ONZLciGMKleaZps-gf57KLeKmqnjh3xvYCMr7InKOitxxkR4dhqn0NfjxMIUB4ZezHKWHzEXKhtWvvCERHfjEMxzCtrwVDUYc_Sd8LOz1B4jFnBrZlzCaSyIpgdP-BdpGe-pM/s1600-h/butterfly1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe7L6l59ONZLciGMKleaZps-gf57KLeKmqnjh3xvYCMr7InKOitxxkR4dhqn0NfjxMIUB4ZezHKWHzEXKhtWvvCERHfjEMxzCtrwVDUYc_Sd8LOz1B4jFnBrZlzCaSyIpgdP-BdpGe-pM/s200/butterfly1.gif" alt="" id="BLOGGER_PHOTO_ID_5319681252542091746" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNqEr1-7Lgx0-Jz51tscsciQmAQmVPfCX6eQLUWjyUFviM0ou8mFIe0SuhSoYMBaeJX3S5f1xI0xJHsazPlcLp4OBJ9s0ZkM9yLtRdVnnmD4oVRsv5BSacB5V1i7TcpCGOybXyC8Wzb1M/s1600-h/butterfly2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNqEr1-7Lgx0-Jz51tscsciQmAQmVPfCX6eQLUWjyUFviM0ou8mFIe0SuhSoYMBaeJX3S5f1xI0xJHsazPlcLp4OBJ9s0ZkM9yLtRdVnnmD4oVRsv5BSacB5V1i7TcpCGOybXyC8Wzb1M/s200/butterfly2.gif" alt="" id="BLOGGER_PHOTO_ID_5319681402121988946" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguYwwI2tRbKbgbLgvLmzygzcROQ6k283CBzuTL4Aocv7On9FJ3CSr5V4d0fdkft2LMRmRRN-4TTF-0Aerx7gq8guvVtpQGThLUen9BmR6CDZGzFpaOqsjzpjilxhd2iWvdjix1RD5eyx4/s1600-h/butterfly3.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguYwwI2tRbKbgbLgvLmzygzcROQ6k283CBzuTL4Aocv7On9FJ3CSr5V4d0fdkft2LMRmRRN-4TTF-0Aerx7gq8guvVtpQGThLUen9BmR6CDZGzFpaOqsjzpjilxhd2iWvdjix1RD5eyx4/s200/butterfly3.gif" alt="" id="BLOGGER_PHOTO_ID_5319681554311516706" border="0" /></a><br /><br />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.<br />Pattern 10:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD0xMxoPmX6X0V3-hvD3rIitsNOTZ_Z428XcLgQ_1l9hv2gGVJRQiDAYAckkRSKGq90iJppGPs1AugcRryTJeeAvkz_zaq0C5ySuuHXDGhcShCv4yUwTmQ09za2EZj0rWfLIfG7kAS6gU/s1600-h/ray1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD0xMxoPmX6X0V3-hvD3rIitsNOTZ_Z428XcLgQ_1l9hv2gGVJRQiDAYAckkRSKGq90iJppGPs1AugcRryTJeeAvkz_zaq0C5ySuuHXDGhcShCv4yUwTmQ09za2EZj0rWfLIfG7kAS6gU/s200/ray1.gif" alt="" id="BLOGGER_PHOTO_ID_5319687440224903954" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSFP7YtI0srBZKQATUzE_lvKjDQdiSg_-HelPT-BInaIOHOyeB2WaijTWijJzPltuGqIe3g-aEdA0i2SrPI5X8Zg3RmjV6ciHQQknl7Ht-uNtFELpBnUdi_CfXZvTsSRJLvlldrzoMWAc/s1600-h/ray2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSFP7YtI0srBZKQATUzE_lvKjDQdiSg_-HelPT-BInaIOHOyeB2WaijTWijJzPltuGqIe3g-aEdA0i2SrPI5X8Zg3RmjV6ciHQQknl7Ht-uNtFELpBnUdi_CfXZvTsSRJLvlldrzoMWAc/s200/ray2.gif" alt="" id="BLOGGER_PHOTO_ID_5319686800023650930" border="0" /></a><br /><br />This is another simple pattern which presents no problems.<br /><br />Our final two patterns have 8 statements in each set, which further complicates things by allowing more options for symmetrical displays:<br />Pattern 12:<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLU3n_vVcvxFuNgP74UPeVn9lahD_7U0uynS72BAuRx2mQfC0cmB_JPMe25SZHVh1sRE4k16cvNqsZ7sI-kHliJHAcLh_icCFI9GVvyS3oITXrl1r5hMtLM9_IG3Dd65VxUqAb6hnt8LY/s1600-h/ray1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLU3n_vVcvxFuNgP74UPeVn9lahD_7U0uynS72BAuRx2mQfC0cmB_JPMe25SZHVh1sRE4k16cvNqsZ7sI-kHliJHAcLh_icCFI9GVvyS3oITXrl1r5hMtLM9_IG3Dd65VxUqAb6hnt8LY/s200/ray1.gif" alt="" id="BLOGGER_PHOTO_ID_5319709906788240402" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRjkO1ICECbpHqaJcM0HSqvX7QLs76M8VjtV3LixEM7jW_z_EUf9hbglWVgyacL0gwLmQMGE9oChVm363OSlUGP1gVCHoJdmfifQuHFnv2b1O2nvauQwKqVtenbfBEHL2MfxrUIkvgZys/s1600-h/ray2.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRjkO1ICECbpHqaJcM0HSqvX7QLs76M8VjtV3LixEM7jW_z_EUf9hbglWVgyacL0gwLmQMGE9oChVm363OSlUGP1gVCHoJdmfifQuHFnv2b1O2nvauQwKqVtenbfBEHL2MfxrUIkvgZys/s200/ray2.gif" alt="" id="BLOGGER_PHOTO_ID_5319708766004667602" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PcgzHh8lfpGpoO-HIcnk-85Du-IDQhp488Hg1J5qNN-Hw8dhrK_i1Mnbw3xaw3KlvkQZzbxS5cBD4e0UOlSYoE9zGtr5ybdIrTSCv1SEvchlh27glPucIQOJc8o6SmZBFzFcp60oye4/s1600-h/ray6.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PcgzHh8lfpGpoO-HIcnk-85Du-IDQhp488Hg1J5qNN-Hw8dhrK_i1Mnbw3xaw3KlvkQZzbxS5cBD4e0UOlSYoE9zGtr5ybdIrTSCv1SEvchlh27glPucIQOJc8o6SmZBFzFcp60oye4/s200/ray6.gif" alt="" id="BLOGGER_PHOTO_ID_5319709390002984946" border="0" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEger5xoez8g4-2wWs3VZ5uymsDHXS6Q5pZi-SpsU9n1QcbInI_fPkSebID2HUU9_ZTTHqgSZFgbBrDYwYH7w7giU_bsA6Id0pGZxPu1QMkH2YG9qis5UwNuJVQO6nenN17G4ndBd0hRt1Q/s1600-h/ray4.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEger5xoez8g4-2wWs3VZ5uymsDHXS6Q5pZi-SpsU9n1QcbInI_fPkSebID2HUU9_ZTTHqgSZFgbBrDYwYH7w7giU_bsA6Id0pGZxPu1QMkH2YG9qis5UwNuJVQO6nenN17G4ndBd0hRt1Q/s200/ray4.gif" alt="" id="BLOGGER_PHOTO_ID_5319710745517232706" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW92TrxHjuEhPU7Cc9HTMJbyJExTUdLswjEShk_7JpEXG7juhNkCIrvcEB1N_Xpx3X_BN_4-13hUCMpaSEtQ-THKwoBfP2ifiVqvm1WCBTmyDXUC1vFwmXxoBHUlpyvv2fPbXT81yUtmA/s1600-h/ray3.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW92TrxHjuEhPU7Cc9HTMJbyJExTUdLswjEShk_7JpEXG7juhNkCIrvcEB1N_Xpx3X_BN_4-13hUCMpaSEtQ-THKwoBfP2ifiVqvm1WCBTmyDXUC1vFwmXxoBHUlpyvv2fPbXT81yUtmA/s200/ray3.gif" alt="" id="BLOGGER_PHOTO_ID_5319708922369956162" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTmFD1gK1jXn5KWTrl5wZcauPdhy6ksGYTklYg4KDPVf_vWzvHv94MSf0tmtOi3kBxzfM189xtKEDpSumPfyBDUg_XV1jL4FCM8u8xRKl8NOaJ39S0ZtDCp1E3_GbmuTzikfDYqCKH9DI/s1600-h/ray5.gif"><img style="cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTmFD1gK1jXn5KWTrl5wZcauPdhy6ksGYTklYg4KDPVf_vWzvHv94MSf0tmtOi3kBxzfM189xtKEDpSumPfyBDUg_XV1jL4FCM8u8xRKl8NOaJ39S0ZtDCp1E3_GbmuTzikfDYqCKH9DI/s200/ray5.gif" alt="" id="BLOGGER_PHOTO_ID_5319711748628871874" border="0" /></a><br /><br />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.<br />Pattern 7:<br />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:<br />Pattern8={{1},{2},{3},{4},{5},{6},{7},{8},{1,2},{1,3},<br />{1,4},{1.5},{1,6},{1,7},{1,8},{2,3},{2,4},{2,5},{2,6},{2,7},<br />{2,8},{3,4},{3,5},{3,6},{3,7},{3,8},{4,5},{4,6},{4,7},{4,8},<br />{5,6},{5,7},{5,8},{6,7},{6,8},{7,8},{1,2,3},{1,2,4},{1,2,5},{1,2,6}<br />,{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}<br />,{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},<br /><br />{1,2,3,4},{1,2,3,5},{1,2,3,6}<br />,{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}<br /><br />,{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}<br /><br />,{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}<br /><br />,{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}<br /><br />,{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},<br /><br />{1,2,3,4,5},{12346}<br />,{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}<br />,{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}<br /><br /><br />,{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}<br />,{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}<br /><br /><br /><br /><br />{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}}<br />tHIS IS A WORK IN PROGRESS!<br />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!<br /><br />Anyway to continue.....<br />Pattern 7:<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGidWTMh33NBhzBr0ktjPEwWm-rXvNGanlSK8t85rK8vaXFgDggHcHEZCArP764IAAzkcGQtjgPCGCPQZg0nJooesuOkYZOwslURK0gPgvj7PerwP0YVnIOQKNfa7RwmhabyYzikAGPdw/s1600-h/oops1.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGidWTMh33NBhzBr0ktjPEwWm-rXvNGanlSK8t85rK8vaXFgDggHcHEZCArP764IAAzkcGQtjgPCGCPQZg0nJooesuOkYZOwslURK0gPgvj7PerwP0YVnIOQKNfa7RwmhabyYzikAGPdw/s200/oops1.gif" alt="" id="BLOGGER_PHOTO_ID_5319784984147879490" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIohfkBwrsyJTgRIhJCPNHtdKtZpAwGkEPLRSJkQVOQZo6NrxyDsB8MMFyfAwgdWeDvWvM9RrwkWxxdkzk5Vfcw8QdqdPnR6nvwVahivxUF4vGQMLNYDKx6DMEHtQWIxlfHygUx97sL8Y/s1600-h/oops3.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIohfkBwrsyJTgRIhJCPNHtdKtZpAwGkEPLRSJkQVOQZo6NrxyDsB8MMFyfAwgdWeDvWvM9RrwkWxxdkzk5Vfcw8QdqdPnR6nvwVahivxUF4vGQMLNYDKx6DMEHtQWIxlfHygUx97sL8Y/s200/oops3.gif" alt="" id="BLOGGER_PHOTO_ID_5319885180341875026" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl5b1mm9VPZ0uAHYebEPb9iPTq3AXomdzBEY3pXhC3ACYqvBXcYEOh4DDUbuX9YBNh1-zQwOzDsPZzVpN-p2U81sBAXedalHgsqBOkJjXLVyDPBYbkyL0sDsusw7OdZ4BC1mbQuKz4qsc/s1600-h/oops5.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl5b1mm9VPZ0uAHYebEPb9iPTq3AXomdzBEY3pXhC3ACYqvBXcYEOh4DDUbuX9YBNh1-zQwOzDsPZzVpN-p2U81sBAXedalHgsqBOkJjXLVyDPBYbkyL0sDsusw7OdZ4BC1mbQuKz4qsc/s200/oops5.gif" alt="" id="BLOGGER_PHOTO_ID_5319881752348648866" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTjJ46Ei0DEg73IhKtl_t14AuJ0Ud6TUHJvrfgkrxCSLduoYpAt2RFGT7ceZLbwgX1fNqqaBJ3pcDReW7cNXaxhQ_60AyvobTWygS2VWd0FXCQPJIBPbEBAByTgWtqy8P1SYZBt9ISfPU/s1600-h/oops9.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTjJ46Ei0DEg73IhKtl_t14AuJ0Ud6TUHJvrfgkrxCSLduoYpAt2RFGT7ceZLbwgX1fNqqaBJ3pcDReW7cNXaxhQ_60AyvobTWygS2VWd0FXCQPJIBPbEBAByTgWtqy8P1SYZBt9ISfPU/s200/oops9.gif" alt="" id="BLOGGER_PHOTO_ID_5319884090721055986" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY1t_ClJwMaqamTlxsnf_ByZ5DxAEK2xQMP0oqcivlQTfA0oXMXuiHtM11bNoSE7XCM3-5OSOkiGxNvQ7ddJdvtMdhYyN6TGBck0bTGxBsjWuVCrGmfGeUe-ZBTb75tz7qPzNFQXhpzbc/s1600-h/oops4.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY1t_ClJwMaqamTlxsnf_ByZ5DxAEK2xQMP0oqcivlQTfA0oXMXuiHtM11bNoSE7XCM3-5OSOkiGxNvQ7ddJdvtMdhYyN6TGBck0bTGxBsjWuVCrGmfGeUe-ZBTb75tz7qPzNFQXhpzbc/s200/oops4.gif" alt="" id="BLOGGER_PHOTO_ID_5319881971970174050" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNqCSTewXGbusdYYaCkF-mokpuWO4DML-n-bwaZ3xkIIIP8Ex4bA-E-tRC4SZFx_2WwY8KpkF1I6Oz3Zs02IPfkuLxoYNypJsuqfknbVCT-Hz8ypcuqPeh8BQQpljqjsHqfMqGq-bwbjE/s1600-h/oops8.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNqCSTewXGbusdYYaCkF-mokpuWO4DML-n-bwaZ3xkIIIP8Ex4bA-E-tRC4SZFx_2WwY8KpkF1I6Oz3Zs02IPfkuLxoYNypJsuqfknbVCT-Hz8ypcuqPeh8BQQpljqjsHqfMqGq-bwbjE/s200/oops8.gif" alt="" id="BLOGGER_PHOTO_ID_5319883857659147314" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8Z4ZqWBcw8ql5SCZL5iOJVa9y5KCIw1-F6oLXPyZJo1y-hMywNU0ut3pDovmuzQylrmSiQXrLJnckWeeGgBJfUA29AfB7iCCvJTgBST6Hl_Ti-ckyYRBKu2oqLR6lwyd-ToPnNXgA2o/s1600-h/oops6.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8Z4ZqWBcw8ql5SCZL5iOJVa9y5KCIw1-F6oLXPyZJo1y-hMywNU0ut3pDovmuzQylrmSiQXrLJnckWeeGgBJfUA29AfB7iCCvJTgBST6Hl_Ti-ckyYRBKu2oqLR6lwyd-ToPnNXgA2o/s200/oops6.gif" alt="" id="BLOGGER_PHOTO_ID_5319882156526464290" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh455NaeOb0o4A1ee-OVWlU-zQ5lm84vlsaJH2xiJhBegfsb-zsK3uVXOCAc5NABe3wmFdIEgBc8D-dxUAsxBpUG9u-kjFrEaTelXKfC1Q3NE1osqY7oTSDdy2FUZ9oqOKIHBLTmR0SgiY/s1600-h/oops7.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh455NaeOb0o4A1ee-OVWlU-zQ5lm84vlsaJH2xiJhBegfsb-zsK3uVXOCAc5NABe3wmFdIEgBc8D-dxUAsxBpUG9u-kjFrEaTelXKfC1Q3NE1osqY7oTSDdy2FUZ9oqOKIHBLTmR0SgiY/s200/oops7.gif" alt="" id="BLOGGER_PHOTO_ID_5319883688667220034" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAeRZVNXJQu8wl-p_qz6L9Dtvj6rxx5j-LvPIYF4wkAMvqN5ISilO0PhfevDLnL6GXADzsTVG4HfFoeRGx04W8IBWvZvcUupXbb2xrMqH8yTBLVJYODixxbq4N6trHKXpj44a8NTvaoP8/s1600-h/oops2.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAeRZVNXJQu8wl-p_qz6L9Dtvj6rxx5j-LvPIYF4wkAMvqN5ISilO0PhfevDLnL6GXADzsTVG4HfFoeRGx04W8IBWvZvcUupXbb2xrMqH8yTBLVJYODixxbq4N6trHKXpj44a8NTvaoP8/s200/oops2.gif" alt="" id="BLOGGER_PHOTO_ID_5319889567516941154" border="0" /></a>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.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi088s0sy_8qsCcvlYTmX2b4HwPWp24YRRZLGljdDh2nKjYIJR1R-v-lcxgCDXrULTViJZLiaJ7RWGvEZ9fqLoV7n_ND8ZkC5kJzFMuav34yPsLwFsyGz0t0yHw1tTpuQL2Z2li27mliEk/s1600-h/ray1.gif"><br /></a><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-85201579847031954682009-03-31T22:06:00.006+01:002009-04-01T00:07:55.899+01:00Chunk 46 - HeadLinesI 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<span style="font-style: italic;"><span style="font-style: italic;">.</span></span><br />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.<br /><br /><span style="font-size:85%;">int n=0;<br /><br />void setup(){ </span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaG-FEGdajsCXmhid1YmMgMK9dldygPhOpvOnNX39BUjlvT5mdm2-K2tibbcMWjPUszO9L6FHjJyf8XpyhvsD3-kYg_RD8vNnM3KeueYMMiBr871q5XyC-ENfirQM9ZQb_0FhAyQWw6us/s1600-h/curve.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaG-FEGdajsCXmhid1YmMgMK9dldygPhOpvOnNX39BUjlvT5mdm2-K2tibbcMWjPUszO9L6FHjJyf8XpyhvsD3-kYg_RD8vNnM3KeueYMMiBr871q5XyC-ENfirQM9ZQb_0FhAyQWw6us/s320/curve.gif" alt="" id="BLOGGER_PHOTO_ID_5319470255167214594" border="0" /></a><br /><span style="font-size:85%;">size(400,400);<br />strokeWeight(1);<br />background(255);</span><br /><span style="font-size:85%;">}<br /></span><br /><span style="font-size:85%;">void draw(){</span><br /><span style="font-size:85%;">line(0,n,n+10,height);<br />n+=10;<br />delay(200);<br />if(n>height){<br />n=0;<br />}}<br /><br /><br /><span style="font-size:100%;">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!<br />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.<br /></span></span><span style="font-size:100%;">line(0,n,n+10,height);<br />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.<br />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.<br />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.<br />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.<br /></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifkhGy8wsljaJx7cpum7AjnGPnveAnEyDWy8zFQxhCCGVQ_8Cv-56GrrQZdc7i2AhXDd5zxqz8sMBYs2mojp0FsewWauTAgkFT57UuSnwQpgdt2kGmaSP3LlPzg-iWKHeDBlI8Wmdq_WI/s1600-h/pat1.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 400px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifkhGy8wsljaJx7cpum7AjnGPnveAnEyDWy8zFQxhCCGVQ_8Cv-56GrrQZdc7i2AhXDd5zxqz8sMBYs2mojp0FsewWauTAgkFT57UuSnwQpgdt2kGmaSP3LlPzg-iWKHeDBlI8Wmdq_WI/s400/pat1.gif" alt="" id="BLOGGER_PHOTO_ID_5319489166794475362" border="0" /></a><br /><span style="font-size:100%;"><br /><br /><br /><br /><br /><br /></span><span style="font-size:85%;"><br /><br /></span><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-59759597101459097842009-03-27T20:00:00.002+00:002009-03-27T20:16:22.628+00:00Chunk16 Goes Mobile<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqM89z0_Cur3hTTTjuylQ0oj-vhtoNjiXnpmu2txdmv-oQWBLpmKpeVho8YnQNRugchNItsq4mqxRuMatCH16Q3rpWIIECGH57wXPsz0Ni_Usn8Edg6CN6sACRoeGF8AvCsfUZubAx_uE/s1600-h/mobiles.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqM89z0_Cur3hTTTjuylQ0oj-vhtoNjiXnpmu2txdmv-oQWBLpmKpeVho8YnQNRugchNItsq4mqxRuMatCH16Q3rpWIIECGH57wXPsz0Ni_Usn8Edg6CN6sACRoeGF8AvCsfUZubAx_uE/s400/mobiles.jpg" alt="" id="BLOGGER_PHOTO_ID_5317963889946320962" border="0" /></a><br />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.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-38448987867807870862009-03-23T10:07:00.002+00:002009-03-23T11:11:32.414+00:00The 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. <br />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.<br />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. <br />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.<br />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.<br />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. <br />These are just some of the tasks I need to tackle on Mondays.....so I'm busy today.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-72646292794164819732009-03-22T16:15:00.015+00:002009-03-22T18:18:44.794+00:00Chunk 79 - Introduction<style type="text/css"> <!-- @page { margin: 2cm } P { margin-bottom: 0.</style>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. <p style="margin-bottom: 0cm;"> 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.</p> <p style="margin-bottom: 0cm;">Before discussing each filter in depth we will look at an image transformed by each filter mode, so we can compare the different effects.</p><p style="margin-bottom: 0cm;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOId-64osmd_Uukm4xNLS5XtNl6Ouxnej2rFzuN4czfEkP2N9Xz2DIKx6R89pIzQXyECmHhu9wUXu-eg2Zv5luGNGH8E5UvKOxqrqgeSAZ5wax2xHU6ePqAubTPsSwIIkfZRaBWpEzq5o/s1600-h/image.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOId-64osmd_Uukm4xNLS5XtNl6Ouxnej2rFzuN4czfEkP2N9Xz2DIKx6R89pIzQXyECmHhu9wUXu-eg2Zv5luGNGH8E5UvKOxqrqgeSAZ5wax2xHU6ePqAubTPsSwIIkfZRaBWpEzq5o/s200/image.gif" alt="" id="BLOGGER_PHOTO_ID_5316048534849683250" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXliHdwXSBwwtUYzFPif7yPz4qvR4b_sDfJsJRcxaBGkAN6PkehOtH0WpqdPWNk-KOByu2ME7sPudeimlHggc10Gg857hJW4Gqj1sRWqPhtCPVLsiol2Z3rKzFyKy87VtqEohybka_6Ag/s1600-h/gray.gif"><img style="margin: 0pt 0pt 10px 10px; float: left; cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXliHdwXSBwwtUYzFPif7yPz4qvR4b_sDfJsJRcxaBGkAN6PkehOtH0WpqdPWNk-KOByu2ME7sPudeimlHggc10Gg857hJW4Gqj1sRWqPhtCPVLsiol2Z3rKzFyKy87VtqEohybka_6Ag/s200/gray.gif" alt="" id="BLOGGER_PHOTO_ID_5316049722090408930" border="0" /></a></p> <p style="margin-bottom: 0cm;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH-GD4C_9KI4LlveTTgwRjkoz3dYQ8RmFiRg4umjAv7w7dIp5eDEwheeIjeqc6kAsT6odu2Z9yl_3UOYEaMi_wMKqrQeV_8E658CXMp4qEyXgIe8Dnd66g7kPWwGnNxLVeB6y6tClEUpw/s1600-h/invert.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH-GD4C_9KI4LlveTTgwRjkoz3dYQ8RmFiRg4umjAv7w7dIp5eDEwheeIjeqc6kAsT6odu2Z9yl_3UOYEaMi_wMKqrQeV_8E658CXMp4qEyXgIe8Dnd66g7kPWwGnNxLVeB6y6tClEUpw/s200/invert.gif" alt="" id="BLOGGER_PHOTO_ID_5316051332464357074" border="0" /></a></p> <p style="margin-bottom: 0cm;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibVscvzOFL_PwrxoOkhdBKXlT9pEYPZbLBpX43qghQ4SupiQePLe_rbrWFBk88CGlsYviCSFMZvdAYIz5AsbkolbekHyS9HpX4v7L0MdeLj1E29-qBDYT09pn274yCIkAkIckEBlYM17w/s1600-h/dilate.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibVscvzOFL_PwrxoOkhdBKXlT9pEYPZbLBpX43qghQ4SupiQePLe_rbrWFBk88CGlsYviCSFMZvdAYIz5AsbkolbekHyS9HpX4v7L0MdeLj1E29-qBDYT09pn274yCIkAkIckEBlYM17w/s200/dilate.gif" alt="" id="BLOGGER_PHOTO_ID_5316053818751911730" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi88paRM8Uy_IMfTgr8WPlz5lABeYFb2Lx2ouqnJudMke7UmUsqhZ120H3gU1D-4cSabZTbLMzGhRQkkuTScY9h2syNgtNXu9QDl-aiw5XK1FrRG_GwLXa4mSia-CH6nTo4w3Cd-LZV2pw/s1600-h/posterize.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi88paRM8Uy_IMfTgr8WPlz5lABeYFb2Lx2ouqnJudMke7UmUsqhZ120H3gU1D-4cSabZTbLMzGhRQkkuTScY9h2syNgtNXu9QDl-aiw5XK1FrRG_GwLXa4mSia-CH6nTo4w3Cd-LZV2pw/s200/posterize.gif" alt="" id="BLOGGER_PHOTO_ID_5316060073759454642" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVqgjCKyaJgizEaGWVkE6285whf5OytwIFIOGU0Pk3OBsBih7UxJ1eLJk4b5NrH5xETA5qAEfyLlDp3Fi69nKDy10HMKXbRoTgUY97nzoCdFZoxJLhSEb1vNn2eg8PrnXAfBxaAgqer90/s1600-h/erode.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVqgjCKyaJgizEaGWVkE6285whf5OytwIFIOGU0Pk3OBsBih7UxJ1eLJk4b5NrH5xETA5qAEfyLlDp3Fi69nKDy10HMKXbRoTgUY97nzoCdFZoxJLhSEb1vNn2eg8PrnXAfBxaAgqer90/s200/erode.gif" alt="" id="BLOGGER_PHOTO_ID_5316053125404289298" border="0" /></a></p><p style="margin-bottom: 0cm;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1F2orB1F9NRVe81vZ9a2b6vEsUaKE_3mxhlOlJtbUrwJy6UfrBsnzqe4tOQ4FC-LxFltXkqRbBudS3GGKyp_j7K_4ywJpYedDswOuQ-0SkrkZff-srSBKcS278z5kre3oXmAmJ2b7JHY/s1600-h/threshold.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1F2orB1F9NRVe81vZ9a2b6vEsUaKE_3mxhlOlJtbUrwJy6UfrBsnzqe4tOQ4FC-LxFltXkqRbBudS3GGKyp_j7K_4ywJpYedDswOuQ-0SkrkZff-srSBKcS278z5kre3oXmAmJ2b7JHY/s200/threshold.gif" alt="" id="BLOGGER_PHOTO_ID_5316060790924815586" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDNbNhR5vwAeZf0fdR841AFwOAPSaVX9AJay1iM2RhclPpvxjdmaV6_bLDCZEVyyu0JS-v6BJF2b03XJ5ABlNMBMTG9wMzkhLh4g1g5R7YwRTp1EqKF1DPrGEfcJ_JBcifPr3u0iHYeCk/s1600-h/blur.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDNbNhR5vwAeZf0fdR841AFwOAPSaVX9AJay1iM2RhclPpvxjdmaV6_bLDCZEVyyu0JS-v6BJF2b03XJ5ABlNMBMTG9wMzkhLh4g1g5R7YwRTp1EqKF1DPrGEfcJ_JBcifPr3u0iHYeCk/s200/blur.gif" alt="" id="BLOGGER_PHOTO_ID_5316061452049685538" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqNEZoLANDo17vZxlvI4qcgXBwiwIDUBhpwPVm8rklAq5NfjsVmY2h8Dx8Y5yJvrqo3LdCLmCskPfbPjfgMB2x6Ru_vouv8gg-2tNpFKo2B8ONFlj_rJtFqSlWYM2oaR1ewOqc7CIA7OI/s1600-h/opaque.gif"><img style="cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqNEZoLANDo17vZxlvI4qcgXBwiwIDUBhpwPVm8rklAq5NfjsVmY2h8Dx8Y5yJvrqo3LdCLmCskPfbPjfgMB2x6Ru_vouv8gg-2tNpFKo2B8ONFlj_rJtFqSlWYM2oaR1ewOqc7CIA7OI/s200/opaque.gif" alt="" id="BLOGGER_PHOTO_ID_5316062204747131698" border="0" /></a></p> <p style="margin-bottom: 0cm;"><img src="file:///C:/Users/Rosie/AppData/Local/Temp/moz-screenshot.jpg" alt="" /></p><p>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.</p><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-39928264129576884252009-03-21T09:35:00.003+00:002009-03-22T16:14:54.404+00:00CH79 - Filter Utility - StandaloneThe difference between using the Java.io package and Processing's own file methods, was nothing short of amazing!<br />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.<br />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.<br /><a href="http://www.solundrian.com/procs/ch79_2/ch79_2.pde">Source Code</a><br /><a href="http://www.solundrian.com/procs/ch79_2/applet/ch79_2.jar">Save or Run the application</a><br />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.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-53938305283199590072009-03-21T01:11:00.004+00:002009-03-21T01:27:10.456+00:00Chunk 79 - Filter Utility Mark OneAfter 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.<br />The utility can be built by cutting and pasting the <a href="http://www.solundrian.com/procs/ch79/ch79.pde">source code</a> 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 <a href="http://www.solundrian.com/procs/ch79/ch79.jar">prebuilt data folder</a> and copy it into the application directory.<br />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.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-12970540346780259282009-03-20T15:11:00.007+00:002009-03-22T22:52:26.728+00:00Chunk 79 - Filter UtilityWell, 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.<br /><span style="font-weight: bold;">Instructions</span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_0a4TwlJ643N4p0vkC0GVpfhC4ZkmPA36z7d40qyK1wzFf1uE1eNTf8XP_H0vliw8fHoACssLiyli9Tp2fgrI_U-xmabk9Bxcw-qZ-sE-vylsSiXHGSSxT0GGqZTaCCmaX9as0Dixu_0/s1600-h/filechoice.gif"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 278px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_0a4TwlJ643N4p0vkC0GVpfhC4ZkmPA36z7d40qyK1wzFf1uE1eNTf8XP_H0vliw8fHoACssLiyli9Tp2fgrI_U-xmabk9Bxcw-qZ-sE-vylsSiXHGSSxT0GGqZTaCCmaX9as0Dixu_0/s320/filechoice.gif" alt="" id="BLOGGER_PHOTO_ID_5315292733802928226" border="0" /></a><br />The images to be worked on should be copied to the relevant folder in the data directory. There are three directories:<br />GIF - JPG - PNG<br />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...<br />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<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhT9QlfVYePwo90arGJTVMCrRYbFQ5pc1dpeXptNnurJ_T622o2LUlZoJFm8TU-jrjc9O5Lly3AyAbVs7KH6dkjnSXK8sdFLsqDSx5o3zK5IZ6DhDOHqLs4FC6Ng5W73uysAAwTb9o-eyc/s1600-h/chooseFile.gif"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 283px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhT9QlfVYePwo90arGJTVMCrRYbFQ5pc1dpeXptNnurJ_T622o2LUlZoJFm8TU-jrjc9O5Lly3AyAbVs7KH6dkjnSXK8sdFLsqDSx5o3zK5IZ6DhDOHqLs4FC6Ng5W73uysAAwTb9o-eyc/s320/chooseFile.gif" alt="" id="BLOGGER_PHOTO_ID_5315298406970246114" border="0" /></a>ut the reader is shown a list of files in the appropriate directory<br />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.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipRhuGb27uzQh6pKkpiUOeq0EKWJZN5O5UfgykrNrRousR5fwy_3m9_lK2nZZoHiE3vW-L1RhFYjLnmZhwpcZS5ReLrDH75-gNuSoLLdVJCkrfsa1-UebCdiw7YV1ORX3z6Y0RFXIa6QM/s1600-h/filterChoice.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 186px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipRhuGb27uzQh6pKkpiUOeq0EKWJZN5O5UfgykrNrRousR5fwy_3m9_lK2nZZoHiE3vW-L1RhFYjLnmZhwpcZS5ReLrDH75-gNuSoLLdVJCkrfsa1-UebCdiw7YV1ORX3z6Y0RFXIa6QM/s320/filterChoice.jpg" alt="" id="BLOGGER_PHOTO_ID_5315306574715482690" border="0" /></a><br /><br /><br /><br /><br /><br /><br /><br /><br />The choices available are:<br /><ul><li>I - INVERT</li><li>G - GRAY</li><li>E - ERODE</li><li>D - DILATE</li><li>P - POSTERIZE</li><li>B - BLUR</li><li>T - THRESHOLD</li><li>O - OPAQUE</li><li>R - RESTART</li><li>S - SAVE</li><li>X - EXIT<br />The filters are applied to the image but some e.g. posterize only work once.<br />R allows the reader to choose a different file type and file.<br />S saves the file and allows the user to continue working on the image.<br />X exits the application.<br />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.</li><li><a href="http://www.solundrian.com/procs/ch79/ch79.pde"><span style="font-weight: bold;">Source Code</span></a><br /></li></ul><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-66613609717413276572009-03-19T14:50:00.002+00:002009-03-19T15:24:18.695+00:00Load Chosen FileIn 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.<br />The application now loads the user's choice of file and displays it.<br />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.<br />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.<br />Here is the code so far:<br />import java.io.File;<br />String mode="none";<br />String dir="none";<br />boolean fileChosen=false;<br />int size=600;<br />File f;<br />String sep=File.separator;<br />String curDir = System.getProperty("user.dir");<br />PFont font;<br />PImage i;<br />String[]files;<br />void setup(){<br /> size(size+size/3,size);<br /> font=loadFont("Ang24.vlw");<br /> textFont(font,24);<br /> frameRate(20);}<br /><br />void draw(){<br />if(!fileChosen){<br /> if(mode=="none"){<br /> chooseMode();}<br /> else{<br /> chooseFile();}}<br /> else{ <br /> image(i,0,0,width,height);}<br />}<br /><br />void clearDisplay(){<br /> fill(255);<br /> rect(0,0,width/2,height/2);<br />}<br /><br />void chooseMode(){<br /> display("Type of File\n G - GIF\n J - JPG\n P - PNG");<br />}<br /><br />void chooseFile(){<br /> String s=dir+" Files:\n";<br /> String path=getPath(); <br /> File gDir=new File(path); <br /> files=gDir.list();<br /> int i=files.length;<br /> if(i>9)i=9;<br /> for(int n=0;n<i;n++){<br /> String fName=files[n];<br /> s+=n+": "+fName+"\n";}<br /> s+="Enter File Number";<br /> display(s);}<br /><br />void getFile(char key){<br /><br /> int num = Character.getNumericValue(key);<br /> String f=files[num];<br /> String path=getPath();<br /> if(files.length>num+1){<br /> i=loadImage(path+f);<br /> fileChosen=true;<br />}}<br /><br />String getPath(){<br />return curDir+sep+"myWork"+sep+"ch79"+sep+"data"+sep+dir+sep;<br /><br />}<br /><br />void display(String s){<br /> clearDisplay();<br /> fill(0);<br /> text(s,2,20);}<br /><br />void keyPressed(){<br />if(mode=="none"){<br /> if(key=='g'||key=='G'){<br /> mode="gif";<br /> dir="GIF";<br /> }<br /> if(key=='j'||key=='J'){<br /> mode="jpg";<br /> dir="JPG";<br /> }<br /> if(key=='p'||key=='P'){<br /> mode="png";<br /> dir="PNG";<br /> }}<br />else{<br /> if(key>='0'&&key<='9'){<br /> print("choosing file");<br />getFile(key);}}<br />}<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-30582670005932889592009-03-17T18:25:00.003+00:002009-03-17T19:09:15.564+00:00Listing Files in the data DirectoriesThe 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.<br />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.<br />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.<br />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.<br /><br />Code for Standalone File Choice:<br /><pre><code>import java.io.File;<br />String mode="none";<br />String dir="none";<br />boolean fileChosen=false;<br />int size=600;<br />File f;<br />PFont font;<br /><br />void setup(){<br />size(size+size/3,size);<br />font=loadFont("Ang24.vlw");<br />textFont(font,24);<br />frameRate(20);}<br /><br />void draw(){<br />if(!fileChosen){<br />if(mode=="none"){<br /> chooseMode();}<br />else{<br /> chooseFile();}}}<br /><br />void clearDisplay(){<br />fill(255);<br />rect(0,0,width/2,height/2);<br />}<br /><br />void chooseMode(){<br />display("Type of File\n G - GIF\n J - JPG\n P - PNG");<br />}<br /><br />void chooseFile(){<br />String s=dir+" Files:\n";<br />String sep=File.separator;<br />String curDir = System.getProperty("user.dir");<br />String path=curDir+sep+"myWork"+sep+"ch79"+sep+"data"+sep+dir+sep;<br />File gDir=new File(path);<br />String[]files=gDir.list();<br />int i=files.length;<br />if(i>9)i=9;<br />for(int n=0;n<i;n++){ <br /> fname="files[n];<br /> s+=n+": "+fName+"\n";}<br />s+="Enter File Number";<br />display(s);}<br /><br />void display(String s){<br /> clearDisplay();<br /> fill(0);<br /> text(s,2,20);}<br /><br />void keyPressed(){<br />if(mode=="none"){<br /> if(key='g'||key=='G'){mode="gif"){<br /> dir="GIF";}<br /> if(key=='j'||key=='J'){<br /> mode="jpg";<br /> dir="JPG";<br /> }<br /> if(key=='p'||key=='P'){<br /> mode="png";<br /> dir="PNG";<br /> }}}<br /><br /></code></pre><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-970233766334296092009-03-17T10:47:00.003+00:002009-03-17T11:17:34.022+00:00Standalone Program-IntentionsWhen 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 <a href="http://www.bioimagesuite.org/">open source application</a>, that provides all the functionality needed to perform medical imaging. <br />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.<br />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.<br />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. <br />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...<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-33000857597831211372009-03-16T13:03:00.009+00:002009-03-17T10:25:55.718+00:00The OPAQUE FilterI 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!<br /><a href="http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1228081049">3d Textured Globe</a><br />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.<br /><div><br /><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLQB8-Vm_RPpJOWebVL-Y0MXl5Qzk-7GNmdyDgvVrycwjYtxaqYKxOokhN0m4pxIM9IFB0nSFSF9S_s6-pSv8nnM3PDqivLJNGbU6QEBMGzypTshJhaPl3rLBb4FdBTX8GVBln2WRhVIA/s1600-h/i0alpha.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 250px; height: 300px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLQB8-Vm_RPpJOWebVL-Y0MXl5Qzk-7GNmdyDgvVrycwjYtxaqYKxOokhN0m4pxIM9IFB0nSFSF9S_s6-pSv8nnM3PDqivLJNGbU6QEBMGzypTshJhaPl3rLBb4FdBTX8GVBln2WRhVIA/s320/i0alpha.jpg" alt="" id="BLOGGER_PHOTO_ID_5313778816519312306" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmO_oGerVty8vpHZllIRol5fS_UOXUcW4ujadlc1BgTfPlqLCNLHEmPJdhiVKyHSbF2mbHjsPME7nnr_VlwTUXnfj9VJrurLXYNGsoXRzrGksg0FH65doPpT7edZWFDcaDklW6YX3RLn8/s1600-h/i0.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 250px; height: 300px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmO_oGerVty8vpHZllIRol5fS_UOXUcW4ujadlc1BgTfPlqLCNLHEmPJdhiVKyHSbF2mbHjsPME7nnr_VlwTUXnfj9VJrurLXYNGsoXRzrGksg0FH65doPpT7edZWFDcaDklW6YX3RLn8/s320/i0.jpg" alt="" id="BLOGGER_PHOTO_ID_5313779644554724562" border="0" /></a><br /><br /><br /><br /><span style="font-style: italic;"><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />Translucent Image</span><span style="font-style: italic;"> Same image with OPAQUE filter applied</span><br /><br /></div></div> <br /><span>To see the spinning egg, before the opaque filter was applied and to play the finished snap game visit <a href="http://www.solundrian.com/snappyE/dist/launch.html">here</a>.</span><span style="font-style: italic;"><br /></span><div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-56957181452696633292009-03-13T16:36:00.002+00:002009-03-13T16:39:52.923+00:00The GRAY Filter<p align="center"><br /><iframe src="http://www.solundrian.com/procs/Gray/applet/index.html" scrolling="no" width="520" align="center" height="320">&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;gt; &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;gt;Your browser does not support iframes.&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;gt;&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;gt;</iframe><br /></p>Turns the contents of the display screen to grayscale.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0tag:blogger.com,1999:blog-6667097412706957271.post-5367059738788717342009-03-13T15:45:00.004+00:002009-03-13T18:40:52.424+00:00The ERODE and DILATE Filters<p align="left"><br /><iframe align="center" SCROLLING="auto" src="http://www.solundrian.com/procs/filtersErode/applet/index.html" width="800px" height="400px">&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;gt; &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;gt;Your browser does not support iframes.&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;gt;&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;gt;</iframe><br /></p><br /><br /><span style="font-style: italic;">ERODE left - Dilate centre - Origunal right. The filter has been applied 10 times in this example.<br /><br /></span>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.<br />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.<br />By repeatedly applying the filters to an image however, the effect becomes more noticeable.<br />ERODE lessens the presence of light areas and DILATE increases them.<div class="blogger-post-footer">http://www.solundrian.com
FREE Java RPG game</div>CodeCoasterhttp://www.blogger.com/profile/14315478939824269137noreply@blogger.com0