# How are the positions of the tiles determined?

How is the lane/position of each falling tile determined? Is it random or is there a pattern?

I am referring to the mobile game Piano Tiles - Dont Tap The White Tile ( iOS | Android ).

• From personal experience I'd say it's completely random but I'm not 100% sure Commented Jun 15, 2014 at 7:44
• Well which device are playing on? There are many other modes besides the ones you have mentioned on iOS. I'm not sure if the android version includes the other game modes as well. Commented Jun 15, 2014 at 15:47
• I am talking about the one for phones (not tablets, as they have different game modes) and either iOS or Android because I can confirm the game modes are the same. Commented Jun 15, 2014 at 20:48

After looking at the code of the game, yes, it does use a random algorithm.

• Could you post the code? I'm interested to see it. Commented Sep 17, 2014 at 8:24
• I'll try; I'm using an unofficial Windows port of XCode. Also, I'm quite sure posting code from something not mine is against the rules. It's like pirating code, I guess. But, for example, in Java, The code would be something along the lines of (I'll edit my formatting later, I'm on a phone) "int number %random%(1, 4)"; "if (number = 1*repeat for each pillar*){use display code here}" Commented Sep 17, 2014 at 8:34
• If you don't want to post the code which I udnerstand, you can post the algorithm or describe the way the algorith work. That would be a better way Commented Sep 17, 2014 at 8:42
• You could propably edit the section of the code to your answer, paraphrased to pseudocode to show the logic, if nothing else. Commented Sep 17, 2014 at 8:44

It depends on the game mode. If you're in a pro mode, then the tiles cannot show up twice in a row. So the game will randomly generate the next tile in one of the three positions the previous tile was not in.

If you are not in pro mode, then it is random. It picks one of the four spots, puts the tile there, goes to the next row, picks one of the four spots, puts the tile there, and repeats.

I have only played the iOS version. I don't see why it would be different in the Android version.