cmcrae
asked on
AI. String parsing.
I was wondering ig you could help me. I am trying to get an AI program that will simulate a Heads and tails guessing game. The program is supposed to be played 200 times by the user. The user and the computer pick heads or tails. If the computer and the user pick the same thing the computer wins. The coumputer bases its guess on the previously played heads or tails... so I was wondering how I could get a computer to parse a string and find the best possable guess..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does it really make sense to have the computer attempt to predict what is supposedly a completely random event? If you want it to be fair, the computer should probably guess randomly (that's what the human player is doing [even if he doesn't think so]). Otherwise, I would suggest giving the computer a "skill" which represents a small percentage chance that he guess correctly (cheating). Possibly, you could determine outside factors responsible for the final position of the coin using a neural network. This really isn't an answer, more of an intellectual response. Thank you for indulging me.
Humans don't usually guess things randomly, even if they try to, so it would make some sense trying to predict what the human player will guess next. However, there isn't really any 'best' way to do this unless you make assumptions about the human player. It could for example be that the human player is more likely to pick tails if a majority of the previous guesses was heads. These assumptions will determine what it considered the best thing to do for the computer.
What I would do is assign weights to certain things, like percieved patterns. Then have the computer generate a random number and add (or subtract) the weighted values and guess heads or tails based on the results. This make it so the computer leans one way but is still inherently random.
cmcrae,
(1) Humans do not choose randomly
(2)Most coins are not fair they split 49% Tails and 51% Head roughly.
So there are probably going to be patterns to identify.
(a) A very simple technique is to count the heads (H) and tails (T) over the last say six tosses. Generate a random number 0<= r <=1. If r > T/H then choosee head else choose tails. Simple to program worth a try. (Or even the other way around as the user may subconciously try to compensate for a lack of heads or tails in their previous choices, you can check to see which is the best way around during the running of the game and behave adaptively)
(b) More complex is to search for occurrances of the pattern of say the previous 4 or 5 results and calculating the probablity of a head or a tail for the next. This is more complex as there may not be occurances of the previous pattern in which case you must then search for the next shortest previous pattern.
(1) Humans do not choose randomly
(2)Most coins are not fair they split 49% Tails and 51% Head roughly.
So there are probably going to be patterns to identify.
(a) A very simple technique is to count the heads (H) and tails (T) over the last say six tosses. Generate a random number 0<= r <=1. If r > T/H then choosee head else choose tails. Simple to program worth a try. (Or even the other way around as the user may subconciously try to compensate for a lack of heads or tails in their previous choices, you can check to see which is the best way around during the running of the game and behave adaptively)
(b) More complex is to search for occurrances of the pattern of say the previous 4 or 5 results and calculating the probablity of a head or a tail for the next. This is more complex as there may not be occurances of the previous pattern in which case you must then search for the next shortest previous pattern.
But lets assume that the user to give the best possiable guess without making assumations which was not stated in the problem.
I considered how often a sequence appears, how often it wins/loses, and how much variation was in the sequence.
Need a feedback loop. Interesting problem if you want to feedback more than one decision.