Scala port of ggp-base from cs227b