-
-
Notifications
You must be signed in to change notification settings - Fork 360
Euclidian Algorithm Piet Implementation #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Euclidian Algorithm Piet Implementation #448
Conversation
This looks really cool. I'll try to learn it and do a review when I can and when it's completed. |
e1e5034
to
ffb37ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good so far. Three questions though:
- Is there a specific reason you started with a different color?
- How did you manage to limit the Color Blocks of the As in the sub euclid to onl 4? did you change the color slightly?
- Have you gone crazy? :D
|
ffb37ac
to
539cd58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aight. This is crazy enough and it works
Euclidian algorithm in Piet
I would argue that text books can be better understood if they contain pictures. Piet is an excellent programming language that achieves this goal.
This pull request aims to implement the Euclidian Algorithm in Piet.
To run Piet programs, I would advice npiet. The
-t
and-tps
parameters are especially useful because they show exactly what path the program is taking.Euclidian algorithm with the modulo operator
Actual version:

Enlarged version for better visibility:
This version is quite small because it takes only a few commands to do the euclidian algorithm with the modulo operator. Possibly the smallest implementation of the euclidian algorithm in Piet yet.
Euclidian algorithm with subtraction
Actual version:

Enlarged version for better visibility:
This version is a lot bigger than the previous one, because of a few reasons:
I added some extra colourful pixels to fill up the empty space I was left with.
Reviewing these pixels
The pixels are based on the implementation that can be found in euclidian_algorithm.piet. This can be manually verified with
npiet -t [program]
.