# Matrakci Calculator – my new Windows Phone app

Find this application on Windows Phone Marketplace at this location: http://www.windowsphone.com/s?appid=59680235-b5e2-41a9-b2f5-49eebfc62301

If you want to play online this calculator right now, check this link. It is described all you want to know about Matrakci and Lattice multiplication as well.

During holidays I was working on a small Windows Phone app. The application simulates how people performed multiplication more than 500 years ago. Before 500 years, people didn’t have devices we have today, so it was pretty complicated to calculate how much is e.g. 2345*6542. Those days, one of the discovered devices was Napier Bones, which could perform multiplication of pretty big numbers (with 2 or more digits). The device uses very clever method for multiplication, discovered 50 years before Napier constructed his Abacus. A recent study of  the book, “Support of arithmetic in propositions of all magnitudes” (org. “Umdet-ul Hisab”) revealed an unknown fact that Matrakci had invented this genuine multiplication method. Nasuh Maktrakci was 16th century Ottoman mathematician, teacher, historian, geographer, cartographer, swordmaster, and miniaturist of Bosniak origin.
Currently application is preparing for sumbiting to marketplace, but there is a web silvelright version of the application which you can taste now. Just go to http://datasoft.ba/demos/matrakci/Matrakci.aspx and taste this very clever method for multiplication.

# CrossNumber- puzzle with numbers for WP7, Silverlight, Android and Win8 metro game

Recently I decided to start with implementation of my first game which is going to be CrossNumber  puzzle.

CrossNumbers is puzzle game which can be played from 7 year old children to mans in late year who like puzzle and math. The game is going to be for fun as well as for education propose which you can train your brain with math and problem solving. The game will be ported in Silverlight, WP7, Win8 Metro and Android.

Game contains originally designed problems which need to be solved in measured time, with penalty points for failed attempts. The game starts with simple cross number problems and rising its difficulties as you passing levels.

# How to enter the number

Each game needs input number provided by the player. The numbers are entered by special InputKeyboard showed on the left picture.

Before you input the number you need to select cell by clicking or taping grayed (hidden) cell. Picture left shows selected cell which holds sum of 2 and 6. By clicking on the key you enter the correct value. If the value is incorrect the red rectangle will appear.

If you need to enter number greater than 9, you need to use combination of key and certain number.

Example

13=+

# Type of Games

Currently there are two kind of games (curreently on two variant are implemented in alpha version):

· HDV Sum

· Sum to 11

# HVD Sum

HDV Sum stands for Horizontal, Vertical and Diagonal summation. This is classic CrossNumber puzzle. The simple problem is depicted below:

Suppose we have 4×4 grid (yellow area), with random numbers in cells. Red bottom and right row/column hold sum of the yellow cell in Horizontal, Vertical and Diagonal (right and left) direction .

If we want to sumthe first yellow column the sum is equal to 7. On the same way we are having sums for the next 2 columns and they are 6 and 8 respectively.

Now we are going to sum in horizontal direction. So, for the first, second and third row we have 4,6 and 13 respectively.

Now remain part is diagonal summation from the top-left to the right-bottom corner and left-bottom to the right-top. The values are 12 and 7.

This type of game will have 3 different grids: 2×2, 3×3 and 4×4 grids.

# Sum to 11

The next type game is Sum to 11. This is game which is real ultimate brain puzzle and is not easy as you may think.

The picture below shows the rules for this game. This is math intensive game and represents real challenge for players.

On the upper part there is a 4 of 4by4 grids, which are indexed for constructing the equations bellow. You need to follow equation below in order to solve puzzle successfully. This game will also have some variants probably for summation of 11, 21, 33 and 55.

The game is already in alpha stage of Silverlight and WP7 platform, and it is accessed by very limited number of people. But very soon it will be opened to all who is interesting in game.

# WPWidgetLibrary presentation at CodeCamp 11(MkNET User Group)

This year too, MkNET UG (Macedonian User group) is organizing CodeCamp 11. This is one of the most popular UG event on Blakan. Very huge number of attendees and speakers. The CodeCamp is organizing in to 5 tracks: Red, Yellow, Green, Blue and Student tracks.

This year I got the invitiation from the  INETA and MkNET to speak at CodeCamp 11.

WPWidgetLibrary – HTML5 Widgets for WP7 Mango will be presentation which I am goint to present at Yellow track. I can say I am very exciting about this event.

As I have written the WPWidgetLibrary is announced at MobilityDay, and published at codeplex month before. We got very positive feedback from the dev community and the Mk Code Camp will also be a chanse to present our open source solution to the Macedonian .NET community.

More information about Code Camp 11 can be found at http://www.codecamp.mkdot.net, and my speach will be at Yellow track from 11:00 to 12:00.

Meet you there!

# Customization of WPWidgetLibrary

In only 12 days WPWidgetLibrary reach more that 800 page views and over 50 downloads. This is good start of the library since building HTML5 apps in Windows Phone is coming. We have also got several feedbacks and questions about the library, and we can say the WPWidgetLibrary is indeed solution for developing hybrid mobile applications for Windows Phone 7.
One of the question about WPWIdgetLibrary is how to customise some features. For example default library no support avi file format. For that reason we have opened Discussion section of the library and put some answers. Here is one of them Damir has posted:
WpWidgetLibrary installs HTML app by calling:

```InstalHTMLContent(string htmlFolder, string[] htmlDirs) ;
```

where htmlFolder is the folder in solution which contains all required web files. In other words this is the root of web-application which will be executed from isolated storage. Because you are free to use any kind of extension like “myfile.tiff” the framework can either copy any file in your project or specific files. We decided to copy specific files only.
Here is how we do it:

```protected virtual bool IsWebExtension(string ext)       {
bool res = false;
switch (ext.ToLower())
{
case "htm":
case "html":
case "js":
case "jpg":
case "jpeg":
case "png":
case "css":
res = true;
break;
}
return res;
}
```

If your HTML mobile app requires other file formats eg. “abc.avi”, just derive the WPWIdgetLibrary class and override this method like the following sample.

```public class MyWPWidgetLibrary: WPWidgetLibrary{
protected override bool IsWebExtension(string ext){
bool res = false;
switch (ext.ToLower())
{
case "avi":
return true;
//break;
}
return base.IsWebExtension(ext);
}
}
```

Now WPWidgetLibrary supports custom avi files.
On similar way you can implement support of any file format you want.

In only 12 days WPWidgetLibrary reach more that 800 page views and over 50 downloads. This is good start of the library since building HTML5 apps in Windows Phone is coming. We have also got several feedbacks and questions about the library, and we can say the WPWidgetLibrary is indeed solution for developing hybrid mobile applications for Windows Phone 7.

One of the question about WPWIdgetLibrary is how to customise some features. For example default library no support avi file format. For that reason we have opened  Discussion section of the library and put some answers. Here is one of them Damir has posted:

WpWidgetLibrary installs HTML app by calling:

```
InstalHTMLContent(string htmlFolder, string[] htmlDirs) ;

```

where htmlFolder is the folder in solution which contains all required web files. In other words this is the root of web-application which will be executed from isolated storage. Because you are free to use any kind of extension like “myfile.tiff” the framework can either copy any file in your project or specific files. We decided to copy specific files only.

Here is how we do it:

```
protected virtual bool IsWebExtension(string ext)       {
bool res = false;
switch (ext.ToLower())
{
case "htm":
case "html":
case "js":
case "jpg":
case "jpeg":
case "png":
case "css":
res = true;
break;
}
return res;
}
```

If your HTML mobile app requires other file formats eg. “abc.avi”, just derive the WPWIdgetLibrary class and override this method like the following sample.

```public class MyWPWidgetLibrary: WPWidgetLibrary{
protected override bool IsWebExtension(string ext){
bool res = false;
switch (ext.ToLower())
{
case "avi":
return true;
//break;
}
return base.IsWebExtension(ext);
}
}
```

Now WPWidgetLibrary supports custom avi files.

On similar way you can implement support of any file format you want.