*Xcode Project Entry 3* Times Tables Quiz - Part 3
OK, back with the third entry for this app! Today - for the next half hour or so, I'm going to try to get the 'model' and the 'controller' sides of things. This means a database of the times tables, then having everything connected and working. Realistically, I'm not going to get far beyond the model elements. So let's give it a go!
Start Time - 17:37
MODEL -

So for this, it's the database for times tables facts. I think that would be best in a class.
CONTROLLER -

There's a lot for this so let's come back to it!
Paused at 18:30
Finished at 21:50 - didn't come back to it this evening
So a frustrating but interesting session! I've tried various things, using classes for building the question/answer format for the times tables. Lots of different things that have ultimately failed. But a great way to play around with something! I WILL get to the solution, without help. It simply has to happen - here's what we have at the moment.
*Going to make this a split entry - will continue this evening (53 minutes so far).
Start Time - 17:37
MODEL -

So for this, it's the database for times tables facts. I think that would be best in a class.
CONTROLLER -

There's a lot for this so let's come back to it!
Paused at 18:30
Finished at 21:50 - didn't come back to it this evening
So a frustrating but interesting session! I've tried various things, using classes for building the question/answer format for the times tables. Lots of different things that have ultimately failed. But a great way to play around with something! I WILL get to the solution, without help. It simply has to happen - here's what we have at the moment.
class TimeTablesDatabase {
var number1 = Int.random(in: 1...12)
var number2 = Int.random(in: 1...12)
}
class TimesTables {
var item = [TimeTablesDatabase]()
init() {
var result = 0
var questionString = ""
let randomNumber = Int.random(in: 1...12)
let randomNumber2 = Int.random(in: 1...12)
func tablesGenerator() {
for number in randomNumber...12 {
result = number * randomNumber2
questionString = "\(randomNumber) x \(randomNumber2)"
}
}
item.append(TimeTablesDatabase(question: "\(randomNumber) x \(randomNumber2)", answer: result))
}
}
class TimesTablesGenerator {
var randomNumber1 = Int.random(in: 1...12)
var randomNumber2 = Int.random(in: 1...12)
}
So lots of things that have come to nought at the moment. Basically, I need a way of generating random numbers between 1 and 12 (easy enough) but having that come up within either a function or object....yes it is a frustrating point to stop at for now and one of the least successful entries I've had but I have to stop to go to bed. There - done for today!
*Going to make this a split entry - will continue this evening (53 minutes so far).
Comments
Post a Comment