Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackhowa/turtle-turtle
This is a TDD drawer program in Ruby
https://github.com/jackhowa/turtle-turtle
hackathon tdd
Last synced: 12 days ago
JSON representation
This is a TDD drawer program in Ruby
- Host: GitHub
- URL: https://github.com/jackhowa/turtle-turtle
- Owner: JackHowa
- Created: 2017-08-10T01:10:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-10T20:08:05.000Z (over 7 years ago)
- Last Synced: 2024-11-20T21:58:11.784Z (2 months ago)
- Topics: hackathon, tdd
- Language: Ruby
- Homepage: https://www.meetup.com/ChicagoRuby/events/241147344/
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# turtle-turtle
OBJECTIVE:
Turtle Tracks is a program that draws ASCII art. The name comes from the imagined movement of a turtle that can only move forward or backward, but it can turn at different angles to change direction.
Your program will take an input file of movement instructions, parse the file, and output another text file with the drawn object.
INPUT:
The input for the program will be a text files that contains a series of commands. This is the contents of the text file that we will be working with this evening:
____________________________________________________
41
RT 90
FD 10
RT 45
FD 5
REPEAT 2 [ RT 90 FD 15 ]
RT 90
FD 5
RT 45
FD 9
______________________________________________________
READING THE COMMANDS:
The first number in the file is the size of the board. Because we are dealing with a square board, this means that it will be a 41 x 41 board.
The commands are as follows:
FD n - Move the turtle forward, n spaces
BK n - Move the turtle back, n spaces
RT n - Rotate the turtle right, n degrees
LT n - Rotate the turtle left, n degrees
REPEAT n [ commands ] - Sets a series of commands, per the above stated rules, and repeats them n times.
To keep things simple, the angular rotation will be limited to 45 degree increments.
OUTPUT:
The board is a grid. Each placeholder space on the grid will be marked with a period followed by a space.
Consider the turtle your cursor. It starts in the middle of the board, and that spot will be automatically marked, even before any moves are made. The turtle will start facing up, and with each FD or BK step, the period is replaced with a marker to show where the turtle traveled.
VARIATIONS:
Try making up your own patterns.
See if you can print the image as an animation in the terminal.