Giter Club home page Giter Club logo

flight_simulator's Introduction

Flight Simulator

In this exercise you will create a flight simulator! Don't worry (or don't be too disappointed) there won't be any fancy graphics.

The idea is to let a plane fly over a map and land and start at airports. First this will only happen in the tests (so hey, you can work test-driven!). Then you might want to write a program that let's the plane fly a fixed route. Afterwards you can make this program dynamic through randomization and a simple artificial intelligence. As a last step for this exercise we can build a command line interface to steer an airplane interactively.

Bonus tasks:

  • add a multiplayer mode
  • display the map with airports and airplanes
  • display it in the browser
  • create a mulitplayer mode that works ofer the network

;-)

First Iteration

Let's first set up the basics. Read the tasks, then make the tests green one by one. Just fulfill the requirements - and use the same names! The tests are already written, so you just have to make them pass.

Running the tests:

Use Ruby 2.1.x or newer and install the latest version with gem install minitest

Read more about it: https://github.com/seattlerb/minitest

  • to run one file: ruby -Ilib:test test/map_test.rb
  • to run one test: ruby -Ilib:test test/map_test.rb --name test_width_is_set

I also added a Rakefile which enables you to run all the tests at once:

  • rake test :-)

The Map

  • create a Map class with height and width attributes

The Airports

  • create a Airport class with x and y attributes for the position
  • add a method position in the Airport class that returns the coordinates

The Airplane

  • create an Airplane class with attributes for position (x and y), flying, speed and fuel
  • in the setters of speed validate it is between 0 and 10 (do not raise an error)
  • add a method accelerate that increments the speed by 2
  • add a method slow_down that decrements the speed by 1
  • add a method take_off that changes the value of flying to true and accelerates
  • add a method touchdown that changes the value of flying to false and calls slow_down

flight_simulator's People

Contributors

mediafinger avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

sbartek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.