code invaders

Uploaded from authorPOINTLite
Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Code Invaders: 

Code Invaders All your code now belong to us Make your time

What’s An AI: 

What’s An AI Alan Turing (1950) Turing Test Can computer’s think? "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.” - Dijkstra What is an AI?

Let’s Play Some Games: 

Let’s Play Some Games Snakes and Ladders Battleships TicTacToe Checkers Chess Go

Your Mission should you choose to accept it: 

Your Mission should you choose to accept it Develop an AI for a ship Points for collecting energy Points for delivering energy to your home world Points Shooting the Enemy Evaluate current situation Perform an action given that situation The computer does not think

Let’s Review: 

Let’s Review What is AI? What is the Turing Test? Does Snakes and Ladders need AI? Does TicTacToe need AI? What are the steps in AI?

Setup: 

Setup Eclipse plugin CSB computers have Code Invaders installed Download Eclipse and plugin www.eclipse.org http://slammer.cs.dal.ca/~cjordan CodeInvaders zip file Unzip into plugin directory Does not work on Mac

Getting Started: 

Getting Started Start Eclipse File -> New -> Project Other -> Game Project Select Code Invaders Name your project Select a directory for your workspace U drive, USB stick

Ok Rookies, Let’s take off: 

Ok Rookies, Let’s take off This is a fresh install Your ship does nothing Select games.xml Name your ship and organization Add yourself Run Escape quits early Each match runs for a set number of turns 1200

Move Your Zig: 

Move Your Zig Every turn your ship’s move method is called src -> default package -> MySpaceShip.java You can put all your code in move(int) this.setThrust(SpaceShip.MAX_THRUST); Run again double target = this.getHeadingTo(this.getHomePlanet()); this.turnToHeading(target); Run again

Some Documentation: 

Some Documentation Help -> Help Contents -> CodeInvaders -> CodeInvaders Manual Use the Eclipse auto help this. Wait See the info box?

Some Ship Functions: 

Some Ship Functions fire() - fires a shot at current heading pulse() - pulse wave is fired setShieldUp() - rises shield for 30 turns getDistanceTo(IObject) - distance to object setRotationThrust(double) - turning speed beamEnergy() - beam energy to planet beamEnergy(IShip) - energy to ship getMyDrones() - an array of your drones

The World: 

The World World.getOtherShips() - array of ships World.getOtherDrones() - array of drones World.getEnergySources() - array of energy source World.getBullets() - array of bullets World.getPulses() - array of pulses

Fighting Other Ships: 

Fighting Other Ships Add other sample ships Run a server Window -> Preferences -> Games -> Start Other people can now submit ships to your server games.xml -> Game Server Server host name = your computer Submit Code Add other people’s ships Run

Designing your AI: 

Designing your AI Evaluate game conditions Like TicTacToe! if (Chris is awesome) give him good evaluation else if (class boring) beat Chris else if (confused) rise hand if (sleepy) drink coffee

Another layer of complexity: 

Another layer of complexity Droids Same capabilities as your ships Stores less energy Smaller You have 3 of them Counters Declare them in your MySpaceShip class Initialize them in initialize() Use them in move()

Someone set us up the bomb: 

Someone set us up the bomb Term Project Report Explain your strategy Explain different conditions you test for Explain different actions you perform Explain what priorities you have Code Comment each code block if/else while for Any complex chunk of code Demo

For Great Justice: 

For Great Justice You will fight the Wong-a-tor Victors will get a 5% Bonus Mark You will fight each other Winner has lunch with the Dean