Added Check for the winner & overwrite prevention

I have added the function check() and overwrite prevention in this
commits. Try some test cases on it.
Final working

Tested
1. Player1 win
2.Player2 win
3.Tie
Merge pull request #1 from manishmalik/master

Added Check for winning and tie. Added overwrite prevention