Update card_memory.py

better for use the state machine
much clear than other copy