Word squares

wordsquare6The LibreLogo program draws checkered word squares in this example (see in SVG format: 6×6, 7×7, 4×4, 9×9).
The 6×6 and 7×7 word squares were found by Douglas McIlroy (see on his home page). He was the head of the research department at Bell Labs at the time of the birth of the Unix operating system, also a famous contributor of Unix (Unix pipes, manual, spell checking etc.), that is why the word “Unix” is in the third word square. Word square article of Wikipedia refers the last, 9×9 example as one of the largest known word square in English.
wordsquare7wordsquare4wordsquare9The LibreLogo program contains a general word square drawing procedure. Its arguments: a number (the font size in pt) and a string (the space separated words of the word square).

TO wordsquare size words
    PENUP FONTSIZE size
    wordlen = INT SQRT COUNT words 
    c = 0 ; letter counter
    FOR char IN words [
        IF (c // wordlen +  c % wordlen) % 2 [
            FILLCOLOR “WHITE” FONTCOLOR “BLACK”
        ] [
            FILLCOLOR “BLACK” FONTCOLOR “WHITE”
        ]
        IF char != “ ” [
            SQUARE size TEXT char
            RIGHT 90 FORWARD size LEFT 90
            c = c + 1
        ] [
            BACK size RIGHT 90
            BACK wordlen * size LEFT 90
        ]
    ]
END

wordsquare 5 “RACISM EVINCE PERSON ASCENT STUCCO TASTER”
wordsquare 10 “WASSAIL ANTENNA STRINGY SEIZURE ANNULAR INGRATE LAYERED”
wordsquare 20 “DUCK ANON TILE AXLE”
wordsquare 40 “ACHALASIA CRENIDENS HEXANDRIC ANABOLITE LINOLENIN ADDLEHEAD SERINETTE INITIATOR ASCENDERS”

2 hozzászólás a(z) “Word squares” bejegyzéshez

  1. Having “Racism” as the first thing you see for this Logo App is probably not the best idea …

Leave a Reply

Your email address will not be published. Required fields are marked *