Created
September 5, 2016 10:57
-
-
Save Darmaal/e9a6573695d4e6082ee2e7f10906826c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let systemName = "Solar System" | |
var OurPlanetsNames = ["Mercury","Earth","Venus","Mars","Jupiter","Saturn","Uranus","Neptune"] | |
//Dictionaries are ideal for data structure. First -> a key -> a colon -> a value assigned to the key | |
let planetData = [ | |
"Mercury":"A very hot planet, it is the closest in the solar system the Sun.", | |
"Venus":"It's very cloudy here!", | |
"Earth":"There is somethign very familiar about this planet.", | |
"Mars":"Known as the red planet", | |
"Jupiter": "A gas giant, with a noticeable red sport.", | |
"Saturn": "This planet has a beautiful rings around it. ", | |
"Uranus": "Strangely, this planet rotates around on its side. ", | |
"Neptune": "A very cold planet, furtheest from the sun." | |
] | |
//this function map -> array of planets objects -> | |
let planets = planetData.map { name, description in Planet(name: name, description: description)} | |
let SolarSystem = PlanetarySystem(name: systemName, planets: planets) | |
let adventure = SpaceAdventureModified(planetarySystem: SolarSystem) | |
adventure.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment