neolateral

programming, drawing, photograpy etc.

Articles tagged with gcd

A GCD Game!

Recently I've again started reading Dijkstra's book "A Discipline Of Programming". In the very first chapter "Chapter 0 on executional abstraction", he mentions a board game which when played correctly produces the GCD of two numbers. It is just an implementation of Euclid's Algorithm. I wanted to write a program to play this game.

I'd also discovered a library to produce svg animations called vivus, which I wanted to try.

So here's my implementation of the GCD game in html/javascript - GCD Board Game. Note that the numbers are provided using URL params to the html (x, and y are …