QB Reader 2.2 (now with speed adjustment)

Dormant threads from the high school sections are preserved here.
Locked
User avatar
LucasBrown
Lulu
Posts: 86
Joined: Fri Oct 23, 2009 5:34 pm

QB Reader 2.2 (now with speed adjustment)

Post by LucasBrown »

On the flight to HSNCT I found myself wishing I could use the Torrey Pines Quizbowl Database, so I wrote a script to function in much the same way as the database's "Read To Me!" section. I thought I'd share it with the rest of the QB community, so I posted it here.

I decided to turn the script into a semi-respectable coding project; the latest results are here. The program currently features a nice graphical interface using GTK+, a score tracking feature, and a specialized regex engine to account for variations in the acceptable answers. This answer-checking scheme must be declared only semi-sane, however, because it has a way of obfuscating answer lines that have a high degree of flexibility: for example, if the answer line is "The Stranger", we should accept "The Stranger", "Stranger", "L'Etranger", "Etranger", "The Outsider", and "Outsider". The most compact way to represent this in the program's regex scheme is {(The ){Strang|Outsid}|(L')Etrang}er. I have not had the time to convert the entire question bank answer set to this format; only the first 900-ish answers have been processed.


Features of the TPQBDB that are notably missing from this script are the following:
  • Login: Since this is made to run without the internet, why bother with logging in? You're the only one using your copy.
  • Categories: This will be implemented in a future version of the reader.
  • Tournament selection: Ditto
  • Difficulty selection: Ditto
  • Universal compatibility: technically, since the script is written in Python, anybody can run the script on any platform, but you will need to install GTK+ and Python to run it. Windows comes without either; Mac OS X, apparently, comes with Python, but doesn't seem to have GTK+. Linux users should be able to run the program without installing anything.
For versions 1.0 through 2.0, the project was hosted here; as of version 2.1, the project is hosted by Google Code. You can download it here.
Last edited by LucasBrown on Tue Oct 18, 2011 3:42 pm, edited 15 times in total.
Lucas Brown
Rancho Bernardo 2011
Caltech 2015

Every day is finals day.
"If people only knew how hard I work to gain my mastery, it wouldn't seem so wonderful at all." --Michelangelo Buonarroti
gyre and gimble
Yuna
Posts: 765
Joined: Tue Feb 17, 2009 2:45 am

Re: Torrey Pines Quizbowl Database without the internet

Post by gyre and gimble »

Mac OS X includes Python.
Stephen Liu
Torrey Pines '10
Harvard '14
Stanford '17
User avatar
grapesmoker
Sin
Posts: 6345
Joined: Sat Oct 25, 2003 5:23 pm
Location: NYC
Contact:

Re: Torrey Pines Quizbowl Database w/o the internet--ver. 1.2

Post by grapesmoker »

If I may offer a few pointers:
  • It's generally a good idea to avoid system-specific calls via os.system. In this case, you're using ls this way and that actually causes problems for your Windows users. What you want to do instead is use the glob module's glob function to give you a list of files in the Packets directory. This will make your script system-independent (and also more "Pythonic").
  • It's a pain to have to install Cygwin to use this, especially since most people probably have no idea how to work it. I know the terminal I/O sucks for Windows, but one thought here might be to hack up a simple interface using wxPython. You can install it quite easily on any system and run programs using it without needing to know any technical details (unlike Cygwin, where you have to be at least somewhat knowledgeable about what's going on). If I have some time I might give it a whirl, it should be quite straightforward.
Jerry Vinokurov
ex-LJHS, ex-Berkeley, ex-Brown, sorta-ex-CMU
presently: John Jay College Economics
code ape, loud voice, general nuissance
User avatar
LucasBrown
Lulu
Posts: 86
Joined: Fri Oct 23, 2009 5:34 pm

Re: Torrey Pines QB Database w/o internet--ver. 2.0 (GUI added!)

Post by LucasBrown »

I've hacked a graphical interface out of GTK+. Should have cross-platform compatibility now, as long as the computer used has Python and GTK+ installed, but I've only tested it on Linux.
Lucas Brown
Rancho Bernardo 2011
Caltech 2015

Every day is finals day.
"If people only knew how hard I work to gain my mastery, it wouldn't seem so wonderful at all." --Michelangelo Buonarroti
User avatar
LucasBrown
Lulu
Posts: 86
Joined: Fri Oct 23, 2009 5:34 pm

Re: QB Reader 2.1 (now with scoring and semi-sane ans. checking)

Post by LucasBrown »

The reader will now track your score and has a semi-sane answer-checking scheme. See the first post for details.
Lucas Brown
Rancho Bernardo 2011
Caltech 2015

Every day is finals day.
"If people only knew how hard I work to gain my mastery, it wouldn't seem so wonderful at all." --Michelangelo Buonarroti
User avatar
LucasBrown
Lulu
Posts: 86
Joined: Fri Oct 23, 2009 5:34 pm

Re: QB Reader 2.2 (now with speed adjustment)

Post by LucasBrown »

Version 2.2 is now available. You can now change the speed at which questions are read without closing the program, editing the source, and re-opening it.
Lucas Brown
Rancho Bernardo 2011
Caltech 2015

Every day is finals day.
"If people only knew how hard I work to gain my mastery, it wouldn't seem so wonderful at all." --Michelangelo Buonarroti
sharadmv
Lulu
Posts: 57
Joined: Mon Oct 05, 2009 1:24 am

Re: QB Reader 2.2 (now with speed adjustment)

Post by sharadmv »

Hey Lucas,

Can I contact you somehow about this answer regex stuff? I've been trying to think of a good way to detect if an answer is correct, and manually inputting regex seems like it would take forever to do all the questions.

Wanna talk about some other ideas using your regex?
Sharad Vikram
Torrey Pines '11
Berkeley '15
Creator of Quizbowl DB: http://www.quizbowldb.com
Locked