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.