Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hackathons, small, fast and completely out of c...

Hackathons, small, fast and completely out of control

What @mwotton and @chris_beckett learnt and built at RailsCamp AU 2012, and what it means for undirected effort.

Avatar for Christopher Beckett

Christopher Beckett

December 12, 2012

Other Decks in Programming

Transcript

  1. 5% 15% 80% Alcohol Werewolf Code AND WE DID ALL

    OF THEM Thursday, 13 December 12
  2. Subsumption Architecture “Planning is just a way of avoiding figuring

    out what to do next” R. A. Brooks (1987) Thursday, 13 December 12
  3. THE DRUNKARD class DrunkenWalker < Bot def choose(state,tiles) return(['move', {dir:

    ['n', 'e', 's', 'w'].sample}]) end end Thursday, 13 December 12
  4. class WallHugger def choose(state,tiles) @facing ||= 'n' ['move', {dir: in_space(state,tiles)

    ? @facing : most_right(state, tiles)] end def in_space(state, tiles) surrounding(state.you.position).all? do |tile| tile.type != 'wall' end end def most_right(state, tiles) face_index = DIRECTIONS.index @facing (-1..2).find_index do |offset| next_dir = DIRECTIONS[(face_index + offset) % 4] free(apply_move(next_dir, state.you.position), tiles) && next_dir end end end THE WALKER Thursday, 13 December 12
  5. THE GATHERER class Dropper < Bot def choose(state, tiles) you

    = state.you if you.have_treasure && you.position == you.stash.position return ['drop', {}] end end end Thursday, 13 December 12
  6. THE SOLDIER class Killer < Bot def choose(state, tiles) you

    = state.you target = you.position.neighbours.find do |tile| tile.type == 'player' && tile.player.name != you.name end target && ['attack', { 'dir' => BotUtils.to_dir(you.position, target) }] end end Thursday, 13 December 12
  7. THE PATHFINDER class StashSeeker < Seeker def abort?(state, tiles) state.you.have_treasure

    end def targetable?(square, state) square.is_stash && square.position != state.you.stash.position && !square.treasures.empty? end end class Seeker # some caching logic elided def choose(state, tiles) return nil if abort?(state, tiles) tiles.find do |pos, tile| targetable?(tile, state) && @gridsearch.move(tiles, state.you.position, pos) end end end Thursday, 13 December 12
  8. TOP-DOWN BOTTOM-UP GAMES BUSINESS Planning A* GOFAI Our stupid bot

    Hierarchy Enterprise Hackathons Start-ups CONCLUSIONS Thursday, 13 December 12