Friday, May 12, 2017

Making of 8 or Bust - Play Screen

8 Or Bust


https://play.google.com/store/apps/details?id=com.siddbetter.numbercrunchpaid

Play Screen




The play screen' main area is the matrix in the middle. This matrix is 6x5  --- 6 rows and 5 columns.
A(0,0)   A(0,1) A(0,3  ....  A(0,5)
A(1,0)   A(1,1) A(1,3  ....  A(1,5)
...
A(6,0)   A(6,1) A(6,3  ....  A(6,5)

Now, this matrix contains blocks... Some of the cells are empty and some contain block with a number.
When a player touches a cell and moves his finger --- the direction is noted --- could left, right, up, down ie, 1,2 4 and 8.

Now, if the direction is supposed DOWN then the block below it is checked and if it the 2 blocks can be added then move get valid ...

The selected block moves to the cell below. The sum of selected block and down block is calculated and then down cell's block is changed to new number with animation.

Similarly, the  UP move tested subtraction and on valid ..... move happens.

All cells are identified by their place in matrix --- Aij.

Now after every move-- there is a test whether MATCH-3 has happened. 

Math-3 is tested by regular expression --

        String pattern = "(\\d+:)\\1{2,}";
          Pattern r = Pattern.compile(pattern);
          Matcher m = r.matcher(string);

which matches more that 2 digits coming together.
Now, if there is a positive match find all these cells. Break them and let the top Blocks from cells above take their position.

After they take the position, check if there more matches. This process continues till all matches are removed with alternatively falling of top blocks and breaking new matches.

   


   



  

No comments:

Post a Comment