-3

OK, I have an app that I'm creating but I'm just really not sure about how to approach the problem.

The idea is fairly simple. I'm just not sure how to wrap it in a data model (or even if I should). TBH I feel like I'm making it more complicated than it needs to be.

How it works.

The app will have circles along the top in a row that need to be connected to circles along the bottom in a row. 10 circles at the top. 10 at the bottom. One connection per pair of dots.

Anyway, I can get the dots to connect I'm just not sure how to wrap it in a data model so that I can analyse what has been connected and see if it is right or not.

The circles will be questions and answers.

I can make an array of question objects with a question and answer properties. I can then display these as the dot pairs. I'm just not sure how to record which questions have been connected to which answers.

It is valid for a user to connect a wrong answer as they all get checked at the end.

I was thinking of using SpriteKit but this isn't a restriction. I could use UIKit or something else. TBH, this question is fairly language free as I'm just after a way of modelling it.

1
  • 2
    what is the question?
    – gnat
    Nov 3, 2013 at 15:59

1 Answer 1

2

I'd do it with a pair of dictionaries which are lists of key-value pairs. The keys in this case are the questions and the values are the answers.

You'd have one dictionary that is the "Correct" dictionary for a given question set. You'd then have a dictionary that gets filled as the user selects question and answer pairs. Once they have selected all the question and answer pairs, you simply test the dictionaries against each other. If they are the same then the user is correct and you can go from there.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.