|
|
 | | From: | Daniel_Lidström | | Subject: | Simple prediction | | Date: | Fri, 21 Jan 2005 23:37:49 +0100 |
|
|
 | Hello
here's a program that can do simple prediction (prediction by partial match). For example, the prediction string `sbbssmsmsassbbs' is the encoding of some action and the next action is to be guessed, based on the previous pattern. In this case the program predicts the following:
Enter string for prediction: sbbssmsmsassbbs a 10% b 20% m 20% s 50%
Next action is very likely `s'. I used this to predict an opponent's actions in an online gladiator game. Have fun with it!
// Finite Context Model prediction. // See http://www.cbloom.com/algs/markov.html // Predict the next character by looking at previous // character sequences. // If no previous sequence matches current sequence, // character is predicted based on the number of // occurrences.
#include #include #include #include #include |
|
|