card game problem, though not working correctly