state pattern under pressure --queen"under pressurea very useful tool for thinking through software problems is the state diagram in state diagramyou construct graphwhere nodes represent the state of the system and edges are transitions between one node in the system and another state diagrams are useful because they let you think visually about the state of your system given certain inputs you are also guided to consider the ways in which your system transitions from one state to the next since we mentioned creating games earlier in this bookwe can model the player character as state machine the player might start out in the standing state pressing the left or right arrow keys might change the state to moving left or moving right the up arrow can then take the character from whatever state they're in into the jumping stateandsimilarlythe down button will take the character into the crouching state even though this is an incomplete exampleyou should begin to understand how we might use state diagram it also becomes clear that when the up arrow key is pressedthe character will jump up and then come back downif the key has not been releasedthe character will jump again releasing any key will take the character from whatever state it was in back to the standing state another example from more formal sphere would be looking at an atm machine simplified state machine for an atm machine might include the following stateswaiting accepting card accepting pin input validating pin (cwessel badenhorst badenhorstpractical python design patterns