ze blog of ankur banerjee

needlessly messianic articles written by ankur banerjee on anything that catches his fancy, which is quite a lot indeed - stuff like tech, quizzing, h2g2 - and cups of filthy liquid almost, but not quite, entirely unlike tea


Psst! Now you can get updates on articles posted to this blog through email.


Jabberwocky v1.1g-nu

Filed Under (C++ Code Archive, DPS Vasant Kunj, downLOADS) by Ankur on 17-01-2008

In an update to the Jabberwocky v1.1 release comes an update for the graphics-mode version: Jabberwocky v1.1g-nu, which now no longer requires the user to separately extract the graphics libraries in his root folder. All that the user now needs to do is to keep the executable in the same folder under which the folder ‘Graphics’ is present. In short, just extract the file the way it is, get started!

Jabberwocky v1.1

Filed Under (C++ Code Archive, DPS Vasant Kunj, downLOADS) by Ankur on 16-01-2008

Jabberwocky v1.1 is out now and can be downloaded here.

  1. The fact the the user is no longer prompted to be shown the menu again (thanks to Rach for the suggestion).
  2. The program now asks for confirmation before editing / deleting any question from the database, reducing the chances that something may accidentally be done to the database.
  3. Path to the Borland Graphics folder has been changed.
  4. Password authentication / change now uses the traditional ‘Enter’ to terminate, rather than ‘Space’ in the earlier version.
  5. Using ‘0′ to exit a mode has been added to more functions.

Thanks to all the people who wrote in with their suggestions / comments - me and Naman highly appreciate it. And thanks to Naman, my partner on the project, for bearing with me and my ‘Can’t compile the program at home’ shit. :)

Planned for future versions:

  • Adding the ability to keep scores for multiple teams in ‘Quizmaster Mode’.
  • Some sort of password encryption?

PS - Gaurav Trivedi, one of our Code Warriors, has created a pretty neat website creator as his project. Do check it out! Click here to download his cWeb3 (beta).

Jabberwocky v1

Filed Under (C++ Code Archive, DPS Vasant Kunj, downLOADS) by Ankur on 12-01-2008

At last, my computer science project is ready! Me and Naman present Jabberwocky - The Utterly Weird Quizzing Software. Bear with me, the ‘official site’ ain’t complete yet, I’ve pre-Boreds going on for Bob’s sake! If I get time, I’ll make a proper site, otherwise I’ll use a blog engine. Considering that in one we went through FOUR different versions on ONE day doing bug fixes, I’m sure a blog engine WOULD be a better idea. Which reminds me, I need to install WordPress on my hosting account, and get out of this shithole of Blogger soon.

Click here to download Jabberwocky v1 (~200 KB). Read the ReadMe before starting off. The program comes bundled with 42 questions in its database, you can of course, add more. Suggestions are welcome.

Class 12 Comp Sci Stuff : Postfix Conversion

Filed Under (C++ Code Archive, DPS Vasant Kunj, Education) by Ankur on 05-01-2008

CBSE’s class XII computer science syllabus also happens to have infix to postfix conversions (and vice versa) as an application of a stack…without actually coding. Weird, or shall I say, good - because THAT sort of coding will knock the socks of most people. Anyway, I’ve given solutions to the conversion exercises given by our school. I hope they’re correct, and in case they aren’t, please do leave a comment to correct me.

Postfix, also known as the Reverse Polish Notation, is something some friends of mine have a called a pain in the butt. Indeed, if you try to follow the algorithm given in the notes given in our school, you’ll find the procedure is not *that* clear. Although it’s based on Djikistra’s ’shunting yard’ algorithm, you’ll find that this explanation is WAY better the one given in our notes. The Sumita Arora book’s description is OK too, so you may go in for that if you’re physically incapable of making a small mouse click (and perfectly capable of lifting a heavy book).

Infix to Postfix
1. X + Y * Z ^ P - (X / Y + Z)





















S. No. Input Action Stack Status Postfix Expression
1 X Print X
2 + Push + X
3 Y Print + XY
4 * Push +* XY
5 Z Print +* XYZ
6 ^ Push +*^ XYZ
7 P Print +*^ XYZP
8 - Pop
& Print

current stack

XYZP^*+
Push -
9 ( Push -( XYZP^*+
10 X Print -( XYZP^*+X
11 / Push -(/ XYZP^*+X
12 Y Print -(/ XYZP^*+XY
13 + Pop
& Print /
-( XYZP^*+XY/
Push + -(+
14 Z Print -(+ XYZP^*+XY/
15 ) Pop
& Print +
-( XYZP^*+XY/+
Pop ( - XYZP^*+XY/+
16 End Pop - XYZP^*+XY/+-


2. (A + B ^ D) / (E - F) + G





















S. No. Input Action Stack Status Postfix Expression
1 ( Push (
2 A Print ( A
3 + Push (+ A
4 B Print (+ AB
5 ^ Push (+^ AB
6 D Print (+^ ABD
7 ) Pop
& Print current stack operands
( ABD^+
Pop ( ABD^+
8 / Push / ABD^+
9 ( Push /( ABD^+
10 E Print /( ABD^+E
11 - Push /(- ABD^+E
12 F Print /(- ABD^+EF
13 ) Pop
& Print -
/( ABD^+EF-
Pop ( / ABD^+EF-
14 + Pop
& Print /
ABD^+EF-/
Push + + ABD^+EF-/
15 G Print + ABD^+EF-/G
16 End Pop + ABD^+EF-/G+

3. NOT (A OR B) AND C












S. No. Input Action Stack Status Postfix Expression
1 NOT Push NOT
2 ( Push NOT (
3 A Print NOT ( A
4 OR Push NOT ( OR A
5 B Print NOT ( OR AB
6 ) Pop
& Print OR
NOT ( AB OR
Pop ( NOT AB OR
7 AND Pop NOT AB OR NOT
Push AND "left" valign="middle">AND AB OR NOT
8 C Print AND AB OR NOT
9 End Pop
& Print AND
AB OR NOT AND

4. ( !(TRUE && FALSE) || (TRUE || FALSE) )




















S. No. Input Action Stack Status Postfix Expression
1 ( Push (
2 ! Push ( !
3 ( Push ( ! (
4 TRUE Print ( ! ( TRUE
5 && Push && TRUE
6 FALSE Print TRUE FALSE
7 ) Pop
& Print &&
( ! ( TRUE
FALSE &&
Pop ( ( ! TRUE
FALSE &&
8 || Pop
& Print !
( TRUE
FALSE && !
Push || ( || TRUE
FALSE && !
9 ( Push ( || ( TRUE
FALSE && !
10 TRUE Print ( || ( TRUE
FALSE && ! TRUE
11 || Push ( || ( || TRUE
FALSE && ! TRUE
12 FALSE Print ( || ( || TRUE
FALSE && ! TRUE FALSE
13 ) Pop
& Print ||
( || ( TRUE
FALSE && ! TRUE FALSE ||
Pop ( ( || TRUE
FALSE && ! TRUE FALSE ||
14 ) Pop
& Print ||
( TRUE
FALSE && ! TRUE FALSE || ||
Pop ( TRUE
FALSE && ! TRUE FALSE || ||

Postfix to Infix
1. 20 8 4 / 2 3 + * -



















S. No. Input Action Stack Status
1 20 Print 20
2 8 Print 20 8
3 4 Print 20 8 4
4 / Pop 4 20 8
Pop 8 20
Push 8 / 4 20 2
5 2 Print 20 2 2
6 3 Print 20 2 2 3
7 + Pop 3 20 2 2
Pop 2 20 2
Push 2 + 3 20 2 5
8 * Pop 5 20 2
Pop 2 20
Push 2 * 5 20 10
9 - Pop 10 20
Pop 20
Push 20 - 10 10


2.* FALSE FALSE TRUE TRUE NOT AND TRUE AND OR AND





















S. No. Input Action Stack Status
1 FALSE Print FALSE
2 FALSE Print FALSE FALSE
3 TRUE Print FALSE FALSE
TRUE
4 TRUE Print FALSE FALSE
TRUE TRUE
5 NOT Pop TRUE FALSE FALSE
TRUE
Push NOT TRUE FALSE FALSE
TRUE FALSE
6 AND Pop FALSE FALSE FALSE
TRUE
Pop TRUE FALSE FALSE
Push TRUE
AND FALSE
FALSE FALSE
FALSE
7 TRUE Print FALSE FALSE
FALSE TRUE
8 AND Pop TRUE FALSE FALSE
FALSE
Pop FALSE FALSE FALSE
Push FALSE
AND TRUE
FALSE FALSE
FALSE
9 AND Pop FALSE FALSE FALSE
Pop FALSE FALSE
Push FALSE
AND FALSE
FALSE FALSE
10 OR Pop FALSE FALSE
Pop FALSE
Push FALSE
OR FALSE
FALSE
11 AND Input Error! FALSE

* Here, the given question is wrong because enough operands have not
been given for successful completion of algorithm. However, I decided
to put it up anyway so that the method could be demonstrated. Note that
if the last AND is removed, then the question becomes perfectly valid.

Subscribe to Rss Feed : Rss