Use "append" method to construct the various game paths instead of wasteful string concatenation. Additionally, use a temporary to extract and reuse a result of a few common subexpressions to further reduce the overhead.