added algo for checking if game has been won. not fully tested yet