Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6da06fb
k_learning init
CoffeeCoder1015 Mar 23, 2026
ab0622c
base gradient + development movement
CoffeeCoder1015 Mar 23, 2026
2314c44
finding symmetry
CoffeeCoder1015 Mar 23, 2026
d80119b
debug: must set line current pos to be after the move of the round
CoffeeCoder1015 Mar 23, 2026
4a53ec2
mod: moving symmetry into its own file
CoffeeCoder1015 Mar 24, 2026
bde7653
Flattend LUT update in symmetry checker
CoffeeCoder1015 Mar 24, 2026
39ef1ac
debug bot
CoffeeCoder1015 Mar 27, 2026
d66155d
tmp: single bot testing
CoffeeCoder1015 Mar 27, 2026
b3641c9
new quad based exploration
CoffeeCoder1015 Mar 27, 2026
3566c03
goofy movement algorithm
CoffeeCoder1015 Mar 27, 2026
8f1f0e1
closest quadrant recalculation
CoffeeCoder1015 Mar 27, 2026
511f312
working map explorer
CoffeeCoder1015 Mar 28, 2026
b4b20f8
a* explorer
CoffeeCoder1015 Mar 28, 2026
3b2901b
check flattened array update
CoffeeCoder1015 Mar 29, 2026
625e7f2
bucket a*?
CoffeeCoder1015 Mar 29, 2026
054fc25
fix: double pop bug
CoffeeCoder1015 Mar 29, 2026
caf2ea1
feat1: tracking inserted tems
CoffeeCoder1015 Mar 29, 2026
e51cc9a
append and reverse
CoffeeCoder1015 Mar 29, 2026
3e6c068
reset on target switch and smarter impossible target detection
CoffeeCoder1015 Mar 29, 2026
492092c
reveresed path following
CoffeeCoder1015 Mar 29, 2026
ea606ea
update rank on push
CoffeeCoder1015 Mar 29, 2026
f8ca21e
tmp: profiler
CoffeeCoder1015 Mar 30, 2026
7a84047
deltas function is ahh
CoffeeCoder1015 Mar 30, 2026
307278a
corretness changes and updating get_neighbors
CoffeeCoder1015 Mar 30, 2026
d10cb0b
definetly save min_ptr
CoffeeCoder1015 Mar 30, 2026
17c9c66
might be better than min cuz that shit is overloaded as fuck
CoffeeCoder1015 Mar 30, 2026
f9a0379
min max tracking
CoffeeCoder1015 Mar 30, 2026
f55fcb7
local spike timing
CoffeeCoder1015 Mar 30, 2026
2d1e3fd
codex's implementaiton of beam search
CoffeeCoder1015 Mar 30, 2026
b2c21e2
a* bounded frontier and a* cutoff
CoffeeCoder1015 Mar 30, 2026
b000010
combined limited a*
CoffeeCoder1015 Mar 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bots/do_nothing/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from cambc import Controller
class Player:
def __init__(self):
self.num_spawned = 0 # number of builder bots spawned so far (core)

def run(self, ct: Controller) -> None:
return
67 changes: 67 additions & 0 deletions bots/k_learning/builderbot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import random
from cambc import Controller, Direction, Position, Team
from .navigation import Navigation, SymmetryAnalyzer

DIR_VECTORS: dict[Direction, tuple[int, int]] = {
Direction.NORTH: (0, -1),
Direction.NORTHEAST: (1, -1),
Direction.EAST: (1, 0),
Direction.SOUTHEAST: (1, 1),
Direction.SOUTH: (0, 1),
Direction.SOUTHWEST: (-1, 1),
Direction.WEST: (-1, 0),
Direction.NORTHWEST: (-1, -1),
}

DIRECTIONS = [d for d in Direction if d != Direction.CENTRE]

class BuilderBot:
def __init__(self):
self.debug = True
self.ally_core_pos = None
self.round_number = 0
self.dimensions = None

# Symmetry
self.symmetry_analyzer = None

# Movement
self.nav = None

def in_bounds(self,pos: Position):
return 0 <= pos.x <= self.dimensions[0] and 0 <= pos.y <= self.dimensions[1]

def run(self, ct: Controller):
# const updates
self.round_number = ct.get_current_round()

if self.ally_core_pos is None:
self.ally_core_pos = ct.get_position(1 if ct.get_team() == Team.A else 2)

if self.debug:
ct.draw_indicator_dot(self.ally_core_pos, 255, 0, 0)
if self.dimensions is None:
self.dimensions = ( ct.get_map_width(),ct.get_map_height ())
self.symmetry_analyzer = SymmetryAnalyzer(self.dimensions[0], self.dimensions[1], self.ally_core_pos)
self.nav = Navigation(self.dimensions[0],self.dimensions[1])

# Movement
current_pos = ct.get_position()


# Spreading out / Potential logic
# Perturbation spreading
nearby_tiles = ct.get_nearby_tiles()
nearby_units = ct.get_nearby_units()
nearby_buildings = ct.get_nearby_buildings()

# get nearby environment and insert obstacles and ores into LUT
self.symmetry_analyzer.update_symmetry(ct, nearby_tiles, nearby_units)

self.nav.update_info(ct,current_pos,nearby_tiles,nearby_buildings)
self.nav.explore(ct)

# draw possible enemy core positions
if self.debug:
self.symmetry_analyzer.draw_debug(ct)

Loading