International Game Technology PLC, formerly Gtech S.p.A. And Lottomatica S.p.A., is a multinational gaming company that produces slot machines and other gaming technology. I'd say you should encapsulate as much of your code as possible into functions and classes, limiting the global state when possible. This serves two purposes - the first is that it improves debugging (by limiting the odds that something unintentionally alters global state) and readability (by making it easier to understand what everything does).