ObbyOss
ObbyOss

Reputation: 351

JavaScript Help: Creating a Study Game - Matching & Fill in the Blank

I'd like to create a simple JavaScript program to help me study but I'm having a difficult time figuring out how to design it. I'm still rather new at JS, and this would actually be my first app not copied from a book.

Example scenario: I have countries and under each one I have events based in that country. England: Battle of Britain, King Arthur. US: Ford, First on the Moon. Etc.

I'm creating a game that would allow me to play multiple games with myself. One would be a simple matching game: You have a set of events and you have to match them to the country. Another would be asking a question and me filling in the blank.

My questions are these:

Thanks for helping me work through this.

Upvotes: 0

Views: 360

Answers (1)

Anzel
Anzel

Reputation: 20563

MongoDB stores all data in documents, so the less relationship between your data the better. Don't try to think or construct your data in a relational manner.

I would suggest to create a collection perhaps called quiz. and in quiz there are only 3 fields you need: country, events and random.

construct your data like this:

{
    country: COUNTRY,
    events: [ EVENT1, EVENT2, ... ],
    random: RANDOM
}

see this link for more information The Random Attribute Once you pick your "random" COUNTRY, you can randomize events from the array. Then it is only a matter how to place your COUNTRY & EVENTS as Q&A.

P.S. Not clear about whether you want random COUNTRY and its random EVENTS, or you mean random COUNTRY with irrelevant random EVENTS.

Upvotes: 1

Related Questions