Coding Practices – The Modulus Operator..
August 11, 2008
During my travels of programming video games for a living, I take great pleasure in the fulfillment of learning, exploring & experimenting with algorithms & the intricacies of programming languages everyday. Being a gamplay programmer I tend to find that I make regular use of the modulus operator & it seems to be one of those little tools that most people seem to overlook but can be really useful for a variety of problems. So I thought it might be a good idea to write a little article about my experiences with lil’ old ‘%’ & hopefully it maybe able to encourage others share good practical uses for it too & hopefully teach me a thing or two.
Before we begin I’d just like to make a note that I’m going to be using C# for all my examples considering this blog are generally c#/XNA-centric (however i’m pretty sure the same functions for the modulus operator can be applied in C/C++ & most other languages)..