04.04.2020»»суббота

Chimpoo Simpoo Jaldi Aa

04.04.2020
    86 - Comments
  1. Chimpoo Simpoo Jaldi Aaja
  2. Chimpoo Simpoo Jaldi Aa Song
  3. Chimpoo Simpoo Jaldi Aa Movie
  4. Chimpoo Simpoo Jaldi Aa Full

Jun 11, 2011 A few side notes about the movie - because everyone loves anecdotes. I think almost everyone knows this story, but it's worth mentioning because of how personal it feels! The scene where Raju first visits the Braganza house and Bobby unknowingly wipes besan batter in hair, whining 'Jaldi bolo, mera tel jal raha hai!' Apr 10, 2017 Chimpoo Simpoo - A detective duo with minds that work faster than you can imagine, instincts that save them from precarious situations and the presence of mind to invent and discover on the go. Crime Patrol 20th March 2020; Beyhadh 2 20th March 2020; Pavitra Bhagya 20th March 2020; Mujhse Shaadi Karoge 20th March 2020; Mere Dad Ki Dulhan 20th March 2020.

Cross platform messaging app LINE with over 200 Million users worldwide has collaborated with Mumbai based Vaibhav Studios for an exclusive pack of wacky stickers titled æIndian Dhamaal’. Created by Vaibhav Kumaresh- Founder of Vaibhav Studios, this sticker pack is free to download for Indian LINE app users.

AnimationXpress.com interacted with Vaibhav Kumaresh to know more about the making of æIndian Dhamaal’

How did this project happen?
The creative team from LINE Japan met us around June end. They had seen Simpoo and were thankfully impressed! They were looking for something similar for their stickers in India. I am so glad and grateful to Rajesh Saathi- Founder and Director at Keroscene films, Mumbai for recommending my name for this exciting project. Rajesh has also produced the LINE India Tvc’s currently on air.

What was the brief given to you by LINE?
The design head from LINE accompanied by his translator visited our studio. They explained to me in detail what LINE was all about and their plans for India. Stickers are definitely the USP of LINE and I was damn happy to see their sticker library. They had a variety of stickers from all over the world including ones featuring popular international characters like Popeye, Doraemon, Mickey Mouse, characters from Toy Story, Lilo & Stitch to name a few. They now wanted to launch a new range of stickers exclusively for India and they had chosen Vaibhav Studios for it! I couldn’t have been happier and more honored!

Could you share the approach that you went with to create these stickers?
I was thrilled just to think that our designs would be used every day by thousands of users in their daily conversations! To me it was a great way to connect with our audience. I expressed my excitement to team LINE and assured them that they could count me in. Vaibhav Studios was more than willing to partner with them on this.

How many stickers did you create?
I had to create 80 stickers in all. I began with noting down all the ideas that were pouring in. Communication in India is so vast culturally, that I was flooded with loads of options in my head. As I typed out a situation and how to depict it, another situation popped up in my head! So once everything was out of my head, I shared them with team LINE in Japan. Team LINE sent me technical requirements for the artwork submission, guidelines on content and examples of good as well as bad design. That really helped me plan my designs. Once I started doodling them, the real fun started! It was also easier for team LINE to react to visuals than to text descriptions. Since these images were going to be eventually viewed at a very small size, I would zoom out my artworks and judge them in a thumbnail form. It greatly helped me to simplify my thoughts as well as my illustrations.

Was there extensive research done for creating the stickers?
Most of the stickers are drawn from memory. I just sat and thought of various kinds of conversation-chains that people have. Then I applied my thought on how my doodles could assist or juice up those expressions and situations. Other than that I looked up photos of Sridevi from Naagin, Mandakini and Silk Smitha! That was fun! That’s all the æresearch’ I did!

We would like to know more on the art style used?
I just draw my heart out. And yes, I use bold outlines and simple color contrasts so that it reads well even in a thumbnail size. That was my only THUMBnail rule!!

Were there any concept ideas that you liked but couldn’t add it?
If I strongly recommended a design, team LINE was very understanding and accepted my inputs. I am glad they trusted my judgment on the design front. I created various options so yes certain designs were dropped. We only chose the best ones so no regrets.

How much time did you take to complete æIndian Dhamaal’?
I must have taken 2 weeks of dedicated time spread across a month.I drew directly on Photoshop using a Wacom tablet.

Who all have contributed to this project?
I drew them all but I would bounce off every day’s work and every feedback from team LINE with our entire team. Our team also contributed with their requests for various situations during the brainstorming phase. The LINE team includes Kim Daeseok- Senior Manager, Design and Naotomo Watanabe- Service Planning Dept.

The best part for me is that the users interpret the visuals in different ways. By using the same design in different contexts, the meaning of the same image changes beautifully! Now that I am seeing people use them, I am really enjoying this aspect.

When did the sticker collection come out? Is the sticker collection out in India?
æIndian Dhamaal’ is the sticker pack that is free to download. It was launched at 2.30pmJapan time on 3rd September 2013. Yes this collection is exclusively for users activating their accounts in India. There’s a new series of another 40 stickers coming up real soon so all I can say is jaldi LINE pe aa jaao!

Naotomo Watanabe from LINE inc. Japan also shares his views on æIndian Dhamaal’ brought out by Vaibhav Studios
“We intend to increase stickers of the expression specific to each country in future because an expression of communication is different in Japan from India. After delivering <Indian Dhamaal!>, downloads have been more than 5 times a normal sticker. The number of æsends’ is 8 times! My colleagues in Japan are also pleasantly surprised. However Japanese users cannot download these as it’s exclusively available only in India. We are very glad that we were able to deliver such a splendid and beautiful sticker in India. And we thank Vaibhav for the quick response.”

What is your motivation for writing this?

Note: skip to the next section if you don’t care about the back-story and want to get straight to the actual algorithm.

Back in 2008 I was starting Computer Science at UNSW. I was actually enrolled in the course that became those famous YouTube video lectures on Computer Science by Richard Buckland. I was also enrolled in your standard first year Maths course at the time and we were just learning Matrix mathematics. While in the computing lectures and in the grounds and basements around campus I had a friend that loved to play Minesweeper and boy were they fast. But as I watched them play I came to realise that it really was a simple game and probably something that would be better suited to a computer solving. And then, as I wrote out a simple game of minesweeper it hit me, you could solve Minesweeper with matrices I then proceeded to write program that did exactly that, it solved minesweeper as best as it could without probabilities.

Fast forward to just last month, just before Christmas, when I checked Reddit and saw the following blog post get released: http://luckytoilet.wordpress.com/2012/12/23/2125/

It was a pretty cool blog post and it explained a method of solving minesweeper and how you would go about doing that. I commend the author on writing it. However, one thing bugged me, nobody seemed to realise that you can actually solve Minesweeper by using Matrices (and one special lemma specific to minesweeper). So I made a comment to that affect on Reddit and I gained some interest from people that wanted to know how to do that and how it was possible. So I have decided to explain this method fully and provide a working implementation. It was a fair bit of work but I hope that you enjoy the end results.

Just as a side note: I want you to know that I am not unique in finding this method of solving Minesweeper. Here is a website of somebody that discovered it two years after I did. And I am sure that there are people that worked that out before we did again. I believe that Matrices are just the natural way to solve this kind of problem.

Quick Overview

This blog post is going to cover:

  • A simple example of how this method works and can be used to find solutions to Minesweeper configurations.
  • A robust and reasonably efficient general algorithm that explains how to apply this in the real world.
  • A brief description of my implementation of this method which is available on BitBucket: http://bitbucket.org/robertmassaioli/minesweeper-and-matricies/overview
  • Please note that I will try and provide code links, where possible, so that you can follow along in the code. If you are like me then you enjoy reading code more because it is more precise.

Prerequisites

You will need to have the following skills to read this blog post:

  • Linear Algebra Knowledge that includes Matrices. If you don’t know what matrices are then go lean about them, they are very useful tools in a programmers toolkit and you certainly need them for Video Game Development. Really go learn about it; it will take time but it is worth it.
  • How to play Minesweeper. I don’t explain the general rules of minesweeper, if you want to know how to play then go read the rules or, better yet, go play a game before reading this post. You can play Minesweeper on Windows, Linux and OSX; there are ports for every OS.

To read the code you will also need to understand C++; the coding could have been better, sorry. On the plus side, your C++ reading comprehension will improve.

The General Idea (aka How it works)

When dealing with a new problem it helps to first start with a simple example. You use a simple example because it is easier to conceptualise. Using the simple example you then develop a rigorous model for solving the problem in general. Once you have that model you then apply it to more complicated scenarios and problems and you discover, to your pleasure, that you did it. That is exactly the process that we are going to go through here.

A Simple Example

Here is a very small minesweeper configuration and we will be using this as our simple example:

Chimpoo Simpoo Jaldi Aaja

Those of you that have played minesweeper before should be able to solve this configuration as best as you can using the intuition that you have learned from playing many games. That is good, but I want a robust math-based solution to this problem. So lets look at what this Minesweeper configuration tells us. The first thing that I note here is that we have five squares that have not been clicked yet. They are our ‘unknowns’; these squares either contain mines or they do not, there is no other alternative. So since they are our unknowns then lets label them and make them our variables. I have done that in the following image:

Now for any unclicked square xi look at the square x1, lets say that if it is a mine then it has a value of 1 and if it is not then it has a value of 0. Therefore mines are ones and non-mines are zeros; simple.

Now take a look at the top right hand corner square of the previous image; it contains a 1 (from here on in we will call clicked squares that contain numbers ‘numbered squares’). That means that it is adjacent to one, and only one, mine. So first we look to see which non-clicked squares are adjacent to it and we discover that x1 and x2 are the only squares adjacent to it. Therefore we know that the number of mines in both x1 and x2 must add up to equal 1. Another way of writing that is the following:

Now we can come up with similar equations for the other numbered squares on the right hand side of the simple Minesweeper example. If we do that we get the following equations:

You may not be able to see (just yet) why the previous set of equations is incredibly useful, but the key insight here is to realise that you now have a set of five linear equations with five variables. It will be even clearer if you let me add in the co-efficients and the non-clicked squares that had co-efficients of zero:

As you can see this looks exactly like it should be solved using a Matrix that is exactly what we are going to do. Here is the previous results in an augmented matrix:

At this point in time we want to get a solution to this matrix so, as usual, we Gaussian Eliminate to find a solution. The solution is on the next line but I recommend that you solve this yourself on a pen and paper if you have one handy. If you don’t then you can take my word for it and just move to the next line:

On first glance at this eliminated matrix you can immediately tell that there is no unique solution to the vector x (this is where I am relying upon your prerequisite knowledge). This may mislead you into thinking that the Gaussian Elimination failed but that would be incorrect; it worked perfectly and it has given us a partial solution to the vector x. To see why you need to remember that each non-clicked square in the minesweeper grid is either a mine underneath or it is not a mine (1 or 0). Therefore each value in the vector x has the following property:

This means that the matrix above has an extra property that we do not get when the expected values of the vector x could be anything in a set of infinite numbers, like the set of integers or reals. Remember that we are in the boolean set and this will all make sense.

To understand this property lets take a look at the third row of the eliminated matrix. As you can see x3 is the only column of the matrix with a non-zero co-efficient and the row adds to give 1. Setting x3 to be 1 is the only value that makes the row work (conversely, if it last value in the row was 0 then x3 would have to be zero). This means that we can tell that x3 is a mine even though we do not know what the other squares are. It is interesting to note that we can only tell that from the Gaussian eliminated matrix; not the original matrix. So even though the elimination does not find a complete solution it still simplifies the matrix and allows us to get partial solutions. But what is the general rule to get partial solutions from eliminated matricies?

A Special Rule

Lets see a few more example rows that can help us to intuitively derive that rule:

Pretend each of the rows in the above image are unique rows taken from unique matrices (what I am trying to say is that each row above is not correlated, they are all unique). Let me deal with each row in a dot point:

  1. If we take a look at the first row you should be able to tell that x1 and x4 are both mines because that is the only way that they will equal 2.
  2. If you look at the second row you can see that both x1 and x4 must not be mines because that is the only possible solution for x1 + x4 = 0 when the only potential values for any x are ones and zeroes.
  3. The third row is interesting because it has a negative number, that means that the equation is x1 – x4 = 1. This can only be true if x1 is a mine and x4 is not. Now things start to get interesting, clearly we need some concept of a minimum and maximum bound for each equation. In this example the maximum value the equation could take is 1 and the minimum value that it could take is minus one. Since this row meets that upper bound we can solve for it.
  4. This is the same as the previous example except that it meets the lower bound. This also means that we can solve for it.

As we can see the general solution to getting more information from each row is to to work out the lower and upper bounds and see if the value on the other side of the equality is the same as one of the bounds. If it is then you know that there is only one possible configuration of mines that will allow that to occur and you can quickly rattle that off. Because of that uniqueness property you can only apply this rule to a row if it is equal to an upper or lower bound; if it does not then multiple solutions are possible and you have strayed into the area of probabilistic analysis that this blog post will not attempt to cover. This grid shows what logic you use, on a per-square basis, to partially solve the matrix:

Co-Efficient is PositiveCo-Efficient is Negative
Row meets lower boundNot MineMine
Row meets upper boundMineNot Mine
Row meets neither boundsUnsureUnsure

You can use this rule on any Gaussian Eliminated Minesweeper matrix to get partial solutions from rows. Just so that you can really see how that works here is a rough algorithm (and here is a link to the actual C++ code):

Finishing the Simple Example

So now lets wind back to the Gaussian Eliminated matrix. As we can see the only row that we can apply this rule to is row 3 which tells us that x3 is a mine. Therefore we can flag that square:

And that is it for our simple example, we have worked out as much as we possibly can without more information. The game is still in progress but if we want to move forward we would have to make a guess or some probability based decision that could fail. This method of solving Minesweeper only works for grids that are completely solvable without guesswork and it is my future plan to expand this method to include probabilistic analysis as well.

The Robust Algorithm

Taking what we have learned from the simple example we can create an algorithm that is a fair bit more robust:

  1. Get a list of the squares that contain numbers AND are adjacent to at-least one square that has not been clicked or flagged. (code link)
  2. For every numbered square in the list assign a unique matrix column number to that square. This is so that we can map our Matrix columns to Minesweeper squares. (code link)
  3. For every numbered square in the list create a matrix row that represents the adjacent non-clicked squares and the number they touch. Don’t forget to put zeroes in all of the matrix columns that are not adjacent. (code link)
  4. Gaussian Eliminate the Matrix. (code link)
  5. Attempt to use standard matrix reduction, and the special rule that we developed, to get a partial (or even full) solution to the the current Minesweeper configuration. Remember to tackle the matrix from the bottom row up so that you can make use of partial solutions as you go. (code link)
  6. Use the (possibly partial) solution you worked out to generate the list of clicks that should be made: flagging known mines and clicking known empty squares. Leave everything else alone and wait for more information. (code link)
  7. Keep running all of the previous steps in a loop until you either cannot make any moves (meaning that you cannot get further without guessing) or until the game is finished and won. (code link)

And that is all that there is to it. Writing those steps can get a little complicated at times but totally manageable with a decent working knowledge of Matrix mathematics. I have not explained those steps in really great detail because if you want that information then you have now got to the point where you should really check out my code and have a run and read.

The Implementation

All of this talk would mean nothing if I was not able to implement it and show you some working code. Therefore, I have implemented this algorithm from scratch and have provided the source code to everybody under the MIT license. If you use this code anywhere or use the idea, then I would really appreciate it if you mentioned my name or gave me attribution somehow; really it would make my day.

Go get the code from BitBucket:http://bitbucket.org/robertmassaioli/minesweeper-and-matricies/overview (By the way, while we are here, did I mention that I love pull requests)

How do I compile your code? Read the README.markdown file that is in the root directory of the project. It will always have up to date details.

What design choices did you make?

Haha, design choices, that’s a good one. This code is not the most beautiful code that I have ever written. I wrote it all myself to avoid spurious dependencies in the hope of easy cross platform compilation. I have not even used RAII principles in this code and frankly that makes the delete’s sprinkled all over the code quite ugly. If I was writing this without a care in the world for dependencies then I would have used Boost and gained a large amount of nice looking code for free. Also the solver looks like a bit of a monster method at the moment, sorry, it should be re-factored.

How fast is it?

Short answer: very fast and much faster than it needs to be to solve a single game of minesweeper. The longer answer is that his code was written in C++ and it is lightning fast even though it only uses a single core to do the processing and thus does no parallelism whatsoever. It is fast because working with Matrices is quick. I gain speed just by the fact that I used efficient mathematical constructs. To give you an example, it takes less than a minute and thirty seconds to play one hundred thousand minesweeper games on a single core on my computer (I have a machine that contains an “Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz”). I would expect you to see similar speed results on your own machine.

Results of playing many Games

My minesweeper implementation plays a great many games but here are the results of it attempting to play 100000 games of Beginner, Intermediate and Expert minesweeper. Please keep in mind that there are three states that the game can end up in:

  • The Win state: we were able to completely solve the grid without guessing.
  • The Progress state: we got to a point in the game where the only move we could make would have to be a guess. As a result we stopped making moves and left the game partially completed and still ‘in progress’.
  • The Lost state: this happens when you click on a mine. That should not be possible using our method and, if you see that you can consider it a bug and please report it to me.

Beginner

A ‘Beginner’ grid is 8×8 or 9×9 with only 10 mines. have chosen the easier of the two and gone for the 9×9 grid:

As you can see a beginner grid is pretty easy, it only took ~9 seconds for my computer to do play 100000 games and it won ~74% of the time.

Chimpoo Simpoo Jaldi Aa Song

Intermediate

An ‘Intermediate’ grid is 16×16 squares with 40 mines and this is how my run performed:

In an intermediate game there is less chance that you can win without guessing. I have run this a number of times and you have about a 45% chance that you will be given an intermediate grid that you can win without guessing. That makes the intermediate games a fair bit harder.

Expert

An ‘Expert’ grid is 30×16 squares with 99 mines and this is how this current run performed:

As you can see from these combined results the solver is very fast and the difficulty levels of Microsoft’s minesweeper are appropriately chosen; you have a very small chance of getting a grid in Expert mode that lets you win without making at-least one guess. Chimpoo bataye.

Next Steps

There are a few extra things that I would like to do to the codebase if I had some time:

Chimpoo Simpoo Jaldi Aa Movie

  • I would make a probabilistic solver to attempt to solve the majority of the games instead of leaving them in the ‘Progress’ state.
  • I would make the code multi-threaded where I could. Specifically it would be good to run multiple test games in parallel because they are a great example of a ‘painfully parallel’ problem.
  • The code should have better test cases. Currently only the matrix code is tested reasonably well. The game and the solver should have more test cases too.

Chimpoo Simpoo Jaldi Aa Full

So just to wrap it up quickly, this is how you solve Minesweeper with Matrices. Please feel free to ask any questions you like or make suggestions below.