Algorithm is like a cake receipt. In a cake receipt you have a list of instructions that you need to perform in order to create a cake. An algorithm is a list of instructions that the computer need to peform in order to achieve a goal. The nivel of detail of algorithm can vary a lot. You may write it using human language (as English) or write it using computer language (like VB, C++, Java,...). The algorithm in computer language is also called "code".
To illustrate that, let's see an example of an algorithm of a function that calculates the average of two numbers.
Algorithm using human language:
- Receive the numbers that will have their average calculated
- Sum the two numbers
- Divide the sum by 2
- Return the result
Algorithm using computer language (VB):
Function CaculateAverage ( number1 as Double, number2 as Double)
sum = number1 + number2
average = sum / 2
CaculateAverage = average
Even if you do not know VB, when comparing the two algorithm, you see some similarity, don't you?
After writing the (computer language) algorithm in the computer, you need to compile it. After that your program will be ready to use.
With that said, let's return to our game industry. When you write a game (or a program) with focus in a specific smartphone, first you need to discover the operating system that it runs. The two dominant mobile operating systems are:
- iOS (from Apple. You find it on iPhone, iPad,..);
- Android (from Google. You find it in a lot of smartphones, including the iPhone's rival Samsung Galaxy S).
Each of these operating system requires that you write your code in a specific computer language, that are:
- iOS: Objective-C (and now also Swift)
- Android: Java
So, if you like to have your game running on the two most important mobile systems, you will have to write two different (computer language) algorithms. That's why sometimes you find a specific new game (or app) only available for iPhone or Android. The developers prefer to wait if the game will get some traction in one system before dedicating effort to create the same game for the other system. Of course, the development of the second algorithm should take less time than the first, after all, you already have the human language algorithm developed.
Before you get upset with the need of having double work, on my next post I will write about the "Development platforms" and you will see that you can bypass these rework using one of them.