Tag Archives: Programming

Topcoder: Get Paid Working on Challenging Problems


From my last post, I talked about a gaming platform that allows you the improve your programming skill by playing games. Today, I am exploring another site of similar genre: Topcoder.

During the writing of my previous post, I was thinking to myself that since I was spending time solving puzzles using my programming skills, why not getting paid doing it? It was for this reason that led me to explore alternative sites that reward programmers with money for solving problems. Topcoder is one of such sites. A site where you get paid working on challenging problems.

Based on the description from the site itself:

Topcoder gathers the world’s experts in design, development and data science to work on interesting and challenging problems. Members are provided with opportunities to demonstrate their expertise, improve their skills, and win cash, while helping real world organizations solve real world problems.

Topcoder is established online since 2001. Actually, it is not built for programmers only. There are challenges from three major areas to work on: 1) design, 2) development and 3) data science. The first kind of challenges are for designers, the second kind of challenges for developers and the last for data scientist and statisticians.

Example of challenges on Topcoder

Example of challenges on Topcoder

Anyone who joins Topcoder can start working on any challenges he/she feels comfortable with. This means that you can start working on any challenges right after joining. For each challenge, there may be many competitors submitting solutions, however, only the best solutions (top one, two or three solutions judged by the host) will win the prize (cash $$$). Winners take all.

High success rate on challenges

Based on my observation, there are actually not many competitors for each challenge. Most of the challenges have less than 50 registered competitors and even less submissions (competitors that manage to submit a solution). This means that chance for you to emerge as a winner is very highly probable.

To test this assumption, I participated to some of the “challenges”. They were actually fun sweepstakes (sweepstakes are like lucky draws where the lucky guy wins). I participated in four of the challenges. After losing the first two, I won the third challenge!

My first win on Topcoder

My first win on Topcoder

So my assumption was right, the probability to win cash on Topcoder is very high.

Here is the detail of the challenge that I won.

Cash $250 for 1st place

Cash $250 for 1st place

It is a challenge from IBM and it requires participants to use IBM Bluemix. What is Bluemix? Just like at Amazon, we have AWS (Amazon Web Services). At Microsoft, we have Azure. And at IBM, we have Bluemix which is a cloud service from IBM.

So once you were registered for an account on Bluemix, you would need to build a web app using one of Watson‘s features: language translation. Watson is the Artificial Intelligence engine developed at IBM.

This is the example demo you start with. And this is my “winning” solution (this site will be unavailable after several months when my trial at Bluemix expires). Add a button or two and you could win $250 under two hours of work.

Apparently IBM is doing something right. It is for this reason that Warren Buffett is acquiring IBM stocks all these years (Ok, I am a bit biased for the the reason mentioned above).

Thank you Santa Claus (IBM) and merry Christmas!

CodinGame: Improve Your Programming Skill By Playing Games

Two weeks ago, I was told by a friend that there was a programming contest happening on a website called CodinGame.

CodinGame

Solve puzzles to improve skills

That was the first time I heard about CodinGame. It is a gaming platform for developers. I never knew such website existed. Last time, I used to join the programming contests organized by my department in my former company and it was fun. Now, there is a website offering the similar experience: write code to play game. It is very addictive.

There are actually many such websites providing competitive programming service and CodinGame is one of them. I was just too ignorant to not know about their existence earlier. CodinGame was online since 2012.

CodinGame: Programming is fun

If you were a programmer, you could improve your programming skill by playing games at CodinGame. I admit I learn great things working on some of their puzzles.

CodinGame online IDE

CodinGame online IDE

They organize programming contests every few months and you could join them for competing among other top programmers around the world (most programmers are from France since CodinGame is a french-based company). The last contest (Code vs Zombies) that I joined was on 29 November 2015 that lasted for 24 hours continuously. Most participants were really gurus who managed to extract most scores from the game. I only managed to score 58720 points and ranked 760 out of 3963 participants who managed to submit their solution before deadline. The winner scored 997k (!!) using a random strategy.

Code VS Zombies

Code VS Zombies

If you didn’t want to join the contest, there is another way for you to have fun: by going to their game section and solve the existing puzzles anytime convenient to you. The puzzles are categorized into four levels: easy, medium, hard and extreme hard.

Today, two weeks later, I had tried most of the puzzles. I can tell that most of the puzzles took time to solve (at least a few hours to days for some puzzles). The difficulty is range by simple programming concepts like if-else (easy), more complex logic and data structures (medium), the application of known algorithms (hard) to artificial intelligence (extreme hard). It is impossible to solve some of the hard and extreme hard puzzles alone without resorting to external resources (like wikipedia).

You can use most of the popular languages (more than 20 languages supported) to solve the puzzles. Each puzzle solved earns you certain coding points which is used for ranking.

Right now, I am ranked 779 out of a total of 276387 users. The ranking will drop each day if I didn’t continue work on new puzzles since everyday there are new comers overtaking you.

Track your progress

Track your progress

There are other features like clash of code and multiplayer games that I haven’t tried yet. You can explore them for yourself.

The main purpose of CodinGame is to link coders to companies. The job store section has a list of job openings from participating companies. However, almost all of them are European companies. The only Asian company is from Hong Kong.

I found that not many Malaysians are participating on the site. Only 936 Malaysians users out of 276k total users. This translates to only 0.34 % of total users. Hopefully more people (especially programmers) can benefit from this platform. The best way to learn is to have fun while learning. 🙂

Rapid Mobile Game Development With Javascript

I have long been searching for a free framework or library to develop cross-platform mobile apps since May 2015. So far, I don’t get a satisfactory result. Most of the libraries, frameworks, tools or platforms (or whatever) out there are NOT FREE. Almost all of them require a hefty monthly subscription.

What I need is something free to play with. I stumbled upon Cocos2d-x when I was reading a magazine (Forbes China of year 2013 or 2012 bought by my sister) about a month ago. It is being using by a 30-something young guy, who is a self-made multi-millionaire and a game developer, to develop mobile games. He later even acquired the engine and maintained the open-source nature of the project.

This article caught my attention. According to that guy, Cocos2d-x engine is being used by roughly 70% of Asian mobile game developers. With such a huge adoption rate of the engine, I thought to myself that I could not go wrong by being part of its community, right? After all, it is open-source and free to use.

The really good thing with Cocos2d-x, other than being a cross-platform game engine (for Android, iOS, Web), is that it can also be used to develop mobile apps (you don’t have to limit yourself to game development). Not to mention that the number of resources you can get when you are stuck with certain technical issues with Cocos2d considering that it is one of the widely used game engine and its community is huge. It also supports multiple languages (C++, Javascript and Lua).

Investment on Cocos2d-x

Following that discovery, I started exploring the Cocos2d-x framework and invested times reading about it. I read 4 books and they are extremely easy to following and I am impressed.

Cocos2d-x Game Development Essentials

This book is the introduction to Cocos2d-x and in it you learn about the basic and crucial concepts used in the engine and how to setup your environment for development. After reading it, you will have all the necessary pieces (like adding menu, adding sound, using accelerometer, using physic engine, etc) to develop a full interactive mobile game. One thing to note is that this book uses C++ and Xcode (with Mac) or Eclipse along with the examples given. After all, this is a short book.

Building Android Games with Cocos2d-x

This book goes through on pretty much the same concepts from the previous book but with additional topics like JNI (Java Native Interface) and Admob. It is using C++ and Eclipse for demo on Windows. As indicated by the book title, it is written specifically for Android game developers. By the end of this book, you will have another game developed (avoid-obstacle-or-bomb kind of game). This is also a short book.

Cocos2d-x by Example: Beginner’s Guide – Second Edition

This book covers many different type of games with example code available to download. It is also targeted for C++ language and on Xcode on Mac. It briefly shows you what to install in order to run the games. If you are the kind of person who learn by examples, then this book is for you. Some of the game examples provided are Air Hockey, Sky Defense, Rocket Through, Victorian Rush Hour, Eskimo, MiniPool, Stone Age (this last one is using Lua scripting language).

Learning Cocos2d-JS Game Development

This is the book that meets my need because it is using Javascript language with Cocos2d-JS that allows me to do rapid game development on the web. All the previously mentioned books are using C++ as a development language (or Lua). I tried to compile several games in C++ and it takes painfully long time (30 minutes to 1 hour for first time compilation). That makes me looking for better alternative.

In this book, you will be introduced to yet more game examples like Concentration game, An Endless Runner, Sokoban, Shopping, Totem, Match3.

The good things of Cocos2d-JS, other than what I mentioned above like quick development-test-fix cycle, are its light weight framework and it can run on any platforms with web browser. The major drawback of using Javascript, however, is that it will have performance impact running computational heavy game or application compared to its native C++ counterpart. So, as long as your app or game is not computational heavy, Cocos2d-JS is a good choice.

Real Test of Coco2d-JS for game development

With all the newly gained knowledge, I had a crazy idea last week.

During the last 8 days, I had been experimenting with the new concept of rapid mobile game development with Javascript. I was expecting the project to be done in one day, but as many things in life go, the project got prolonged and finished only until 7 days later.

Game Logic

It all began with a simple game idea inspired by a game show.

The game idea is really simple, the participants need to answer correctly a simple math question by completing the plus or minus sign in the question under 10 seconds else they will get punished.

An example of the question: 5 ? 6 ? 4 = 7.

There are 4 permutations of possible answers:

  1. minus, minus
  2. minus, plus
  3. plus, minus
  4. plus, plus

All these permutations will give different results. To go through all the permutations is very costly in term of time.

I watched the show many years ago and I even played along with the show. Over time, I developed a strategy to come up with the correct answer every time by avoiding to go through all the permutations. But it still requires substantial mental energy to do the math.

The strategy is to find out which numbers to subtract and therefore reducing the number of permutations.

The formula of my strategy is as follow:

  1. sum up all the numbers on the left hand side and
  2. subtract the sum with the number on the right hand side and
  3. divide the result by two. The final output is the number to be subtracted.

Example:

  1. 5 + 6 + 4 = 15
  2. 15 – 7 = 8
  3. 8 / 2 = 4

So you know you have to subtract 4 out of the sum. The correct answer to the question is plus, minus.

Hook factor

I liked the game idea at first thought and it got my attention because it is simple and has the hook factor.

Hooked: How to Build Habit-Forming Products

As proposed by the hook model, there are four stages to get people hooked. The first is the trigger (internal and external). When the user is bored, he/she need to play game.

The second stage is action. The game is easy to play and requires only two types of input from user which is the plus and minus.

The third stage is the variable reward which I can integrate easily into the game.

The fourth stage is the investment from the user where he/she spends a lot of time into the game to get detailed statistics of each game play.

The cycle is repeated.

Hook Model

Hook Model

Another main reason I liked the game idea so much was that it is purely a mathematical game. I could easily generate as much questions as possible programmatically. This would reduce my workload to design and hand-code every game level manually as what we normally see on other mobile games like Angry Birds.

Playing the game has an educational purpose too for kids to learn maths. That’s why I created 2 different sets of games, one with only positive numbers while the other with only negative numbers since small kids don’t have the concept of negative numbers yet (see the screenshot of the game at the bottom of this post or go directly to Google Play).

Game’s name

The game need a name. I got inspiration from a popular and influential book.

Thinking, Fast and Slow

According to Daniel Kahneman, there are two systems running in human mind which he called them System 1 and System 2 respectively. The first system is used for fast and instinctive thinking but is subjected to biases and errors in thinking. The second system is used for serious and slow rational thinking. It requires more effort and sometime even painful for the person to use the second system.

It is never an intuitive task for human to perform mathematical operations. And the game that I am going to develop involve basic maths, therefore I decided to call it System 2.

Rapid Game Development

Ok, with the game logic clearly defined, it was time to start the development work.

Cocos2d-JS Workflow

Cocos2d-JS Workflow

By following the Cocos2d-JS workflow, the main game logic was done on the first day, and deployed to the temporary web here for testing (step 3 from the workflow for cross-platform games above) and I started playing the game and making minor fixes and improvement progressively.

The following is the summary of what was going on:

  • one day coding (coding main game logic and refactoring)
  • one day coding (making the game statistics)
  • one day image (searching and editting game images and icons) + sound
  • one day testing (finding bugs and fixing bugs, doing minor improvement)
  • one day debugging on Android (debugging issues from porting Cocos2d-JS to Android, this was a surprise for me where the code run on web but not on Android)
  • one day Admob integration
  • one day publishing (writing article for blog and play store)
  • one day for buffer (anything in between)

Of course, the above is only a rough summary, many things could run in parallel like editing images while building the project for Android.

I had pretty little information and resources on how to debug on Android and Admob integration with Cocos2d-JS, that’s why it took me so long. Also, each compilation takes time. The books that I read does not cover those topics.

I also want to thank some of my friends that helped to test and provide feedback to the games.

The end result

Here are the screenshots of the game in action.

Game Menu

Game Menu

Game Instruction

Game Instruction

Game Statistics

Game Statistics

Easy Game

Easy Game

Game Over

Game Over

Game Statistics Full

Game Statistics Full

Normal Game

Normal Game

Hard Game

Hard Game

As you can see, the game only supports landscape mode. This is because by reducing one degree of freedom, I could save a lot of development time.

You can download the game from Google Play. I only support Play Store right now since the entrance price is lower with $ 25 for lifetime subscription while for Apple Store, it requires $ 99 annual subscription to publish apps.

Get it on Google Play

Get it on Google Play

Conclusion

Using Javascript to develop game is really convenient and fast. You have faster feedback loop for fixing bugs and for making incremental improvements.

For that purpose, Cocos2d-JS is a good choice. It is really a wonderful game engine for any new person who would like to develop games (independent of whether the games are targeted for web or for mobile).

Demo

You can try the game below.

Thanks.