Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --local path="storage/sdcard0/DWorkspace/ACOS ideas/Andy (Dev)/EA testing"
- local path=shell.resolve(".")
- dofile(path.."/lib/indv.lua")
- world={
- {0,0,0,0,0},
- {0,0,0,1,0},
- {0,0,1,0,0},
- {1,0,0,0,0},
- {0,0,0,0,1},}
- function serialize(table)
- local sresult,k1="{\n",nil
- for k,v in pairs(table) do
- if type(v)=="table" then k1=serialize(v) v1="," else k1=k v1="="..v.."," end
- sresult=sresult.." "..k1..v1.."\n"
- end
- return sresult.."}"
- end
- function serialize2(table)
- local sresult,k1="{\n",nil
- for k,v in pairs(table) do
- if type(v)=="table" then k1=serialize2(v).."\n" v1="," else k1=k v1="="..v.."," end
- sresult=sresult.." "..k1..v1
- end
- return sresult.."}"
- end
- function refuel(x)
- --print"refuel called"
- if world then
- local newW=x:feed(world) else error("newW is nil or false",2) end
- if not newW then print("Could not refuel") return false else world=newW end
- print"--Refuel Complete!--"
- print("Current fuel lvl:"..x.fuel)
- end
- local function arrow()
- if test.rot==1 then
- return "^"
- elseif test.rot==2 then
- return "<"
- elseif test.rot==3 then
- return "v"
- else
- return ">"
- end
- end
- function updateUI()
- sleep(0.2)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- for k,v in pairs(world) do
- for _,__ in pairs(v) do
- if __==1 then term.setBackgroundColor(colors.green) end
- if test.pos.x==_ and test.pos.y==k then term.write(arrow()) else term.write(" ") end
- term.setBackgroundColor(colors.white)
- end
- print""
- end
- sleep(0.3)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- end
- local individuals={}
- test=individual:new()
- --[[test:go(world)
- test:turnLeft()
- refuel(test)]]
- dofile(path.."/AIs/testAI.lua")
Advertisement
Add Comment
Please, Sign In to add comment