Skip to content

Instantly share code, notes, and snippets.

@scalatron
scalatron / Brian.scala
Created May 21, 2012 04:42
Brian McKenna's Bot from Scalatron hack night at ScalaSyd May 9, 2012
// Brian McKenna's Bot - based on Scalatron Reference Bot - from Scalatron hack night at ScalaSyd May 9, 2012
import util.Random
object ControlFunction
{
def forMaster(bot: Bot) {
val (directionValue, nearestEnemyMaster, nearestEnemySlave, nearestGoodBeast, nearestGoodPlant) = analyzeViewAsMaster(bot.view)
val dontFireMissileUntil = bot.inputAsIntOrElse("dontFireMissileUntil", -1)
@scalatron
scalatron / Keynan.scala
Created May 21, 2012 04:41
Keynan Pratt's Bot from Scalatron hack night at ScalaSyd May 9, 2012
// Keynan Pratt's Bot - based on Scalatron Reference Bot - from Scalatron hack night at ScalaSyd May 9, 2012
object ControlFunction
{
var mbCount = 0
var step = 0
var energyLast = 0
def forMaster(bot: Bot) {
if(bot.generation == 0 && bot.time < 4500 && bot.energy > 100 && ((step % 3) == 0 || step < 1000)){
bot.spawn(XY(0,1))
@scalatron
scalatron / Example Bot 2 - The Tag Team
Created April 23, 2012 04:54
Rough draft of a framework for simpler, more elegant Scalatron bot coding
// Example Bot #2: The Tag Team
/** This bot spawns a collection of companion mini-bots which strive to remain at a configurable
* offset relative to their master bot. The master bot runs in large circles.
*
* The master bot uses the following state parameters:
* - heading = direction it is currently traveling
* - lastRotationTime = simulation the time when the bot last rotated its heading
* - lastSpawnTime = simulation time when the last mini-bot was spawned
* The mini-bots use the following state parameters: