Friday, August 31, 2007

Code Ruler Review





































FileLinesViolationsComments
MyRuler.java22, 23, 25, *EJS-5Code indents 4 space. It should be 2
MyRuler.java22, 23, 90, *EJS-7
MyRuler.java36, 37, 38, *EJS-8
MyRuler.java66EJS-35Need to clearly describe what this method does in terms of strategy.
MyRuler.java232EJS-54Need to describe the x and y parameter.

Wednesday, August 29, 2007

Code Ruler Results

LINK TO CODE:
http://www2.hawaii.edu/~eykim/eykim.zip is the link to the file


MEMBERS:
Since I am the only person that worked on this project I guess I am the only person to list.


RESULTS:
The strategy that I used was to take the first two knights and send them to attack the enemy's peasants. This is to cut off the amount of land they can accumulate therefore cutting down the number of peasants and knights that they can produce. The next three knights are sent to take over castles. This is to ensure that the enemy cannot produce anymore knights or peasants and to ensure that if my own castle is taken over, I have a squad ready to take it back. The remaining knights are sent to attack the others knight in an effort to keep them at bay. If there are no more remaining peasants, then those first two knights are sent to attack more knights. If there are no castle, those knights also fight more knights.

If there are no knights, peasants, or castle, then the knight remain where they are and all the castle under my control produce mass amounts of peasants to accumulate land since land can bring the score up a considerable amount.


SCORES:
migrate Ruler
eykim: 445

Migrate: 113
eykim: 435
Migrate: 134

eykim: 456
Migrate: 123


Split Ruler
eykim: 236
Split: 220

eykim: 105
Split: 436

eykim: 20
Split: 480


Gang Up
eykim: 436
Gang: 237

eykim: 412
Gang: 380

eykim: 230
Gang: 234



Against the three samples, my own strategy didn't work as well as I thought it would. Against migrate though I did fantastic. All three trial yielded high scores mostly due to the fact that the peasants were killed right away, the castle taken quickly, and all the knights were hunted down efficiently. For each trial I nearly triple the score of Migrate Ruler if not more. They stood no chance.

Against Split up Ruler, I didn't fair as well. To be honest, it was a crap shoot. If I was lucky enough to take their castle right off the bat, then I stood a solid chance of clearing all the peasants and then finally going after all the knights. If I couldn't capture their castle, then i found that as soon as my peasants died, the enemy knights would stop and amass in their castle. At which point they would demolish all knights that I would send toward them.

Against Gang up Ruler it was much the same way as Split up ruler. If I could take the castle then i stood a good chance of winning. If i didn't take the castle then I stood a good chance of just mindlessly sending knights to their doom against their castle, or being completely demolished right from the start.

LESSONS LEARNED:
I've learned that eclipse can be either a very handy tool or a nightmare. At first, it was a pleasure to use because I had a lot of my coding automatically filled out for me. But as I copy and pasted item here and there, I started to get random errors that I could not fix unless i just rewrote the code all over again.

Another nightmare was javadoc and learning how to use it. At first i tried to run javadoc through the command line but it would not recognize the javadocs command. I later learned that I needed to reinstall java again. Eventually i got it to work but only after hours of research, installing and reinstalling, and a couple red bulls.

As for CodeRuler, I realized that I knew what i wanted the object to do and when I wanted them to do it but to actually code it so that they listened to you was not as easy as I thought it would be. One feature I wanted the knights to do but couldn't figure out, was to make all the knights wait until there was a large number of them before they go off attacking someone. I also wanted the castle to produce knights at first and then peasants when the enemy knights were far away. But after an hour of watching simulation after simulation, I realized that most sample ruler go after peasants too! So i had to wait until all the enemy knights were dead before I started to produce more peasants.

All in all, it was quite difficult to make the strategies themselves. I went through multiply different scenarios from just taking castles over and over to just staying in my own castle. Through trial and error, i found that the smart split style of commanding your army was the best solution yet coding my own peasants and knights to act according was very difficult.

Wednesday, August 22, 2007

Jtag

The program I decided to download and review is called Jtag. It's a Java based ID3 tag editor. It basically edits the ID3 tag which is a data container within an MP3 that includes information such as Artist, Album, Song Title, and such. The reason I chose this program is because of my huge archive of MP3s. This program is useful because it will load a whole directory of Mp3s and edit all the ID3 tags.

Itunes and Windows Media Player all use ID3 tags when playing a song and displaying what song is being played. So if you were to upload a whole directory of songs and edited the file names so that each filename correctly represented the MP3s but left the ID3 tags how they were, Itunes or WMP will list each file using the ID3 tag which might confuse you. Or even worse, if your ID3 tags were blank, then you would have no idea what song would be playing until you recognized the song.

Editing each MP3 by hand is very tedious and cumbersome, which is where this program comes in. It can load a whole directory of MP3s and simultaneously edit all the tags or a selected few. As i tested this product, I find that it does what it is intended to do but also came with many features that just made it more and more useful. There is the option to rename all the files uploaded so that it reflects the artist and song title in the ID3 tags. Thus saving you the time it takes to rename each individual file. Although I did notice a few bugs where certain MP3 ID3 tags couldn't be edited although it says that it was edited in Jtag.

As for the second prime directive, this program might be a little tricky to use. There really is no installation process but also no intuitive "start button" as well. Those that don't know anything about .bat file might be reluctant to double click on that file. But all that's really needed to use the program is to double click that start.bat file and the program starts up right away. No installation is needed. A readme file would have been helpful but I'm sure enough poking around would have started the program.

As for documentation, the source code is included so you have access to the program and rewrite it to your needs or modify it so that it runs without bugs but there are sparse comments and no real documentation. Even so, the program doesn't seem to be overly complicated and a quick look at the function names and classes give a good idea of what it's about. After edited the files, it seems like you can just as easily compile the program and run it right away since there is no installation.








http://sourceforge.net/project/showfiles.php?group_id=44125

Tuesday, August 21, 2007

fizzbuzz

So I finally got around to doing the fizzbuzz homework and realized a few things. The first thing is that I've very rusty with java. It's been around 2 years, I think, since I really coded in java and this was a wake up call. I remember a lot of the functions and how to generally code in java but the specific things like the exact syntax eluded me. For example, I forgot that the for loop as ";" as delimiters and it took me a few minutes to figure that out. Stupid, huh?

Another speedbump was using eclipse itself. I'm not used to using an IDE. I generally code by hand and I kept finding myself hitting tab when eclipse would do it for me, throwing off my formatting. It actually took me quite a while just to find out where to type my code. I'm not used to starting a new project, looking for the src folder, creating a new class and finally writing code. I like to just open up note and start coding. I usually deal with where the file goes later, but I will admit that using eclipse is really helpful. Esp, since it list all the functions that matches what you're currently typing. Very helpful if you forget the exact name of the function.

Well here's my code...

public class fizzbuzz {

/**
* @param args
*/
public static void main(String[] args) {
int x;
for(x = 1; x < 101; x++){
if(x%15 == 0) {
System.out.println("fizzbuzz");
}
else {

if(x%5 == 0) {
System.out.println("buzz");
}

else {

if(x%3 == 0) {
System.out.println("fizz");
}

else {
System.out.println(x);
}

}
}
}
}

}

Completion time: 13 mins

I've come to realize that software engineering is like solving a puzzle. it's very creative and it's best to come in with a game plan instead of jst driving into it. I actually enjoy this very much and I think I'm going to really enjoy this class. I'm very anxious to see what else we are going to learn.