Skip to main content

An app and a story

An app and a story

I am not writing anything about coding tip here. But telling you how my app Shataka came into existence. 

Few years back, I had started an app, whose idea was to find all combinations of numbers to get the required sum. Something like, 

90 = 10*9
     = 45*2
     = 200 -110

Then the app was killed because my computer was. I did not have a single line of code remaining. 

That was metamorphasized into this unique app Shataka. As far as I know, in android market there are not many number games for adults. There are few me-too versions of 2048 and few apps which ask you to type what is 10 +2 etc.

But in this app, the sum was to be 100, for rows and columns. And typing the numbers is clumsy and guessing 9 numbers to fill in 3 by 3 grid for this is too time consuming. So what if I provide the numbers after shuffling them?

Yes. I provide 9 numbers which if arranged in an order, make a grid with sum of each row as 100 and sum of each column as 100.


81 4 15
10 73 17
9 23 68

So I generate one set of numbers - which will be one puzzle. I generate a second set, third set. How many sets should I store in the app? It should be possible to generate numbers randomly. 

Generate one number randomly. Then find combinations for next 2 numbers etc. e.g. if let us say number is x1 is 10, then x2 can be 60 and x3 can be 30. Now 10+x4+x7 = 100 and 60+x5+x8 should be 100 and 30+x6+x9 should be 100. And also x4+x5+x6=100 and so on.

Few random numbers, few equations and some iterations, our puzzle set is ready. Give an empty grid, below which give 9 numbers and ask the user to fill the grid.

What I realized is, for the beginner, it is difficult to select numbers. Then I thought of hints. Providing hints for games is too complex. At least for this game it was. 

If not hint, how about giving them partial solution. For the easy level, fill 3 cells of the grid, so that user needs to add only 6 numbers. That will be better and that will also make the game familiar. 

That is what you see in Level 1 of the game. Level 2, gives the user 2 solved cells, level 3 gives 1 solved cell. And of course there are no solved cells in level 4.

Is that all? Will this game have only 4 levels? That will be too ridiculous. What if we add an extra number, which is not part of the solution to the game like this

 We have 10 numbers given instead of 9. So makes the game little bit more challenging. 

So that provided us level 5 and 6(with 2 extra numbers) and 7(3 extra numbers). 

And with these features, I published the app

But the game will become boring if it has only 7 levels. So in next version, I thought of not just shataka, but sahasraka - shataka in Sanskrit is 100 and sahasraka is 1000. So provide three numbers to add up to 1000.

And what about a sum of 77 or 92 of 66 that is some random 2 digit number. That is another set of levels 


Why is there no screen shot of sahasraka - because I have not yet reached that level :) 

So dear readers, what is the next feature you want me to add to this awesome game? 


Popular posts from this blog

Simple ListView Adapter and list item select

When you are using a listview in your applications many a times you will write your own adapter to display item. But if your list is very simple showing a list of strings, you can use inbuilt adapters like ArrayAdapter, SimpleCursorAdapter etc.

ArrayAdapterLet us look at an example

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ListView android:layout_height="wrap_content" android:id="@+id/listView1" android:layout_width="match_parent" android:layout_margin="20dp"> </ListView> </LinearLayout>

And add these lines to the onCreate method of the activity.

super.onCreate(savedInstanceState); …

Drawables in Android - Layer drawable

Let us see how to use layer drawable. You can have two or more bitmaps on different layers to create such a drawable

Using xml:

You should use layer-list in your xml file to create layerdrawable. Here is layer.xml
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android=""> <item> <bitmap android:src="@drawable/whiteicon" android:gravity="top|left"/> </item> <item> <bitmap android:src="@drawable/blueicon" android:gravity="top|left"/> </item> <item> <bitmap android:src="@drawable/redicon" android:gravity="top|left"/> </item> </layer-list>
We are using three different bitmaps whiteicon.png, redicon.png and blueicon.png which are present in /res/drawable/mdpi folder. All these are of different sizes and aligned to top left. This drawab…

DatePickers in Android

DatePicker is a view which lets the user select a date showing a calendar or 3 spinners for dd, mm and yy.

Let us see how to use this.
Easy Method: To use a DatePicker you can use DatePickerDialog. This can be created and shown programmatically too.

publicvoidonCreate(Bundle b){/*********/ Button btn =(Button)findViewById(; btn.setOnClickListener(new View.OnClickListener(){@OverridepublicvoidonClick(View v){ showPickerDialog();}});}privatevoidshowPickerDialog(){ DatePickerDialog dtPickerDlg =new DatePickerDialog(this,this, 2017,10,20);;}

In our xml file, let us have a button and in the onclick listener of the button, let us display the date picker dialog - we call showPickerDialog.

In showPickerDialog,  we are using a random date to initialize.

The first  parameter is the context. Second parameter is the class which implements the interface OnDateSetListener. Next three parameters are year, month (Jan is 0) and …