>>5Okay. Here is a simple algorithm, which could be used to replace or speedup emulator (you use markov chains to predict possible good futures, then test them on real emulator). If 100% coverage sampling isn't possible, then we can sample RAM bytes as probabilities of bit being 1 or 0. I.e. 255 is 1.0 probability and 0 is 0.0 probability. That way we can efficiently map gigabyte-sized RAM image into a few kilobyte sampling window.
void markov_chain_ai(video_signal, audio_signal) {
bit_array state;
bit_array predicted_state;
sensors.output_into(state);
user_input.output_into(state);
marko_chain chains[N];
for(chain in chains) {
chain.sample_from(state);
chain.predict_into(predicted_state);
}
for(example in examples) {
sensors.input_from(example.input);
user_input.input_from(example.input);
for(chain in chains) {
chain.train(example.result);
}
}
while(state.are_we_alive()) {
sensors.input_from(emulator.output);
uint8_t best_user_input = 0;
float best_score = 0.0
for (possible_input in range(0,256)) {
user_input.input_from(possible_input);
for(chain in chains) {
// predict_next_state puts votes into predicted_state
chain.predict_next_state();
}
// finally decides which bit is 1 in 0, based on the number of votes from chains
predicted_state.integrate_chain_outputs();
if (predicted_state.score() > best_score) {
best_user_input = possible_input;
best_score = predicted_sate.score();
}
}
state.eval_with(best_input);
}
}