add cpp version gumbalstate state pattern