Introduction to Programming using Java Day 7 and 8 Review Robocode Robots!
Review Classes and Objects What 2 things an object has data methods public and private methods have return types one object may inherit from another
Instantiating an Object 2 ways String bob = “this is a string”; String bob = new String(“this is a string”); Pig wilbur; Pig wilbur = new Pig();
New Concepts packages imports
Robocode let's take a look at some java code
The Java API http://docs.oracle.com/javase/6/docs/api/
Robocode API http://robocode.sourceforge.net/docs/robocode/index.html?robocode/Robot.html
Task 7 Start the Robocode IDE Create your own Robocode Robot set the color of its bullets set the color of its body start a battle
Day 8 Review import package Robocode and API:
Robocode API http://robocode.sourceforge.net/docs/robocode/index.html?robocode/Robot.html
New Concepts Jar files Algorithms an algorithm is a step-by-step procedure for doing something
The “Getting Ready for School” Algorithm 1. wake up 2. get dressed 3. eat breakfast 4. brush teeth 5. assemble school items like lunch, homework, etc 6. leave for school
“Drive in a square” algorithm 1. drive 100 units 2. turn right 90 degrees 3. drive 100 units 4. turn right 90 degrees 5. drive 100 units 6. turn right 90 degrees 7. drive 100 units
Task 8 Part 1: make your robocode robot drive in a square Part 2: make up your own algorithm to have your robocode robot “do nothing” until it is hit 5 times by a bullet Part 3: write the program for Part 2!