Saturday, July 7, 2012

Calculation of the optimal darts strategy


In the game of darts, players throw darts at a board to score points.
The circular board has a 'bulls-eye' in the center and 20 slices
called sections, numbered 1 to 20, radiating out from the bulls-eye.
The board is also divided into concentric rings.  The bulls-eye has
two rings: an outer 'single' ring and an inner 'double' ring.  Each
section is divided into 4 rings: starting at the center we have a
thick single ring, a thin triple ring, another thick single ring, and
a thin double ring.  A ring/section combination is called a 'target';
they have names like 'S20', 'D20' and 'T20' for single, double, and
triple 20, respectively; these score 20, 40, and 60 points. The
bulls-eyes are named 'SB' and 'DB', worth 25 and 50 points
respectively.

There are several variants of darts play; in the game called '501',
each player throws three darts per turn, adding up points until they
total exactly 501. However, the final dart must be in a double ring.


Often there are several ways to achieve a total.  You must return a
shortest possible list.

It was tasked to create a program to solve this problem. I used Python  and Google Application Engine for this. First of all I've defined shortest way to win from each point of the game. For example , your current score is 170 and the program calculates that the shortest way to win is T20,T20 and DB (bull-eye)  . But real darts players have different accuracy. I've used the simple test for the player's accuracy. He should hit bull-eye 100 times and calculate his correct hits. The program recalculates this value in Gaussian deviation and defines probability of hitting each target on the darts board. After that the program shows optimal targets for a next turn. If  your accuracy more than 50% the program show the shortest way to win, but if you're not a such experienced player  the program will recommend  a more likely way to achieve the win.
I've implemented the optimal strategy algorithm in the small web application in GAE. You can see it here Darts Strategy  I think it will work on Android and iPhone too.

Saturday, June 23, 2012

IT Garden Diary-Second step -define plant care

Each plant requires care. It can be watering, fertilizing, weeding, pruning, etc.You have to do each procedure in a particular time and place. IT Garden Diary will help you organize all of these procedures and will remind you what  to do today and where. Open the Plant list and click on the button "Care" for any plant. Click the button "Create new". Enter all needed parameters for this procedure Start Date, End Date and Repeat every.


Save this procedure and check the Todo list. You'll see several new deals in it .
Click on the button Map and you'll see the a small markers with a tractor  on the map of your garden. There are places of your today works. Click on any marker and you will see what should you do.

IT Garden Diary-First step adding plants

First of all, you should register your garden at gardendiary.azurewebsites.net . Then click on the Map icon and find your place at Google Maps. Click the button "Draw bound" and draw bound of your garden on the map. After that, click the button "Save bound".
Now, you can place plants on the map using the button "Add plant" . You should enter a name for each plant in the prompt dialog box. Click the button "Save plants" and IT Garden Diary will save all locations at the garden map.If you open the Plant list you'll see all added plants in it. You can edit any records and enter additional information about your plants. itgardendiary

Wednesday, June 20, 2012

Why I've created Garden Diary

This application was created at the request of my wife Victoria. She loves house plants and cares for a small indoor garden. Several times I started working on this problem, but every time delayed due to other cases. At first, I planned to write a small program for desktop computers, but then I thought that the gardeners are not very convinient to walk around the garden with a computer. As time went on sale tablets iPad, Andoid and other. But I did not know very well how to write applications for them. So I decided to make a web application running on any device. It's really cool when any user starts to work immediately with your application without any installations and configurations. Now that everything is almost ready I can say what Garden Diary can do. First, you can record all your plants, along with their pictures. Then enter for each plant the necessary procedures that you do on a regular basis such as watering, fertilizing, weeding and so on. All procedures are automatically placed in the to-do list that needs to be done, and then implement them in your annual Gardener's Journal. Just in time to create this application, I listened to amazing lectures by Steve Huffman on udasity.com where he suggested how to use Google Map in own web applications. It was a great idea. Now, any gardener can show all his plants directly on the map and the program will show when and where he should work now. I hope Garden Diary will be useful not only my wife but also to other gardeners and plant lovers. itgardendiary

Friday, March 23, 2012

Online inventory system SaaS

We are going to start soon a new web service for inventory accounting. It will an online inventory system for apparel and other business. Nothing to install register your account and work from any device.

Tuesday, January 31, 2012

Paging for MS SQL query

It's a usual task get some records from a big table. MySql has a simple operator Limit offset,pagesize
If you want to get 16-20 records from the table Customers you write in MySql
SELECT * FROM Cbstomers LIMIT 15,5

It's a not trivial task for MS SQL query. We should write the next query :

SELECT * FROM (SELECT TOP 5 CustomerID,FullName From (SELECT TOP 20 Customers.CustomerID, Customers.FullName
FROM Customers
ORDER BY Customers.CustomerID ASC) As T2 Order by CustomerID DESC) ORDER BY CustomerID ASC;

page size=5
current page=4
current page x page size=20