green = Color.new(0,255,0)
red = Color.new(255,0,0)
waittime = 0
select = 1
select1=red
select2=red
select3=red
select4=red

oldpad=Controls.read()
while true do
screen:clear()
waittime = waittime+1
pad = Controls.read()
screen:print(0,0,"Polynomial Engine, By 10$man",green)

if pad:up() and pad:up() ~= oldpad:up() then
	select = select-1
end

if pad:down() and pad:down() ~= oldpad:down() then
	select = select+1
end

screen:print(100,100,"Quick solve Factoring polynomials",select1)
screen:print(100,120,"Solve already input Factoring polynomials",select2)
screen:print(100,140,"FOIL Polynomials (Un-factor)",select3)
screen:print(100,160,"Go Back",select4)

if select>4 then
	select=1
end
if select<1 then
	select=4
end
if select==1 then
	select1=green
	else
	select1=red
end
if select==2 then
	select2=green
	else
	select2=red
end
if select==3 then
	select3=green
	else
	select3=red
end
if select==4 then
	select4=green
	else
	select4=red
end

if pad:cross() and select==1 and waittime>10 then
	dofile("./System/quickpol.lua")
	break;
end
if pad:cross() and select==2 and waittime>10 then
	dofile("./System/pol.lua")
	break;
end
if pad:cross() and select==3 and waittime>10 then
	dofile("./System/foil.lua")
	break;
end
if pad:cross() and select==4 and waittime>10 then
	dofile("./System/menu.lua")
	break;
end
	
screen.waitVblankStart()
screen.flip()
oldpad=pad
end