So I've decided to try and bot Arkanoid. Unfortunately, trying to brute force it, even with my tree method, would finish 1 level somewhere near the heat death of the universe.
Heres a current attempt to try and force it seek out the balls. Still taking far too long.
Requires starting at frame 731 of Baxter's currently published movie.
start_savestate = savestate.create();
holder_savestate = savestate.create();
holder2_savestate = savestate.create();
holder3_savestate = savestate.create();
FCEU.speedmode("nothrottle");
savestate.save(start_savestate);
local wins = 0;
local fails = 0;
local survivals = 0;
local key1 = {};
local winner_frames = 1034;
local max_fail = 0;
local input_string = "";
local frame_start = 0;
local curr_frame_count = 0;
local last_fail = 0;
local last_fail_input = -1;
local last_save = 0;
local last_save2 = 0;
local last_save3 = 0;
local last_save_pos3 = 999999999999999999999999999999;
local fail = 0;
local only_left = 0;
local only_right = 0;
local curr_keys;
local Ball1Y = 0x0037;
local Ball1X = 0x0038;
local Ball2Y = 0x0230;
local Ball2X = 0x0233;
local Ball3Y = 0x0234;
local Ball3X = 0x0237;
local paddle = 0x0207;
local BlocksLeft = 0x000F;
while true do
--Reset keys
key1 = {};
--Current frame is part of old movie
if (curr_frame_count < last_fail) then
--use input string
curr_keys = string.sub(input_string,curr_frame_count+1, curr_frame_count+1);
if (curr_keys == "0") then
end;
if (curr_keys == "1") then
key1.left = 1;
end;
if (curr_keys == "2") then
key1.right = 1;
end;
end;
--Current frame is first frame of new movie
if (curr_frame_count == last_fail) then
if last_fail_input == -1 then
input_string = input_string .. "0";
end;
if last_fail_input == 0 then
key1.left = 1;
input_string = input_string .. "1";
end;
if last_fail_input == 1 then
key1.right = 1;
input_string = input_string .. "2";
end;
end;
--Current Frame is subsequent frame of new movie
if (curr_frame_count > last_fail) then
input_string = input_string .. "0";
end;
-- Bookmark 1
if math.floor(curr_frame_count/5) > last_save then
last_save_pos = curr_frame_count;
savestate.save(holder_savestate);
last_save = last_save+1;
end;
--Bookmark 2
if math.floor(curr_frame_count/10) > last_save2 then
last_save_pos2 = curr_frame_count;
savestate.save(holder2_savestate);
last_save2 = last_save2+1;
end;
--Bookmark3
-- if math.floor(curr_frame_count/50) > last_save3 then
-- last_save_pos3 = curr_frame_count;
-- savestate.save(holder3_savestate);
-- last_save3 = last_save3+1;
-- end;
--Set joypad to current frame and execute
joypad.set(1, key1);
FCEU.frameadvance();
if max_fail < curr_frame_count then
only_left = 0;
only_right = 0;
end;
--Fancy pants outputs
gui.text(1,10,input_string);
gui.text(5,60,"Failures: " .. fails);
gui.text(5,70,"Survivals: " .. survivals);
gui.text(5,80,"Only Left " .. only_left);
gui.text(5,90,"Only Right " .. only_right);
gui.text(5,100, "Last Fail Frame: " .. last_fail );
gui.text(5,110,"Max Fail " ..max_fail);
gui.text(5,120,"LFI " ..last_fail_input);
--increment for next frame
curr_frame_count = curr_frame_count + 1;
--Failure due to ball lost
if (memory.readbyte(Ball1Y) > 222) then
fail = 1;
if memory.readbyte(Ball1X) < memory.readbyte(paddle) then
only_left = 1;
else
only_right = 1;
end;
end;
if (memory.readbyte(Ball2Y) > 222) then
fail = 1;
if memory.readbyte(Ball2X) < memory.readbyte(paddle) then
only_left = 1;
else
only_right = 1;
end;
end;
if (memory.readbyte(Ball3Y) > 222) then
fail = 1;
if memory.readbyte(Ball3X) < memory.readbyte(paddle) then
only_left = 1;
else
only_right = 1;
end;
end;
if fail == 1 then
fail = 0;
--increment failures
fails = fails + 1;
-- determine last fail
last_fail = curr_frame_count-1;
if only_left == 1 then
while (string.sub(input_string, last_fail, last_fail) == "1") or (string.sub(input_string, last_fail, last_fail) == "2") do
last_fail = last_fail - 1;
end;
else
while (string.sub(input_string, last_fail, last_fail) == "2") do
last_fail = last_fail - 1;
end;
end;
if only_right == 1 then
last_fail_input = 1;
elseif only_left == 1 then
last_fail_input = 0;
else
if string.sub(input_string, last_fail, last_fail) == "0" then
last_fail_input = 0;
end;
if string.sub(input_string, last_fail, last_fail) == "1" then
last_fail_input = 30;
end;
end;
input_string = string.sub(input_string, 1, last_fail-1);
-- Can we load bookmark 1?
if (last_fail > last_save_pos) then
savestate.load(holder_savestate);
curr_frame_count = last_save_pos;
-- How about bookmark 2?
elseif (last_fail > last_save_pos2) then
savestate.load(holder2_savestate);
last_save = last_save2*2;
-- elseif (last_fail > last_save_pos3) then
-- savestate.load(holder3_savestate);
-- last_save = last_save3*10;
-- last_save2 = last_save3*5;
-- Time to start from scratch!
else
savestate.load(start_savestate);
curr_frame_count = 0;
last_save = 0;
last_save2 = 0;
-- last_save3 = 0;
end;
max_fail = math.max(max_fail, last_fail+1);
end;
end;