Paper-and-pencil game, C++ automatic solver