Last active
October 1, 2019 05:54
-
-
Save natendaben/203f2908a122618fa2471e04f3870e1e to your computer and use it in GitHub Desktop.
MyBoulder PsuedoCode
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
// Each pre-defined idea will be stored in an object that has a title, an image, | |
// a description, an address, a category, and various booleans for season compatibility | |
// and whether or not the activity costs money. | |
// Example: | |
struct Idea{ | |
var title : String = "" //name of activity | |
var imageName : String = "" //name of image for activity | |
var description : String = "" //short description | |
var address : String = "" //address of activity location | |
var category : String = "" //can be "outdoors", "urban", or "entertainment" | |
var summer : Bool = false | |
var fall : Bool = false | |
var spring : Bool = false | |
var winter : Bool = false | |
var paid : Bool = false | |
} | |
var firstIdea = Idea() | |
firstIdea.title = "Paddleboard on Boulder Reservoir" | |
// etc. | |
// Obviously, I'll have to figure out a way to make this process more efficient | |
// for inputting ideas, probably with a constructor. I'll most likely store all | |
// of these Idea objects in a master array. | |
var masterList : [Idea] = [firstIdea, secondIdea ... etc.] | |
// Once I have all of my events in an array, I can iterate through the master array | |
// and add ideas to a new array if they meet the user's criteria. | |
var selectFromThisList : [Idea] = [] //make new array | |
// Make some variables for user preferences | |
var season : String = "summer" | |
var userIsWillingToPay : Bool = false | |
//etc. | |
// Use these preferences to iterate through master list and select qualifying ideas | |
for idea in masterList{ | |
if (season matches and category matches and price matches){ | |
selectFromThisList.append(idea) | |
} | |
} | |
//select a random idea from selectFromThisList array and pass it to next screen to load in info | |
var length : Int = selectFromThisList.count | |
var selectedIndex : Int = use math to select a random number in the range of 0 to (length - 1) | |
var selectedIdea : Idea = selectFromThisList[selectedIndex] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment