Posts

Showing posts from 2017

10 Days in the IOI Training Camp (IOITC) At CMI, Chennai

10 Days in the IOI Training Camp What it is ...  The IOITC or the IOI Training Camp in India is the final level of selection for the Indian team of the IOI. Only the top 4 in the final rank list are selected. The difficulty level of the IOITC is considerably harder than INOI. Although most people presumably study more than the prescribed by the official webpage , but still... one can qualify in the national round with just basic knowledge of graph theory like BFS and DFS , a little DP and a spoonful of logic. However, in this blog, I will mostly relate my experience in this year's IOITC17. Here Goes ....  So this year I was selected for the IOITC. Being in class 9, I was the youngest this year. Even after giving INOI, I knew I would probably would... I had been able to solve both the problems, so it was not much of a surprise when the mail came with the official result. However, this year, a lot of class 10 students were allowed :  the cutoff for below class 11 w

Preparing for IOI Training Camp

International Informatics Olympiad Training Camp Preparing for the IOI Training Camp was not any different for me as the usual practice. Though saying that would be a bit inadequate as I practiced very little competitive programming in the months from November to March, mainly due to school exams. Still, I would like to give a few pointers that might help. Firstly, try solving all the problems from the IARCS problem archive. Although this should be a pre-requisite for preparing for INOI, it is not necessary. However, solving all the problems of the problem archive should help you. For my own part, I rarely submitted actual solutions to get AC, mainly due to lack of time, (and a little bit of laziness :), ehh not really ) but I tried finding the solutions for all the problems in pen and paper. Next, the main thing to know is that solving problems o CF and Codechef won't help much in the Team Selection Test. They usually are trivial, or have very little in common with t

Preparation for INMO

Indian National Mathematics Olympiad

Getting prepared for INOI

Indian National Informatics Olympiad Disclaimer : This post is mainly intended for an Indian audience.

Getting prepared for RMO

Regional Mathematics Olympiad The Regional Mathematics Olympiad (RMO) is the second stage in the selection for the selection of the Indian team to the IMO, the first being the pre-RMO. It is one of the tougher olympiads conducted across India, wherein only about 300 students are selected to sit for the Indian National Mathematics Olympiad(INMO). The main thing that makes RMO tough, at least for the common students, is twofolds -- firstly, the syllebus is quite a bit different than the normal class X or XI curriculum that is followed in schools, especially in areas like combinatorics and number theory, the latter being a topic that is scarcely touched upon. Secondly, in topics that are known to us, like geometry, the level of questions, even if they don't require advanced theorems and results, they need a level of creativity that cannot be mastered overnight. From hereon I will say what I did to clear it last year.. when I was studying in class IX. Firstly, I focused heavil

Necromantion : A roguelike

Necromantion This is a roguelike game that I have been developing on and off for a year now, starting from March '16. It is a much larger project than those that I have written previously and I believe that it is moderately well written. Documentation is available on only a few classes, though. Over the next few blogs, I would be discussing some of the problems I faced and the solutions to them that I developed. Here is a link to the  code , but I would not give the images, as they are not mine.

Tetris part 2

The GameEngine Class So, this is mainly going to be about the GameEngine class. The main job of the GameEngine is to update and render the game environment. Now, at any moment , there is only one falling Group . So that is signified by currentGroup . Apart from that, the Block s that have already fallen, are just kept in a 2D array. For purposes of collision detection, this array has a padding. The padding is also required as we do not want a block to instantly appear .. We want to to appear slowly, that is first, the lowermost layer, then the middle and finally the upper layer. ( Group s have 3 rows each). The update function, at each call, moves the current Group  down, creates one if not present, and then checks whether any lines have formed. Since this is a small scale game, concurrency of threads has not been considered. When the player presses a key, the methods of the GameEngine  are called from the Event thread itself. The Player can rotate or shift the Gr

JCERB v7.2

The New JCERB This will probably be my last chess engine JCERB version. I have removed a couple of bugs, although speed has been reduced a bit. Please try it out and any feedback will be helpful. JCERB v7.2

The Tetris : A Simple Version

Motivation Tetris is one of the iconic games that everybody has played at some point or the other. For some it has even become an addiction, with all the different versions of the game.  Even though being so popular and played-by-all, it is one of the simplest games out there, if we consider the basic mechanics. Of course UI is something that is really hard to get right for a beginner, so I will not be discussing it right now.  So, why build a tetris? I did it because I was feeling bored and had nothing to do for 5-6 hrs. It took me literally that much time to build it, and I am sure that experienced programmers will take even less time. If I would have built it now, it would have taken even lesser time, for I made that in 2015, a long time ago. Structure So the first thing that we have to notice is that tetris is basically a grid based game. You could make the blocks fall in a continuous manner or smooth manner, but when it finally falls, it is in fixed places of the

Some older versions

Old Versions Of JCERB Here, I am posting some older versions of the engine, which might be a little version than the latest. I am trying the JCERB 7.1 after a long time, and in a couple of situations , I have found that it is playing badly.There is probably some bugs, in the evaluation or in the minmax code, so I am going to post some earlier versions here (yes, I saved the progress step by step, so I have got about 9 or 10 versions). Here is the  JCERB v7.0  , which is a bit error free, although it does not checkmate the opponent sometimes.If there are two forced mates , it does not choose the shorter one, but the one which it evaluated earlier. I will be updating this blog again later.

A basic Ping Pong

Writing in QB64 This post will not be about how to write a really good ping pong, but how I wrote it. Mine was about a mediocre strategy considering that I wrote the whole game in pen and paper without ones trying it on the computer. I would prefer using QB64 as the language for writing the first game,  as since the game will most probably be simple, QB64 is very easy to learn and code in. This was my first program of more than say 50 lines, so the code is messy and bad and I don't expect anyone to read and understand anything, I myself can't sometimes. So this will only be helpful to those who want to write some kind of game, but don't know much about programming. Overall Plan So  first let's forget about the language specifics ...  what is the most basic way of writing a ping pong. Well, the first thing that comes to mind is that the ball will be , well, a circle, with a certain radius. Secondly,  the two players will be just rectangles on wh

A playable UI

Finally The UI And Game Class The UIBoard  class is too long for me to explain, but the gist is that the UI and the Game class are entirely separated, except for a few methods, and the UI class controls the  Game  class.The methods in the UI class are pretty self-explanatory, but here are the few main points on the mechanics: a)  The pieces are shown on CustomJLabels so that they can be highlighted and the previous color and the normal color can be stored. b) For actual creation of UI, the JPanels are arranged in a GridBagLayout. c) Well...  nothing more is there. The Game class is also very small with the primary objective of acting as an interface between the UI and the AI.Only two important methods are there,  compMove()  and playerMove(), both of which returns a string pertaining to the move made.That's it. The methods other than that are mostly used for debugging , except the nextPos(), removePrevPos()  and the  numRepeats()  method which are used for

What is the board saying

Evaluating the Board The evaluation of a position is rather simple. Here , a positive value means that the computer is ahead else the player. All values are calculated in centipawns, that is 100 points is equivalent to more-or-less one pawn. First, there is a Material  class which checks the relative piece values. Secondly, there is a PiecePosVal  class, which gives each piece a certain amount of points based on its location in the board. Thirdly, there is a checking for doubled pawns, isolated pawns and passed pawns, where certain bonus points are either given or taken according to the pawn structure.This is but a rough approximation. Also , there these valueBoard class considers whether it is an  endgame  position, which is set by the Material  class. There is also a  Options  class which awards points for mobility. Although, the evaluation could have been simpler with more time for searching deeper, or could have been better, I think that this balance i