Monday, 21 December 2015

Modular Arithmetic with Mr. Spock

An important aspect of programming is to consider a program’s requirements in terms of computational effort and memory usage: an algorithm that makes efficient use of resources can help make a program robust and scalable.

Deciding the winner in Rock Paper Scissors Lizard Spock could be done with a brute force walk through the rules to find a match, but we can design an efficient modular arithmetic solution instead. Mr. Spock would approve.

No comments:

Post a Comment