[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Ideas about storing questions/answers for a boardGame.



On Jan 25, 2008 12:08 AM, marta sanz <p22sacam@xxxxxx> wrote:
> I see..
>
> I'm thinking of having questions grouped by subjects (p.e- maths,
> science,English,spanish,..), what do you see better, to have only a text
> file with all the questions/answers that the first word is the key :
>
> p.e-
> maths -- how much is 2+2? -- 4
> science -- which kind of animal is an eagle? -- a bird

from os import listdir

from filename in listdir:
   file = open(filename, "rb")
   text = file.read()
   (topic, question, answer) = text.split("--")
   if not base.has_key(topic):
      base[topic] = []
   base[topic] += [(question, answer)]





> With this option the problem I find is that I have to know how many subjects
> there are, because the number of colours of the squares depend on that (I
> mean, if the teacher wants to play with questions only of maths and science,
> the board will have squares red and other green, so when the player goes to
> a red square the game will show a math question, but if it's a green square,
> the question showed will be about science. If the teacher want to play also
> with questions about English language, the board will show red, green and
> yellow squares, and so on).
>
> Another solution I find is to have a text file for each subject (math.txt,
> science.txt,..) which I find more easy to work with since I don't have to
> check the first word of each line.
>
> I thought also that making a question editor would be a good idea...maybe if
> doing that, parsing the file with XML won't be much dificult since the
> teacher won't need to touch it directly...

The thing is: even "Notepad" or "gedit" have lots of features that
will take you a considerable effort to write, and you still have to go
through the testing and debugging of those editors. If they're there,
why not use them instead? By now those programs should be mature
enough not to be crashing for strange, obscure reasons.

>
> And finally, a thing I'm also not sure of, is the way of representing the
> question or/and answer during the game (maybe a pop-up?, maybe integrated
> on the screen of the game?..)
>
> Thanks so much to all ;)
>
> Marta.
>
>
> El 24/01/2008, a las 10:38, Chris Smith escribió:
>
>
> I too would go with just putting all the questions into a text editor. That
> way it's easy to edit and easy to spell-check the questions and answers.
> You'd need a little bit of code to parse the text files but Python is pretty
> good for that. Anything else would probably be overload.
>
> On 24/01/2008, Thiago Chaves <shundread@xxxxxxxxx> wrote:
> > There's not so much difference in "editing the text file manually" or
> > editing it inside a python program. Both require a similar amount of
> > typing.
> >
> > Plus Ethan's suggestion already takes care of the problem in a much
> > simpler way, and code is already provided.along wth his suggestion.
> > XML is overkill for that task.
> >
> > -Thiago
> >
> > On Jan 24, 2008 2:22 AM, James Paige <Bob@xxxxxxxxxxxxxxxxxxx > wrote:
> > > On Wed, Jan 23, 2008 at 07:15:05PM -0500, Ethan Glasser-Camp wrote:
> > > > marta sanz wrote:
> > > > >This game is aimed to be used by my sister's school teacher in her
> class
> > > > >of 10 years old kids. I said this because, despite the fact that I
> will
> > > > >give this game with some questions so they can play from the moment I
> > > > >give it to them, I would like the teacher to make her own question
> bank
> > > > >once the kids have learned the questions I give at the beginning, but
> > > > >have no idea of how can i do a simple bank and how can I access it
> from
> > > > >the pygame code.
> > > >
> > > > Hi,
> > > >
> > > > Someone else suggested XML, but personally that seems too heavyweight
> > > > for a teacher (with possibly no computing experience) to edit. Here is
> > > > what I would do:
> > >
> > > There is absolutely no reason the teacher has to edit the file maually.
> > >
> > > Make an "Edit Questions" mode, or a separate question_editor.py program
> > > that operates on the same data files. Provide one box where the teacher
> > > types the question, and a second box where the teacher types the answer.
> > > Then save the Q/A data in whatever format you decide on (XML, or text,
> > > or other)
> > >
> > >
> > > ---
> > > James Paige
> > >
> >
>
>
>