neural cleanup

This commit is contained in:
kepler155c@gmail.com
2019-05-01 00:17:37 -04:00
parent 0ec0c63ba6
commit 074e0742d5
3 changed files with 28 additions and 15 deletions

View File

@@ -1,11 +1,17 @@
--[[
Breed either cows or sheep.
Must be run on a mob with the same height.
]]
local neural = require('neural.interface')
local Sound = require('sound')
local Util = require('util')
local os = _G.os
local BREEDING = 'Cow'
local WALK_SPEED = 1.5
local MAX_COWS = 12
local MAX_GROWN = 12
neural.assertModules({
'plethora:sensor',
@@ -71,7 +77,7 @@ end
local function getEntities()
return Util.filter(neural.sense(), function(entity)
if entity.name == 'Cow' and entity.y > -.5 then
if entity.name == BREEDING and entity.y > -.5 then
return true
end
end)
@@ -101,7 +107,7 @@ while true do
local entities = getEntities()
if Util.size(entities) > MAX_COWS then
if Util.size(entities) > MAX_GROWN then
kill(randomEntity(entities))
else
local entity = getHungry(entities)