Team 1836's 2012 code rewritten in Java