2 ms·
One can make the algorithm harder to defeat by making it probabilistic. Eg if it will have some kind of expected next move for you to make, and this probably wo
by dan-robertson 8y ago
One can make the algorithm harder to defeat by making it probabilistic. Eg if it will have some kind of expected next move for you to make, and this probably won’t be “definitely left” or “definitely right”, and then so long as it can get some random source (which you don’t have), it should randomly guess your next move from the probability distribution of your moves. That way it’s guesses can’t win in advance and so it probably won’t be wrong so much, and the problem of beating it becomes harder too. E.g. suppose the algorithm works as follows:
1. Let {l,r} be the numbers of times in the history we have seen a five-letter sequence with a prefix of whatever the four most recently made moves were, and a suffix of {left,right}
2. Pick r randomly between 0 and 1
3. If r > l/(l+r) (or l=r=0), guess the next move is r.
You know this is the strategy so if you can calculate l and r and so make the opposite move (randomly even) and win with a probability of r/(l+r), however by making your move, you make l/(l+r) converge towards 1/2 and so your probability of winning goes to 1/2 too. I suspect the best strategy in the long run is to play randomly or to just repeat some longish cycle that includes each length five cycle an equal number of times.