Created
April 23, 2012 18:36
-
-
Save bamboo/2472945 to your computer and use it in GitHub Desktop.
Small experiment invited by http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System | |
// http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html | |
// estimated to take 5, done in 4 ;) | |
text = """ | |
Four score and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal… | |
""" | |
words = /\s+/.Split(text.Trim()) | |
currentLineLength = 0 | |
for word in words: | |
if currentLineLength > 0: | |
if currentLineLength + 1 + len(word) > 13: | |
currentLineLength = 0 | |
Console.WriteLine() | |
else: | |
Console.Write(" ") | |
currentLineLength += 1 | |
Console.Write(word) | |
currentLineLength += len(word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment