Tuesday, October 25, 2011

5 questions that may help to study for the midterm (but maybe not)

Q1:  What equivalence relations hold for an “object.equals” method?
Reflexivity, Symmetry, Transitivity
Q2:  What are the two primary purposes of Code Review?
  • To ensure efficiently quality of the code that is being released
  • To learn when and how to apply techniques that will improve the codes quality, consistency and maintainability.
Q3:  Write a simple Robocode program that would make your robot move forward 50 pixels, spin around in a circle and then stop.
simpleRobot extends robot{
while(true){
ahead(50);
turnRight(360);
stop();
}
}
Q4:  Name four available checks that checkstyle can implement, and what they do.
  1. Empty Block - checks for empty blocks of code
  2. illegal type - checks that particular class are never used
  3. Indention - checks correct indentation of code
  4. LineLength - checks for long lines
Q5: Name 3 suggestions/reasons from the reading over why you should use Git rather than SVN
  • Git is distributed and delivers a complete copy of the history of the project, and in this way can be more efficient than svn
  • It is faster and easier to create branches
  • you can commit changes in stages

Tuesday, October 18, 2011

SVN and Google Projects Hosting


As we continue to spelunk into the vast realm of software engineering and explore its extensive catalog of developer tools, we came across a real gem this past week, something quite invaluable to any application developer.  The tool is called SVN and is a configuration management program that allows other developers to download your source code and make contributions to it.  In conjunction with this tool is a Google powered hosting site called Google projects hosting which allows the developers to “broadcast” their code to a targeted community.  With Google projects hosting one can even attract and build a community of their own that is centered on a custom project that they have posted. 
                Though this tool is an extremely powerful and useful tool for developers, it is strictly that, a tool for developers.  Initially, it was not very clear to me what this was for or what we were trying to accomplish, but soon after it became blatantly clear.  The initial experience of getting everything synced up was a bit convoluted (which is why it is an application for developers), but after the setup, it was quite simple to commit changes to the project.  It was only a matter of minutes after the setup that I was able to upload and see the changes that I'd made to the system on the hosting site.  One of the more interesting aspects though which really amazed me was the speed at which people could post their updates.  Whenever someone would change something in a file for instance, it was an instantaneous update that appeared on the hosting site; and after re-syncing the SVN application with your system the new additions would appear in your system.  The ability for developers to have instantaneous feedback and contributions from other developers is what I think has probably allowed technology these days to progress so quickly, and the exposure to this tool has been somewhat of an epiphany for me of the potential that it holds.
                The other half of this assignment was to create our own project hosting site.  After navigating through the process of locating all the necessary things for an upload on the other hosting site, this was quite simple to do on my own.  However, the only thing that was a bit of a hassle was uploading the files to the correct directory.  I assume that there is a more efficient way of doing this but to get this done, I had to individually upload each file from my system into the trunk directory of the hosting site.  I guess there is probably some way to configure svn to do this, but from the administrator stand point this would be much easier to if there were a mass file uploading feature in Google hosting.  
 Hosting Site:
http://code.google.com/p/robocode-eje-bumblebee/

Tuesday, October 11, 2011

competitive robot

For the continuing project of our Robocode implementation, we were asked by our professor to create a “competitive” robot based on the knowledge that we had acquired from the earlier exercises.  Utilizing the three basic platforms of movement, targeting and radar, along with some strategic blocks of code, a competitive robot can be built.  What it really comes down to though in the competitive arena is the strategic calls in the code blocks, and how you would expect you robot to perform when certain events happen.  
Well, as far as for my design, I thought that I had a pretty clever strategy which in theory would have been a very difficult opponent to beat.  My strategy was to have my robot circle around its opponent and simultaneously fire in towards its target.  However, through much frustration and a couple of visits to the robocode wiki page, to accomplish something like this while using just the basic robocode package and no other interface would have been near to impossible.  There was a robot from another person that basically had the strategy I wanted to build, however they’re robot extended the advanced robot interface, so to try and build something that just didn’t have the capabilities within its class would have been extremely difficult.
So I settled for a slightly different strategy for my robot. for the movement, I decided that I would have my robot adjust its position only when necessary due to the nature of its targeting strategy.  It turns out that the tracking and targeting style that I chose to implement works best when the robot is stationary, and can inflict the most damage on its target this way.  Therefore, I used the on hit by bullet method to call the movement adjustment.  For the firing strategy, I decided to go with one that would conserve my robots ammo due to the observation that the robot would sometimes run out of ammo before the round would be over.  The robot automatically adjusts its bullet strength according to the distance of the target.
Being that I was unable to implement the strategy that I originally wanted, this other one actually preformed pretty well.  It beat out most of the robots except for the spinbot and ramfire.  I think a weak point in my design probably was due to the fact that I didn’t really have any strategy to execute for something like a collision with another robot.  Its here that i think my robot what become overwhelmed by the ramming bot.  This could probably be improved with something like a fluid movement.  The spinbot seemed to come in first every time because I think its probably one the the hardest targets to hit due to its constant motion.  I think for my design that tracking and adjustment of the gun was a bit delayed and couldn’t pinpoint the targets movement.  This could probably be improved with something a little more advanced that would allow the robot to predict the targets movements.  
The approach for testing that I relied on probably wasn’t the best approach, but was basically a trial and error type of approach.  I would add segments of code in spots that I though it would probably be most effective, and had even tried to build the methods that would perform the circling methods.  However, I think that I probably wasted a lot of time trying to implement such a complicated battle strategy with little that this basic package provided.  
The lessons learned from my experience of building this competitive robot would be to possibly come up with more than one plausible strategy, and something within the range and capabilities of the tools on hand.  Though I knew that my original battle strategy would be very difficult to implement I decided to try and tackle it anyway.  However I should have realized in a much earlier stage that it wasn’t plausible, and should have started on a new strategy within the capabilities of the class and package.