For everyone who doesn't understand the modulo division operator either

Hi there,

after a few hours of work I’ve come up with a whole new solution to ActionMaster.cs.
I’ve tried my own solution because I don’t understand this modulo division (I’ve even read about it but it won’t diffuse into my brain), so I’ve wanted to create a solution that doesn’t use this operator (mostly because it is easier for me).

My solution has more lines of code (mostly because of readable issues) but working on it and then watching the next chapters of the course, I’ve realised that I didn’t really have any of the bugs reported from the users (and yes I’ve tested them all and they passed right away).

So, feel free to try / test my solution and have a nice day. :slight_smile:

P.S.: Btw instead of using the word “frame”, I used the word “round” because it confused me everytime with the frame of the Frame Per Second…

Modulo division, aka the remainder function. It’s a tough thing to get used to especially since long division and fractions aren’t taught that well in US schools. Give it time to sink in. I have found that it pops up and is used more often (and often more efficient) than integer division in coding.

Kudos for coming up with a work around. More lines of code is a trade off and is a decision that should be weighed in each instance.

Hey thanks for the kudos.
Yea, I guessed that one needs this operator more often in more complex projects and for efficiency purposes.
Well I hope someday I’ll understand that thing too. :slight_smile:

I’m late to the party but I have to say I love your solution, it reads really well to me. Easy to see what lines of code are doing what, even without the comments being there. Its pretty close to what I was thinking about when I thought I would have to do all the coding myself. In the end I pretty much used the same code as Ben though, although I don’t think it reads very well at all.

Privacy & Terms