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

<channel>
	<title>Conor's Blog &#187; icsp</title>
	<atom:link href="http://blog.macaoidh.name/tag/icsp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.macaoidh.name</link>
	<description>PHP, Music, Linux</description>
	<lastBuildDate>Thu, 02 Sep 2010 12:38:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Java &#8211; Drawing Squares</title>
		<link>http://blog.macaoidh.name/2009/12/05/java-drawing-squares/</link>
		<comments>http://blog.macaoidh.name/2009/12/05/java-drawing-squares/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 03:28:07 +0000</pubDate>
		<dc:creator>Conor</dc:creator>
				<category><![CDATA[College]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[icsp]]></category>
		<category><![CDATA[reges]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[shape]]></category>
		<category><![CDATA[squares]]></category>

		<guid isPermaLink="false">http://blog.macaoidh.name/?p=284</guid>
		<description><![CDATA[This weeks ICSP assignment was to write a program which draws squares. The task was to draw squares from a set list in an array, but I opted rather to accept a command line argument in my script. To write this I had to delve back into regular expression, which I hate because I don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>This weeks ICSP assignment was to write a program which draws squares. The task was to draw squares from a set list in an array, but I opted rather to accept a command line argument in my script. To write this I had to delve back into regular expression, which I hate because I don&#8217;t understand!</p>
<p>The program source is below. You should execute the program from the command line giving the with and height of the square you wish to draw, for example:</p>
<pre class="brush: bash">
java Squares 4x4
</pre>
<p>And the code:</p>
<pre class="brush: java">
import java.lang.String;
import java.util.regex.*;

public class Squares{
        public int dimensions[];

        public Squares(String[] args){
                if(args.length==1){
                        Pattern form=Pattern.compile("^\\S+x\\S+$");
                        Matcher fit=form.matcher(args[0]);
                        if(fit.matches()){
                                try{
                                        String[] dims=args[0].split("x");
                                        int width=Integer.parseInt(dims[0]);
                                        int height=Integer.parseInt(dims[1]);
                                        this.dimensions=new int[] {width,height};
                                }
                                catch(NumberFormatException e){
                                        System.err.println("Argument must be a string, width by height, in the form 6x6");
                                        System.exit(1);
                                }
                        }
                        else{
                                System.out.println("Argument must be a string, width by height, in the form 6x6");
                                System.exit(1);
                        }
                }
                else{
                        System.err.println("Please supply an argument, which must be a string, width by height, in the form 6x6");
                        System.exit(0);
                }
        }

        public String draw(){
                int i;
                int z;
                int width=this.dimensions[0];
                int height=this.dimensions[1];
                String square="";

                for(i=0;i&lt;height ;i++){
                        for(z=0;z&lt;width;z++){
                                if((i==0||i==height-1)&#038;&#038;(z==0||z==width-1))
                                        square+="+";
                                else if(z==0||z==width-1)
                                        square+="|";
                                else if((i==0||i==height-1))
                                        square+="-";
                                else
                                        square+=" ";
                        }
                        square+="\n";
                }

                return square;
        }

        public static void main(String[] args){
                Squares square=new Squares(args);
                String draw=square.draw();
                System.out.println(draw);
        }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.macaoidh.name/2009/12/05/java-drawing-squares/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java &#8211; Project Euler Multiples</title>
		<link>http://blog.macaoidh.name/2009/11/21/java-project-euler-multiples/</link>
		<comments>http://blog.macaoidh.name/2009/11/21/java-project-euler-multiples/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 18:32:05 +0000</pubDate>
		<dc:creator>Conor</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[1000]]></category>
		<category><![CDATA[3]]></category>
		<category><![CDATA[5]]></category>
		<category><![CDATA[euler]]></category>
		<category><![CDATA[icsp]]></category>
		<category><![CDATA[multiples]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[project euler]]></category>

		<guid isPermaLink="false">http://blog.macaoidh.name/?p=272</guid>
		<description><![CDATA[This weeks ICSP assignment was one of the Project Euler challenges. Here is the task: This weeks Bonus Task is to solve the First Problem using Java: &#8220;If we list all the natural numbers below 10 that are multiples of 3 or 5, we * get 3, 5, 6 and 9. The sum of these [...]]]></description>
			<content:encoded><![CDATA[<p>This weeks ICSP assignment was one of the <a href="http://projecteuler.net/index.php?section=about">Project Euler</a> challenges. Here is the task:</p>
<p>This weeks Bonus Task is to solve the First Problem using Java:<br />
&#8220;If we list all the natural numbers below 10 that are multiples of 3<br />
or 5, we * get 3, 5, 6 and 9. The sum of these multiples is 23.</p>
<p>Find the sum of all the multiples of 3 or 5 below 1000.&#8221;</p>
<p>In the code below, I have achieved this objective and also expanded on it. My program allows you to pass on two multiples and a max integer value to the program for which to calculate the results. You can execute:</p>
<pre class="brush: java">java Multiples 3 5 1000</pre>
<p>That command will find the sum of multiples of 3 and 5 below 1000, as stated in the task. You can also change the values to calculate different sums. The code for Multiples.java is below:</p>
<pre class="brush: java">/*
 * Developer:   Conor Mac Aoidh
 * Homepage:    http://blog.macaoidh.name/2009/11/21/java-project-euler-multiples/
 */

public class Multiples{
        public static void main(String[] args){
                Multiples multiples=new Multiples();
                int one=0;
                int two=0;
                int max=0;
                if(args.length==3){
                        try{
                                one=Integer.parseInt(args[0]);
                                two=Integer.parseInt(args[1]);
                                max=Integer.parseInt(args[2]);
                        }
                        catch(NumberFormatException e){
                                System.err.println("Argument must be an integer");
                                System.exit(1);
                        }
                }
                else
                        System.out.println("You must supply integers in the format:\n multiple_one multiple_two max_integer");

                int sum=multiples.sum(one,two,max);

                System.out.println("Find the sum of all the multiples of "+one+" or "+two+" below "+max);
                System.out.println("Sum:"+sum);
        }

        public int sum(int one,int two,int max){
                int i=0;
                int sum=0;
                for(i=0;i&lt;max ;i++){
                        if(i % one==0)
                                sum=sum+i;
                        if(i % two==0)
                                sum=sum+i;
                }
                return sum;
        }
}</pre>
<p>Simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macaoidh.name/2009/11/21/java-project-euler-multiples/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ICSP Week One Assignment</title>
		<link>http://blog.macaoidh.name/2009/10/25/icsp-week-one-assignment/</link>
		<comments>http://blog.macaoidh.name/2009/10/25/icsp-week-one-assignment/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 20:38:05 +0000</pubDate>
		<dc:creator>Conor</dc:creator>
				<category><![CDATA[College]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[caputre the flag]]></category>
		<category><![CDATA[icsp]]></category>
		<category><![CDATA[Scratch]]></category>

		<guid isPermaLink="false">http://blog.macaoidh.name/?p=250</guid>
		<description><![CDATA[I started a course in UCD last week called &#8220;Introduction to Computer Science and Programing&#8221;, or ICSP. It&#8217;s gonna be going on for three months and then I will have a big exam which I will probably fail! The whole course centers around the use of Java, I&#8217;m not sure yet if we are going [...]]]></description>
			<content:encoded><![CDATA[<p>I started a course in UCD last week called &#8220;Introduction to Computer Science and Programing&#8221;, or <a href="http://www.csi.ucd.ie/content/introduction-computer-science-and-programming-icsp2009">ICSP</a>. It&#8217;s gonna be going on for three months and then I will have a big exam which I will probably fail!</p>
<p>The whole course centers around the use of Java, I&#8217;m not sure yet if we are going to be using anything else. We haven&#8217;t actually even started with Java yet, but we are using this program called <a href="http://scratch.mit.edu/">Scratch</a> to program our Java for us! I wouldn&#8217;t say that it is the Dream-weaver of Java, far from it. In fact I think that it is a great method of getting into Java. It has a set of preconfigured code which you can arrange into blocks, which then run &#8211; quite similar to the source of Java actually except simplified. It also eliminates the need for compiling.</p>
<p>Last week I went to my first &#8220;lecture&#8221; which was good enough, but I learned something valuable that day; computer hardware is not the road that I want to go down! I didn&#8217;t really enjoy the hardware aspect of the day but when it came to the Scratch lessons I was flying! For our first assignment we had to write a game in Scratch, which is essentially it&#8217;s own unique programing language. The game is called &#8220;Capture the Flag&#8221;. I was actually flat out all week and didn&#8217;t get a chance to start work on it until today, which is coincidentally the deadline for it&#8217;s completion! I spent about three hours making the game, here&#8217;s the manual and the game:</p>
<h3>Capture The Flag</h3>
<p><strong>Overview</strong><br />
Capture the flag is a simple two player game which involves stealing the flag from the opposite colours corner.</p>
<p><strong>Controls</strong><br />
Blue Player<br />
Up Arrow Key = Move Up<br />
Down Arrow Key = Move Down<br />
Left Arrow Key = Move Left<br />
Right Arrow Key = Move Right</p>
<p>Red Player<br />
W Key = Move Up<br />
S Key = Move Down<br />
A Key = Move Left<br />
D Key = Move Right</p>
<p><strong>Rules</strong><br />
To gain a point a player must capture the opposite colour flag and return it to their base (the starting point).</p>
<p>If a player is in possession of a flag and his opponent touches him the flag is returned to it&#8217;s base and the player to his base.</p>
<p>To win a player must gain three points.</p>
<p><strong>Faults</strong><br />
The one fault with the game is that, at least on my computer, when one player is using the keyboard to move the other player cannot move simultaneously. Although this is a fault it does also make the game a bit more interesting because the players have to fight even to move!</p>
<p><applet id='ProjectApplet' style='display:block' code='ScratchApplet' codebase='http://scratch.mit.edu/static/misc' archive='ScratchApplet.jar' height='387' width='482'>
<param name='project' value='../../static/projects/ConorMacAoidh/732336.sb'></param></applet> <a href='http://scratch.mit.edu/projects/ConorMacAoidh/732336'>Learn more about this project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macaoidh.name/2009/10/25/icsp-week-one-assignment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Year of macaoidh.name</title>
		<link>http://blog.macaoidh.name/2009/09/22/one-year-of-macaoidh-name/</link>
		<comments>http://blog.macaoidh.name/2009/09/22/one-year-of-macaoidh-name/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 22:35:42 +0000</pubDate>
		<dc:creator>Conor</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Me]]></category>
		<category><![CDATA[My Blog]]></category>
		<category><![CDATA[The Dominican Affair]]></category>
		<category><![CDATA[icsp]]></category>
		<category><![CDATA[java.facebook application]]></category>
		<category><![CDATA[macaoidh.name anniversary]]></category>

		<guid isPermaLink="false">http://blog.macaoidh.name/?p=237</guid>
		<description><![CDATA[Would you believe it? It&#8217;s the first anniversary of my Blog! I have officially been ranting about shite for a whole year! Anyway to celebrate the birthday of my Blog I decided to do it up a wee bit. I added a nice wee sidebar to my theme, which I am actually thinking of releasing [...]]]></description>
			<content:encoded><![CDATA[<p>Would you believe it? It&#8217;s the first anniversary of my Blog! I have officially been ranting about shite for a whole year!</p>
<p>Anyway to celebrate the birthday of my Blog I decided to do it up a wee bit. I added a nice wee sidebar to my theme, which I am actually thinking of releasing at some stage in the near future. Also I added a new download manager to http://files.macaoidh.name . It is very useful; it keeps track of how many people are downloading what. Hopefully in the future it will give me an idea of what people that view my blog like and don&#8217;t like. I will actually have to go over all my previous posts and make sure that the download links are correct considering there was a big change in the link format.</p>
<p>The only real reason I wrote the thing is because someone has commissioned me to do something similar, starting next week. But the commissioned work will be a bit more complete and stuff. So feel free to try and hack my system. I don&#8217;t want to find faults when I&#8217;m finished writing it and then have to go back&#8230; The manager also serves as a very useful tool for me. I have included an admin area in which I can log in, upload files and choose to store them, make them available for download or even to download + password protect them! This feature will no doubt come in handy, I like to think of it as my personal, non-user-information-gathering, version of Google Docs!</p>
<p>What else has been happening recently&#8230; ooh I am in the process of making/releasing an album with The Dominican Affair. It is called Stealing the Ceiling. We have our last mixing session this weekend and hope to have it available on piratebay towards the end of October! It will also be available to purchase or download at http://www.holygrailrecords.com</p>
<p>Just thought I&#8217;d mention that 6th year is terribly shit. I can manage to squeze about 2 hours of programing in thrice a week. Also I am doing an<a href="http://www.csi.ucd.ie/icsp"> Introduction to Computer Science Programing </a>course in UCD over the next few months just to prepare me for college and to make sure that I actually want to study Computer Science! It will be good craic to learn Java at that course; I plan to make a facebook application/game when I have learned Java and base it in Monaghan.</p>
<p>Oghgbjkc damn! I just realised that I still haven&#8217;t renewed my macaoidh.name subscription! Better get to it&#8230; three days left&#8230;..</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.macaoidh.name/2009/09/22/one-year-of-macaoidh-name/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
