add solve function
added the changes
Merge pull request #4 from sbashani/master

add checkwin function