Question Mixer Program

Old college threads.
Locked
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Question Mixer Program

Post by Mike Bentley »

So this program I threatened to make more than a year ago is finally in some state of completion.

Essentially, the Question Mixer is capable of parsing tossups or bonuses (you can't do both at the same time at the moment) in a manner so that questions get spread out throughout a packet. Users specify a spacing number that is the minimum number of questions that must come between questions of the same category (for example, a number of 3 means there must be at least 3 questions in between Literature questions in a packet when possible). Besides that rule, the packet is generated randomly.

Even if you like mixing your packets manually, this should give you a decent enough random starting point to start changing things around with. And it could potentially save a lot of time if it's getting late at night or early in the morning and questions haven't been mixed yet.

I'd appreciate it if people could test this program out and let me know about any bugs they find. Because I wanted to preserve formatting, I had to delve into the depths of the Real Text Format, which can get pretty ugly. I'm sure there are probably some cases I overlooked that could mess things up.

Potential feature updates:
-Create a special text box for tiebreakers, which will always go at the end of the packet.
-Create a special text box for trash questions, which will never appear in the last few questions of a packet.
-Create a better process for parsing questions into categories. Ideally, I'd like to let the user paste in all of the tossups at once and set some values for how many of each category there are. For instance, if the first four tossups in the packet were lit, you'd just set a text field to be four and it would know the first four questions are all in one category. This would speed things up a bit, especially if you could save these values.

Download: http://www.doc-ent.com/quizbowl/QuestionMixer.zip
Source: http://www.doc-ent.com/quizbowl/QuestionMixerSource.zip (not so great looking at the moment. By the way it's in C# 2008)
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
Susan
Forums Staff: Administrator
Posts: 1812
Joined: Fri Aug 15, 2003 12:43 am

Re: Question Mixer Program

Post by Susan »

The idea of non-randomly randomizing questions by ensuring that all lit, history, etc. questions are spaced evenly throughout the packet is fairly divergent from my idea of randomizing. Would it be possible to get the randomizer to make sure that the first five questions include one lit, one history, and one science tossup (and two others) and so on for the next three sets of five?

The problem with randomly spacing questions is that one can easily figure out whether the next question is going to be lit, history, etc. While the effects upon gameplay of knowing in advance what type of question is coming up are fairly minimal, they can be easily avoided by randomizing the packet by quarters rather than even spacing.
Susan
UChicago alum (AB 2003, PhD 2009)
Member emerita, ACF
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Re: Question Mixer Program

Post by Mike Bentley »

myamphigory wrote:The idea of non-randomly randomizing questions by ensuring that all lit, history, etc. questions are spaced evenly throughout the packet is fairly divergent from my idea of randomizing. Would it be possible to get the randomizer to make sure that the first five questions include one lit, one history, and one science tossup (and two others) and so on for the next three sets of five?

The problem with randomly spacing questions is that one can easily figure out whether the next question is going to be lit, history, etc. While the effects upon gameplay of knowing in advance what type of question is coming up are fairly minimal, they can be easily avoided by randomizing the packet by quarters rather than even spacing.
If you set the spacing value to 2 (and even 3), I don't think you can say with any real certainty that the next question is going to be of a particular category. If you knew ahead of time that someone was using this program and not doing any manual shuffling, I guess you could infer that "hey we just heard a history tossup, we probably won't hear another one for 2-4 questions", but that's pretty much the assumption you make with all manually mixed packets.

But if people really want a mixing by quarters option, I can add it without all that much work.
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
User avatar
Mechanical Beasts
Banned Cheater
Posts: 5673
Joined: Thu Jun 08, 2006 10:50 pm

Re: Question Mixer Program

Post by Mechanical Beasts »

Under this system, you could have tossup one, five, nine, thirteen be the history, or you could have one, eight, twelve, nineteen. It just prohibits one, two, nine, ten by forcing that n[=3] tossups intercede between two categories.
Andrew Watkins
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Re: Question Mixer Program

Post by Mike Bentley »

By the way, the assumption I make for questions is the following:

Questions will be blocks of next with no blank lines between them.

Thus, the following is treated as one question:
1. In the last years of his life this man was stalked by a crazed Polish princess, who had him brought to trial for fraud. At the age of 20 he left his farm in the care of his business partner, Charles Rudd, and returned to England in order to study at Oriel College in Oxford. The support of Jan Hofmeyr helped him become prime minister, and he introduced the Glen Grey Act and the Franchise and Ballot Act. However, a failure to trigger an uprising of the Uitlanders [pronunciation guide: Ewtlanders] forced him to step down as leader of the Cape Colony in 1896, and on his death six years later he was buried on a hilltop in Matobo national park near Bulawayo, now the second-largest city in a country once named for him. FTP, name this British-born politician and industrialist who founded the De Beers Mining Company and funded a famous scholarship.
ANSWER: Cecil Rhodes

But it would be treated as two questions if there was an extra space in between the end of the question and the answer line:
1. In the last years of his life this man was stalked by a crazed Polish princess, who had him brought to trial for fraud. At the age of 20 he left his farm in the care of his business partner, Charles Rudd, and returned to England in order to study at Oriel College in Oxford. The support of Jan Hofmeyr helped him become prime minister, and he introduced the Glen Grey Act and the Franchise and Ballot Act. However, a failure to trigger an uprising of the Uitlanders [pronunciation guide: Ewtlanders] forced him to step down as leader of the Cape Colony in 1896, and on his death six years later he was buried on a hilltop in Matobo national park near Bulawayo, now the second-largest city in a country once named for him. FTP, name this British-born politician and industrialist who founded the De Beers Mining Company and funded a famous scholarship.

ANSWER: Cecil Rhodes

Also, there must be a blank space in between each question for them to be separated. If you inputted text like:
1. In the last years of his life this man was stalked by a crazed Polish princess, who had him brought to trial for fraud. At the age of 20 he left his farm in the care of his business partner, Charles Rudd, and returned to England in order to study at Oriel College in Oxford. The support of Jan Hofmeyr helped him become prime minister, and he introduced the Glen Grey Act and the Franchise and Ballot Act. However, a failure to trigger an uprising of the Uitlanders [pronunciation guide: Ewtlanders] forced him to step down as leader of the Cape Colony in 1896, and on his death six years later he was buried on a hilltop in Matobo national park near Bulawayo, now the second-largest city in a country once named for him. FTP, name this British-born politician and industrialist who founded the De Beers Mining Company and funded a famous scholarship.
ANSWER: Cecil Rhodes
2.One reversible type of this object is named after Henry Kater, while one of them named after Persoz can be used to measure hardness.   The equation of motion of the simplest type of these objects can be solved by using Jacobi elliptic functions, while the double one of them is a famous example of a system displaying chaotic behavior.  A physical one's motion depends on the value of its moment of inertia about its pivot point, while the simple one's equation of motion is often simplified by making the sine of theta = theta small angle approximation, in which case it exhibits simple harmonic motion. FTP, name these oscilatting devices, one of which was used to demonstrate the rotation of the Earth by Foucault.
ANSWER: pendulum

That would be treated as one question since there is no space between the text.

I can't really think of any good way to distinguish between questions without enforcing that spacing rule, so just make sure you have normal spacing going on in your questions to avoid weird results.
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
User avatar
Ike
Auron
Posts: 1063
Joined: Sat Jul 26, 2008 5:01 pm

Re: Question Mixer Program

Post by Ike »

I used this program to mix my FF7 packet i just finished, and everything does seem random enough for me, even though I had a non-rigid distribution.

I don't see any bugs insofar, but something seems to be altering the font and boldness of text, which i guess can get quite annoying if you've already inserted your bold text for powers without those power marks. The only other thing I think might be of an issue is that your numbers don't provide a space after they are placed in front of the text. But really, these are minor problems, compared to the time it saved with my manual mixing.

Ike
Ike
UIUC 13
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Re: Question Mixer Program

Post by Mike Bentley »

The font issues are probably due to incorrectly parsing rtf. I'll take a look at this issue this weekend. I'll also fix that numbers spacing issue.
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Re: Question Mixer Program

Post by Mike Bentley »

I've heard there are some additional issues with the program, so I would recomend holding off on using it until I can figure them out. I'll probably be tackling these problems next weekend once I finish making some changes on the scobowl bot.
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Re: Question Mixer Program

Post by Mike Bentley »

I've now finished a new version of this program which fixes the above issues I mentioned. I've essentially removed parsing the RTF information directly (which contains information about font, paragraph, etc.) and manually kept track of bold, italics and underlines. This slows the program down a bit (it still should mix a packet in less than 15 seconds or so), but it makes the possibility for formatting related errors very small.

This new version also adds better support for pasting in all of the questions into one text box and having it mix the questions based on pre-defined distributions (for instance, the first 4 questions will always be literature, the next 4 always history, etc.). There is also a new option for making the Tiebreaker questions always appear at the end of the packet. Additionally, I've introduced some error checking, so the program will now alert you if it's detected a question too short (maybe you had a stray character in between questions) or too long (maybe you didn't have a blank line in between the questions, so it's treating two questions as one question).

You can download it at the same link of: http://www.doc-ent.com/quizbowl/QuestionMixer.zip.

I'd appreciate if people could try this out and let me know if you find any errors or have any requests for new features. One feature that I do plan to add is to make the text produced in the output file be of Size 10 rather than Size 12. I'm also looking into adding support for automaticaly adding line breaks into the output, so that it won't be necessary to manually make sure questions don't overflow between pages. I might also port this to Java or something so that it's cross-platform.

If there is a desire to handle NAQT or HSAPQ's mark-up language as input, let me know. I can probably add that without much issue.
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
User avatar
Mechanical Beasts
Banned Cheater
Posts: 5673
Joined: Thu Jun 08, 2006 10:50 pm

Re: Question Mixer Program

Post by Mechanical Beasts »

Could you link to the new source? I'm interested in seeing your code for dealing with .rtf
Andrew Watkins
User avatar
Mike Bentley
Sin
Posts: 6461
Joined: Fri Mar 31, 2006 11:03 pm
Location: Bellevue, WA
Contact:

Re: Question Mixer Program

Post by Mike Bentley »

everyday847 wrote:Could you link to the new source? I'm interested in seeing your code for dealing with .rtf
It's not a very smart work-around. Essentially, I use the built-in properties of C#'s Rich Text Box control to ask if a character at a given position in the text is underlined, bolded or italicized. Thus, the work in parsing the rtf is done by the RTF control, so it's not subject to any of my bugs. I'm not sure if other implementations of the Rich Text control implement these functions I'm calling or not.

Anyways, the new source is up at the same link above.
Mike Bentley
Treasurer, Partnership for Academic Competition Excellence
Adviser, Quizbowl Team at University of Washington
University of Maryland, Class of 2008
User avatar
Mechanical Beasts
Banned Cheater
Posts: 5673
Joined: Thu Jun 08, 2006 10:50 pm

Re: Question Mixer Program

Post by Mechanical Beasts »

Thanks; I'll check it out. I used the tried and true "create a minimal file that looks the way you want, then delete stuff that doesn't break anything" method for figuring out how to do things without such features. Disadvantage being all the long strings of crap you deal with, but it works out okay.
Andrew Watkins
Locked