Posted January 08, 2016
Disclaimer: Very dumbed down explanation incoming :) So if there is any CS guys out there, please cut me some slack.
What you describe is roughly how AI in computer games are implemented these days as far as I know. Again very roughly, there is a set of states, rules to transition between those states, and a "value" for each state; and then the computer uses a limited set of computational resources to search the state space to find a transition that results in the maximum value. One important thing to get this general design to work is to assign the values to states correctly, and since the rules of, say, a RTS game are extremely complex to represent and analyze in a formal manner, this process is often driven by developers pulling those values out of their ass :) Cheats and unfair advantages etc are then introduced to improve the situation during gameplay testing.
With a game like chess where the states (i.e., all possible positions and combination of the pieces on the board) and rules are well-defined and could be formalized, you could compute concrete values for each and every move, considering all future turns of the game, and save this in a data structure in the memory. Then all the computer needs to do is look at the current state, find paths from it to a winning state, pick the one with the highest probability of being successful (there may not be a 100% winning path, because the human player's future moves will affect the game state as well, so things are probabilistic), and execute it.
This means the computer can *in theory* play perfectly. But computers work with limited resources: that data structure would be huge, and searching the structure for the optimal move would take a loooooong time, etc. In short, this approach is computationally not feasible for chess. So optimizations and compromises are made, like limiting the look-ahead so that all this computation is made only considering the next few turns, or introducing time limits for the search (e.g., computer has to decide in 5 seconds max).
But implementing something even simpler with a small number of states in this way is totally possible, for example unbeatable tick-tock-toe is a common programming exercise for university AI classes.
What you describe is roughly how AI in computer games are implemented these days as far as I know. Again very roughly, there is a set of states, rules to transition between those states, and a "value" for each state; and then the computer uses a limited set of computational resources to search the state space to find a transition that results in the maximum value. One important thing to get this general design to work is to assign the values to states correctly, and since the rules of, say, a RTS game are extremely complex to represent and analyze in a formal manner, this process is often driven by developers pulling those values out of their ass :) Cheats and unfair advantages etc are then introduced to improve the situation during gameplay testing.
With a game like chess where the states (i.e., all possible positions and combination of the pieces on the board) and rules are well-defined and could be formalized, you could compute concrete values for each and every move, considering all future turns of the game, and save this in a data structure in the memory. Then all the computer needs to do is look at the current state, find paths from it to a winning state, pick the one with the highest probability of being successful (there may not be a 100% winning path, because the human player's future moves will affect the game state as well, so things are probabilistic), and execute it.
This means the computer can *in theory* play perfectly. But computers work with limited resources: that data structure would be huge, and searching the structure for the optimal move would take a loooooong time, etc. In short, this approach is computationally not feasible for chess. So optimizations and compromises are made, like limiting the look-ahead so that all this computation is made only considering the next few turns, or introducing time limits for the search (e.g., computer has to decide in 5 seconds max).
But implementing something even simpler with a small number of states in this way is totally possible, for example unbeatable tick-tock-toe is a common programming exercise for university AI classes.
Post edited January 08, 2016 by onarliog