Weblog of an Aspiring Computer Scientist
Random header image... Refresh for more!

Prime Minister’s Office - Comic Sans ?

In the recent controversy in the Indian government, a politician seems to have abused his power by assigning tenders ( ? ) to his son. A news channel showed us a letter yesterday that seems to have originated from the Prime Minister’s office concerning this and as the newsreader shouted at the top of his voice ( I hate all Indian news channels because the readers either smile while delivering news like mass murder or a large number of deaths and they shout at the top of their voice. This is probably what they learned at a young age when their parents told them to speak at the top of their voice in a debate. I just hate them ). A surge of anger cruised through me when I saw that letter. IT WAS WRITTEN IN COMIC SANS !

Which professional uses comic sans and that too to draft a letter from the Prime Minister’s Office ? Comic sans is the least professional typeface on the planet and using it to draft formal letters ? I want the PMO to give a public apology for their careless use of typefaces.

Right, in some other news concerning what I love - programming, I have managed to solve another sum from the North America, East/Central 2007 problems set. This problem was about a combination lock with a few conditions as follows:

1. The lock dial must first be spun clockwise at least one full rotation, ending with the number x at the top (with no intervening counterclockwise turns). Note this could be accomplished with consecutive clockwise turns.
2. The lock must be turned counterclockwise until the number y appears at the top for the second time. Note this could be accomplished with consecutive counterclockwise turns (but no intervening clockwise turns).
3. The lock must then be turned clockwise until the number z appears on top, without going more than one full rotation. Note this could be accomplished with consecutive clockwise turns (but no intervening counterclockwise turns).

I wrote this to solve the question:

#!/usr/bin/env python
#ICPC Locks Problem:
#Author: Shriphani Palakodety

class Lock:
    ‘The lock class’
    def __init__(self, dig_on_dial, combination, x_state=0, y_state=0, z_state=0):
        self.dig_on_dial = dig_on_dial
        self.x_state = x_state
        self.y_state = y_state
        self.z_state = z_state
        self.combination = combination
        self.xturns = 0
        self.yturns = 0
        self.zturns = 0
    def __str__(self):
        return "(" + str(self.x_state) + ", " + str(self.y_state) + ", " + str(self.z_state) + ")"
   
    def x_turn(self):
        ‘One Clockwise turn of the first ring of numbers’
        if self.x_state == 0:
            self.x_state = self.dig_on_dial
            self.xturns += 1
            return self
        else:
            self.x_state -= 1
            return self
   
    def y_turn(self, no_of_turns):
        ‘One Counter Clockwise turn’
        if self.y_state == self.dig_on_dial:
            self.y_state = 0
            self.yturns += 1
            return self
        else:
            self.y_state += 1
            return self
   
    def z_turn(self):
        ‘One clockwise turn’
        if self.z_state == 0:
            self.z_state = self.dig_on_dial
            self.zturns += 1
            return self
        else:
            self.z_state -= 1
            return self
   
    def isClosed(self):
        ‘Check if lock is closed’
        if self.xturns < 1 or self.yturns < 1 or self.zturns < 1:
            return True
        elif not self.x_state == self.combination[0] and self.y_state == self.combination[1] and self.z_state == self.combination[2]:
            return True
        else:
            return False
 

Well, I’ll post more on my problem solving spree. I posted on Prof. Phil G’s forums for his advice and he is one cool professor. I really want to keep my personal whatnots away from my blog so that won’t find its way here.

0 comments

There are no comments yet...

Kick things off by filling out the form below.

Leave a Comment