This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Felkami's profile picture

Slaughterbot for breeding & slaughtering livestock

Started by Felkami, 27 February 2013 - 12:41 PM
Felkami #1
Posted 27 February 2013 - 01:41 PM
Hello!

It slices, it dices, then it makes them breed! The Slaughterbot is here to fill all your needs!
Come one come all and have some steak, the Slaughterbot will make it while you take a break!
Need feathers for arrows or hide for books? The Slaughterbot will help while you sleep near a brook!

Warning: Not recommended for pets or children under the age of 65.

This is my slaughterbot 1.0 code. Its purpose is to automatically breed and slaughter livestock. It depends on activating a water (or some other form) of trap via redstone current to bring the animals to it and the Misc. Peripherals feeder addon for feeding. Right now it has an issue with population increase, it seems to do everything just right, but over the course of 64 wheat or seed, I've consistently ended up with twice as many cows or chickens as when I began.

Here's the code: http://pastebin.com/yERQWcbP
Engineer #2
Posted 28 February 2013 - 04:49 AM
Why dont you let the animals breed if the bot have killed 2 animals?
Felkami #3
Posted 28 February 2013 - 08:34 AM
Why dont you let the animals breed if the bot have killed 2 animals?

There's a time/efficiency balance the program needs to meet. Up to a certain point, the more animals the more drops per cycle, but because there's only a finite space around the bot, at a certain point the gain vs risk (of clipping through pen, performance hit on world, increased chances of feeding an odd number of animals, etc. ) for keeping a larger flock diminishes. Given this, there's a 'sweetspot' flock size for a given pen setup that optimizes drop rate and efficiency. Not culling below that optimum flocksize increases the overall efficiency because what you loose this cycle by not culling, you gain next cycle by multiplying the number of animals available for breeding up to the point of dimininshing returns. For me that sweetspot is either 4 or 6 fed animals.

The minimum flock size for culling also prevents a population collapse. The fewer animals you have, the more likely that random events will drop your population below how many will be culled next cycle, so if I have 2 cows, they breed and make 1 cow, then a spider comes along and kills 1 cow, next cycle one cow will be culled leaving me with 1 cow, not enough to breed. I'd then have to go out, find another cow and lure them to the pen. If I only slaughter at 4 feeds, then my program won't cull after making a single calf, and so when the spider comes along I still have 2 cattle to breed and my population can eventually rise back up to 'safe' levels without player intervention.
Gaverah #4
Posted 29 March 2013 - 07:23 PM
any chance that we can get a screen shot of your setup as that would make using the program a lot easier.