How Quizroom works …

Now, as promised, a few insights into how Quizroom works.
As I already explained: Quizroom auto-generates questions based on facts I have stored in its database, so there is no need to setup pre-defined questions and answers.
It is designed in a way that it allows me to keep an arbitrary number of fact tables in my database with an arbitrary number of facts. For example I have one table called facts_countries containing a list of countries with their population and rank by population ( guess who is number 1 by the way ).
The key table in the Quizroom database is the table called questions which contains the question templates, assigned to categories. For the category "Geography" for instance there is one question template which looks like this:

Question = "Which of these countries has the highest population ?"
Answer = "Country"
Criteria = "max(Population)"
Table = "facts_countries"
Category = "Geography"
Ref =
http://en.wikipedia.org/wiki/List_of_countries_by_population

There are multiple questions in category "Geography", so first thing Quizroom does is picking one randomly. Let’s assume it has picked the one shown above. This tells Quizroom to go to the facts_countries table and pick four records randomly from there. From those 4 records one is picked as the "right" answer depending on the criteria, here the one with the highest population. The question is displayed plus the four possible answers. That’s basically it.
There is a column Ref with the URL from where I have taken the data. You might have noticed that after you have answered a question a "Reference" link is shown at the bottom of the screen, so you actually can go there and verify the source of the facts used for that particular question.
The challenge now is to feed the Quizoom database with interesting facts, stored in a structured way. Wikipedia of course is a good source and some articles have a lot of tables, which make is easy to some extend to derive those structured data. I actually wrote a little Greasemonkey script to transform HTML tables into CSV files easy to import into a database.
Nevertheless, even HTML tables are hard to digest for a structured database in many cases. If for example you look at this Wikipedia article into the table of Countries you notice that for several countries footnotes have been added. This kind of disturbs the attempt to transform such a table into a structured format and requires extra data cleaning effort.
My little Greasemonkey script is just a start, may be a more powerful browser extension is needed to assist in fetching unstructured data and transforming it into useful structured data. Many facts come in format of lists with special rules, something for instance not supported by that script yet.
So much for now. If you, dear reader, know of any source in the internet with interesting facts organized in a structured way please let me know; may be these facts could become the fuel for more interesting questions in Quizroom.

Advertisements

Welcome to Quizroom !

My first little Python based web project "Quizroom" went live on Frihost. My original plan was to implement it using MySQL, but technical limitations on Frihost so far forced me to re-write my server code and thus for now use SQLite as a backend.

Quizroom is a little quiz game asking you multiple-choice questions in several categories I have set up so far, as we have currently:
* Geography
* Movies
* Science
Quizroom auto-generates questions based on facts I have stored in its database, so there is no need to setup pre-defined questions and answers. In a later blog posting I explain a bit more about how it works.

For now, here is the quick user’s guide:

When you start the game you first select one of the categories or "all" if you wanna play them all. Then you click on the upper center field to get started and the first question is displayed together with 4 possible answers. A timer starts running, as you see a progress bar advancing from the left to the right at the bottom of the browser window.
The sooner you answer right, the better !
The time you get is 10 seconds plus 1 second for every 30 words you have to read ( question + all answers ).
If you answer right you gain as many points as seconds were left before you would have been running into a timeout.
If you answer wrong you loose one energy point per 100 points you have scored so far, which basically means: the higher your score the more energy you loose when answering wrong.
A right answer gets you 1 energy point, up to a maximum of 20. You start with 10.
If you run out of energy game is over for you. At this time – if you made it into the high score list – you have the opportunity to leave your name ( or Frihost user name or whatever ) in the high score list. You can also click the closing "x" at the top right corner of that dialog box if you do not want to show up on the highscore list.
A push button in the right column of the screen lets you re-start the game. While the game is running you also can end it any time thru another push-button in the right column of the browser window.
That’s basically it. Give it a try and have fun playing. Click HERE to ge started.

Cossacks – The Art of War: Single Player Mission “Turkish Invasion”

This mission is a challenge as well, mainly because of technical reasons, not so much because of the mission itself. The technical problem is that the saved-mission-file of Cossacks starts growing and growing over time and as I figured out can’t be loaded anymore after it exceeds a size of roughly 2.8 Megabytes. Because of this Cossacks might become instable and crash, and as I said: no way to load back the saved mission !

After a while I found out this is somehow related to the green Turkish units attacking from the NortWest via ships and ferries. After I took out a large gang just landed by ferry I realized that when saving at this point the file was shrinking.

So focus has to be put on those green friends right away and a couple of cannons will do the job to blast away their ships. This is a pre-requisite to really play and win that mission.

It is simply a matter of time to establish sufficient troops and build some mortars to first take out the green towers and then approach the blue Turkish opponent. Attack waves are weak so that the mission itself – as I said – is not that difficult. Once the blue army has been defeated the mission is won.

Besides using mortars there is another way to take out some of the towers – and this is a nice example of how easy it can be to fool artifical intelligence. Using a fast Sich Cossack works as well: just place him behind one of the towers and another tower close by will start firing at him – and hit the tower instead all the time.

Descent 1–Turncoat

“Turncoat” is one of those Descent 1 Levels Of The World requiring again some Out-Of-The-Box thinking to get a particular problem solved. It is surprising that this game still once in a while let me face a new real challenge, even I have played hundreds of levels meanwhile during recent years. Amazing of course that I still like to play that game after such a long period of time anyway.

In “Turncoat” the area where to get the yellow key card is real tricky: there is an outer door which only opens from the inside and an inner door which can be opened from the outside. A little Class 2 Supervisor Robot is patrolling inside. First I thought taking him out would trigger the door opener. Wrong. In contradiction this little guy is needed to get in and the trick is to attract him to come out ( buy getting close to the fence and raising his interest to see you ). Once he has opened the outer door he can be taken out and the path to the yellow key card is clear.

I produced a little video to show this solution. I used Fraps to record it and Windows Live Movie Maker to edit it, add some captions and publish it right away to youtube.

Cossacks – The Art of War: Mission 5 of the 2. campaign

Mission 5 of the 2. campaign of "Cossacks-The Art of War" (fighting against an alliance of Russia, Austria and France) again is not that difficult, compared to Mission 1 and Mission 2. Almost easy and relaxing, and no time pressure ! Nevertheless, again patience and stamina is needed to successfully defend the three opponents.

Keeping that bridge under control is key to success.

At the beginning it is simply smart to avoid the French patrol and pay 4000 gold for crossing the bridge. This makes it easy to reach the settlement in the Southeast. There we have plenty of time to develop our infrastructure and army. We get a warning that the enemy has discovered where we are and will attack soon, but this doesn’t really happen to occur.

If we have built sufficient units it is time to head to the bridge in the North we crossed before and get it under control. Building a few towers there makes it easy to keep the French and Austrians where they are until we are strong enough to deal with them.

The Russians are on our side of the river in the West and we deal with them first. Taking them out gives us extra mines for gaining even more resources so that we can afford hiring lots of units quickly thru the embassy.

Defeating the French and Austrians in the North is simply a matter of time and victory is ours after we have achieved this.

Cossacks – The Art of War: Mission 4 of the 2. campaign

Mission 4 of the 2. campaign of "Cossacks-The Art of War" (defending Berlin) is not that difficult as well, compared to Mission 1 and Mission 2. Nevertheless, again patience and stamina is needed to successfully defend Berlin.

Tearing down own walls allows your cannons to fire at the enemy from a safe location.

Luckily we have a lot of gold and this is really needed since we have to react quickly as the Russians are attacking. It is important to intercept their infantrymen early to avoid they tear down the walls with their grenades. Hiring a lot of cavalrymen has been my tactic so far.

Another good idea is to tear down own walls at places ( hills ) where the enemy can not get. This allows your gunmen and cannons to efficiently participate in the defense of Berlin.

And: let your people repair the towers to keep those operational as long as possible.

After many attack waves finally reinforcements arrive and once they made it into the city before the Russians the victory is yours.

Cossacks – The Art of War: Mission 3 of the 2. campaign

Mission 3 of the 2. campaign of "Cossacks-The Art of War" is not that difficult after coming to the conclusion that a bit of patience and intelligence is better than just throwing all available forces into the battle right away.

Two Prussion troups are available to assist on the left and right side and the Hussar cavalier can be used to send commands to these troups. Instead of letting them attack right away or letting those on the right use the ferries to attack the Austrians from the back I decided the best strategy is to let them just taking their positions on the left and right flank and wait with the attack until the Austrians are sufficiently weakend to make the attack successful.

Let the Austrians run into your cannons not the other way around !

To weaken the Austrians and capture some of their cannons I used the following tactics:

  • Use the gunmen to take our their gunmen from far away. Important is to not gain the attention of their cannons.
  • Use your cannons to “convince” their troups including the cavalier to attack. It is much better to let them run into your cannons as the other way around.
  • After most of their gunmen have been taken out it is time to capture a few of their cannons. A good strategy here is to use the pikemen, but not in formation. Resolving the formation and just sending single units out minimize losses and with assistance of own gunmen it is possible to capture their cannons.
  • Once their troups have been weakened and cannons epecially on the flanks have been taken it is time for the final attack and victory.