Code Invaders - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Code Invaders

Description:

fire() - fires a shot at current heading. pulse() - pulse wave is fired ... setRotationThrust(double) - turning speed. beamEnergy() - beam energy to planet ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 18
Provided by: Office2004364
Category:

less

Transcript and Presenter's Notes

Title: Code Invaders


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

2
Whats An AI
  • Alan Turing (1950)
  • Turing Test
  • Can computers 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?

3
Lets Play Some Games
  • Snakes and Ladders
  • Battleships
  • TicTacToe
  • Checkers
  • Chess
  • Go

4
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

5
Lets 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?

6
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

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

8
Ok Rookies, Lets 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

9
Move Your Zig
  • Every turn your ships move method is called
  • src -gt default package -gt MySpaceShip.java
  • You can put all your code in move(int)
  • this.setThrust(SpaceShip.MAX_THRUST)
  • Run again
  • double target this.getHeadingTo(this.getHomePlan
    et())
  • this.turnToHeading(target)
  • Run again

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

11
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

12
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

13
Fighting Other Ships
  • Add other sample ships
  • Run a server
  • Window -gt Preferences -gt Games -gt Start
  • Other people can now submit ships to your server
  • games.xml -gt Game Server
  • Server host name your computer
  • Submit Code
  • Add other peoples ships
  • Run

14
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

15
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()

16
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

17
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
Write a Comment
User Comments (0)
About PowerShow.com