User File #13736466155210461

Upload All User Files

#13736466155210461 - Q-Bert Bot (another attempt)

Q-Bert_Bot_new.lua
Game: Q*bert ( NES, see all files )
813 downloads
Uploaded 4/2/2014 2:34 PM by TASeditor (see all 188)

-- New Q-bert Bot; Version 0.0.3; DOESN'T WORK!
-- https://imagizer.imageshack.us/v2/981x785q90/35/rjaa.png

X = 0; -- the coordinates Q-bert currently stands on start
Y = 0;
Xtemp = 0; -- used for testing a movement in x/y direction
Ytemp = 0;
Xused[1 .. 9999999][1 .. 999] = 0; -- the used for x/y coordinate for a movement; no idea how high these numbers will get
Yused[1 .. 9999999][1 .. 999] = 0;
number_of_necessary_jumps = ; -- probably unknown
jump = 1; -- set number for fisrt jump
index = 1; -- set number for the first branch/table
max_index = 1; -- set number for maximum amount, highest index, of branches/tables


-- the following program should run without the game running

function CheckIfBeaten()

--[[
Create a function which checks if the game is beaten
i.e: all blocks have the needed color, every block is in the branch/table
]]--

end;


repeat

for index = 1, max_index, 1 do
												
X = Xused[index][jump];	-- set new coordinates depending 
Y = Yused[index][jump];

movement();

end;

function movement()
													
	Xtemp = X + 1															
	if Xtemp + Y > 5																					
		then 											
		else if X ~= 5 
			then Xused[index][jump]=Xtemp; -- creates a new branch/table
				 Yused[index][jump]=Y;
				 index = max_index + 1; -- create a new branch/table for the next movement
				 max_index = index; -- used to not overwrite old branches  
			end;			
	end;													
																						
	Xtemp = X - 1										
	if Xtemp < 0										
		then 											
		else Xused[index][jump]=Xtemp;
			 Yused[index][jump]=Y;
			 index = max_index + 1;
			 max_index = index;		 
	end;												
														
	Ytemp = Y + 1										
	if Ytemp + X > 5										
		then 											
		else if Y ~= 5 
			then Yused[index][jump]=Ytemp;
				 Xused[index][jump]=X;
				 index = max_index + 1;
				 max_index = index;			  
			end;
			
	end;														
														
	Ytemp = Y - 1										
	if Ytemp < 0										
		then 											
		else Yused[index][jump]=Ytemp;
			 Xused[index][jump]=X;
			 index = max_index + 1; 
			 max_index = index;		 
	end;												
end;

jump = jump + 1; -- next jump

if jump >= number_of_necessary_jumps -- could be unknown, use the amont of blocks instead
CheckIfBeaten();
end;

until -- every possible route is tested


while (true) do

Lives = memory.read_u8(0x08);

--[[
a piece of code which test out every branch/table that worked
]]--

emu.frameadvance();

end;