I am very confused as to what the "state" of a game is. In the following link: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2011/assignments/nims.py are lines 7-10 the "state" of the game? If you don't want to click the link, it is the nims.py file under supporting files for homework two.
I see nothing that talks about "state" in that code. However, the state something is in may be used in the standard way: the present condition. If someone was angry or worried or frantic, someone else might say, "They were in quite a state!" That usage of the word, the condition now, has migrated to computers. It means "what is all the stored information the program has access to right now."
ok, so in the case of a game such as nims (the game in the link), if I have a program that requires user input (which assigns variables a new entity), the "state" of the program would be the current state of the program (where state is defined colloquially the second time), with all of the variables updated to whatever the user changed while running the program?
Yes, that is the state at that moment.
Thank you:)
Join our real-time social learning platform and learn together with your friends!