Thursday, November 7, 2019

Competitive programming quickstart guide



How to become a Competitive Programmer in 2 hours:

This guide works for you if you are have never solved problems online before and you know how to code a `for loop` and you know what `arrays` are in any programming language.


Step 1: Register in ProjectEuler and solve this problem. You can solve this offline and submit the solution in the textbox. This should take you 15 minutes.

Step 2: Solve this problem and submit the solution in the text box. This should take you 30 minutes.

Step 3: Register in SPOJ and solve this problem. Note that you've to submit your source code. This should take you 15-30 minutes.

Step 4: Solve this problem and submit your source code. This should take you 30 minutes.

You can spend the remaining time in any problem in case you get stuck. 

Congrats! You are officially a competitive programmer now.


  • Let me know if this guide worked for you in comments and let me know how long it took for you.
  • If you are able to complete this guide, you can gradually increase difficulty and practice on your way to become a topcoder!

Wednesday, March 20, 2019

Getting started with AI Programming through Codingame

From simple bots like Cleverbot, Akinator to complex bots like video game AIs and self driving cars, Artificial Intelligence has become an important part of our daily life.

Prerequisites to get started with AI:

All you need to know is a programming language.


Getting Started with AI Programming through Codingame:

Codingame is the best platform to get started with Artificial Intelligence.

Lets start with a small racing game. In this game you have to code to drive a car faster than your opponents in a small track to complete 3 laps.



Step 2: Choose your favorite programming language of your choice


Step 3: Click "Play my code" button 



You'll be able to see the game playing


If your pod(car) is not moving, check if you are printing the correct x and y coordinates that you get in the input.

Step 4: Compete with the boss.


You may have to increase your thrust. (Beware that too much speed can affect your car when cornering)


Step 5: Click the submit button once you defeat the boss!


Step 6: You'll get promoted to the next league where you will face difficult opponents and you'll have to work with extra details.

The league system:

To get promoted to the next league you have to get more points than the boss in that level. (This means that your code must win more than 60% of the games). 




For the lower leagues if, else statements should be sufficient. By the time you reach Gold, you'll have a great knowledge how to predict the future and how to counter an opponent.You would have created a great AI bot by then.


Step 7: Bot programming challenges and community contests 

You can check out other AI challenges in the bot programming section in the Compete tab. Also watch out for the upcoming community contests.



Best of luck in advance for your first AI bot! Share your experience in comments.

Friday, March 15, 2019

Why and how to use topcoder plugins?

Why topcoder plugins?


Plugins auto-generate the code that you repeatedly use in every problem. i.e. imports, class definition, function definition etc., This means when you open a problem, you can directly start programming your logic without worrying about importing headers, declaring classes and defining the function parameters. This boosts your score for every problem as you save few minutes in the contest.



How to install a plugin?


The easiest plugin to install is KawigiEdit.


  1. Download the latest KawigiEdit jar to your computer (and remember where you saved it).
  2. Start the TopCoder Arena applet. If u are unable to start the applet go to java.com and click on Download Java and install it and then retry opening the applet. If you get any security issue while opening follow these instructions
  3. From the Options menu, choose "Editor". The Editor Preferences dialog should come up.
  4. Click on the "Add" button. A dialog titled "Enter Plugin Information" should pop up.
  5. For "Name", enter "KawigiEdit" (or whatever you want it to be called, it doesn't really matter)
  6. For "EntryPoint", enter "kawigi.KawigiEdit" (this one does matter).
  7. For "ClassPath", hit "Browse" and find the KawigiEdit jar. You should not have a previous version of KawigiEdit in the global classpath (in the text field on the top of the Editor Preferences Dialog).
  8. Once those are entered in correctly, click OK.
  9. If you want KawigiEdit to be used as your default editor, check the "Default" box next to the new entry in the table. I recommend setting it as your default editor, of course.
  10. Click "Save". If you get errors here, make sure that you are absolutely using Java 1.5, and that no previous version of KawigiEdit is in the classpath, and if that's all in order and you're still having problems, contact me personally or see if you can find anyone in the arena who knows a lot KawigiEdit.
  11.  Now if you open any problem in topcoder, you can see the headers and classes auto generated.Now KawigiEdit will be ready to use! 
  12. Of course, to get the most out of KawigiEdit, you will probably want to tweak the configuration.

But I prefer FileEdit plugin because it is also helpful to use my own editor to code. (In my case : Visual Studio)
  1. Download FileEdit.jar
  2. Follow step 2,3, and 4 (in Kawiji)
  3. Click on Browse and select the downloaded FileEdit.jar file
  4. Now enter fileedit.EntryPoint as entry point (for name choose any) and click OK.
  5. Click on Save
  6. Now open any problem. You'll see the file location in the coding area. 
  7. You can use any favorite editor of your choice (Visual Studio in my case). You'll also see the auto generated source code which will auto communicate with topcoder. For advanced changes you can configure in the editor.

Reference: Topcoder forum