Skip to content

Instantly share code, notes, and snippets.

@j-mao
j-mao / engine.py
Created August 22, 2021 01:45
POC Battlecode Python engine without bytecode rewriting
#!/usr/bin/env python
import importlib
import sys
import threading
EXCEPTION_BYTECODE_PENALTY = 500
class Unit:
@j-mao
j-mao / dials_algorithm_pseudocode.txt
Created January 16, 2021 07:44
Battlecode 2021 pathfinding lecture
DIAL'S ALGORITHM - PSEUDOCODE
Input:
Source = starting location
TimeToTravel[u, v] = how long to travel from u to v
C = maximum possible time a single step takes (for example, 10)
Initialize Q = list of C+1 collections of locations
If a location we want to expand has distance d, it will be stored in Q[d % (C+1)]
Initialize Expanded = an array of Booleans for the map, all false
@j-mao
j-mao / RobotPlayer.java
Created January 10, 2021 01:29
Battlecode 2021 Pathfinding lecture
/*
* Battlecode 2021
* Pathfinding Lecture - sample code
*
* Bug pathing and communication strategies. Run this on the map "Quadrants" for a sense of how
* this strategy behaves: watch the red robots in the bottom-left corner.
*
* https://www.battlecode.org/
* https://github.com/battlecode/battlecode21
*/