HOME

TheInfoList



OR:

WSFN (Which Stands for Nothing) is an interpreted
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming l ...
for controlling
robot A robot is a machine—especially one programmable by a computer—capable of carrying out a complex series of actions automatically. A robot can be guided by an external control device, or the control may be embedded within. Robots may be ...
s created by
Li-Chen Wang Li-Chen Wang (born 1935) is an American computer engineer, best known for his ''Palo Alto Tiny BASIC'' for Intel 8080-based microcomputers. He was a member of the Homebrew Computer Club and made significant contributions to the software for early ...
. It was designed to be as small as possible, a "tiny" language, similar to Wang's earlier effort,
Palo Alto Tiny BASIC Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed in response to the open letter published by Bill Gates complaining about users pirating Altair BASIC, which ...
. WSFN was first published in '' Dr. Dobb's Journal'' in September 1977. The language consists primarily of single-letter commands to tell a robot to move in certain directions, while other commands perform tests or basic mathematical operations. These can be grouped into named macros to produce more complex programs. The original version also included code that simulated the robot as a cursor on the
VDM-1 The Processor Technology VDM-1, for Video Display Module, was the first video card for S-100 bus computers. Created in 1975, it allows an S-100 machine to produce its own display, and when paired with a keyboard and their 3P+S card, it eliminate ...
display, or graphically on a
Cromemco Dazzler The Cromemco Dazzler was a graphics card for S-100 bus computers introduced in a ''Popular Electronics'' cover story in 1976.Les Solomon"Solomon's Memory", in ''Digital Deli'', Workman Publications, 1984, It was the first color graphics card avail ...
display. This is similar to the
turtle graphics In computer graphics, turtle graphics are vector graphics using a relative cursor (the " turtle") upon a Cartesian plane (x and y axis). Turtle graphics is a key feature of the Logo programming language. Overview The turtle has three attri ...
added to the
Logo A logo (abbreviation of logotype; ) is a graphic mark, emblem, or symbol used to aid and promote public identification and recognition. It may be of an abstract or figurative design or include the text of the name it represents as in a wordm ...
programming language in 1969. Extended WSFN is an implementation created for the
Atari 8-bit family The Atari 8-bit family is a series of 8-bit home computers introduced by Atari, Inc. in 1979 as the Atari 400 and Atari 800. The series was successively upgraded to Atari 1200XL , Atari 600XL, Atari 800XL, Atari 65XE, Atari 130XE, Atari 800XE ...
of home computers written by Harry Stewart and published by the
Atari Program Exchange Atari Program Exchange (APX) was a division of Atari, Inc. that sold software via mail-order for the Atari 8-bit family of home computers. Quarterly APX catalogs were sent to all registered Atari 8-bit owners. APX encouraged any programmer, not j ...
APX listing at atariarchives.org
/ref> in 1981. In addition to supporting turtle graphics, it adds a number of commands to control the graphics and sound capabilities of that platform. It was offered as a "beginner's language with emphasis on
graphics Graphics () are visual images or designs on some surface, such as a wall, canvas, screen, paper, or stone, to inform, illustrate, or entertain. In contemporary usage, it includes a pictorial representation of data, as in design and manufacture, ...
".


Syntax

WSFN consists of a number of single-letter commands to control the movement of a
turtle Turtles are an order of reptiles known as Testudines, characterized by a special shell developed mainly from their ribs. Modern turtles are divided into two major groups, the Pleurodira (side necked turtles) and Cryptodira (hidden necked ...
or robot. Any of these commands can be repeated by prefixing it with a number. For instance, moves the turtle Forward one step, while moves 25 steps. and make the turtle turn one unit to the Right or Left, respectively, and it can also be reset to point orth. The step sizes and turn units are defined by the robot hardware, but are set to one pixel and 45 degrees in the turtle graphics versions. Missing in the robot versions, in the computer versions returns the turtle Home in the center of the screen and Clears any previous drawing. Thus, one can draw a square with the string: BCWHN25F2R25F2R25F2R25F These instructions set the drawing color to Black, Clears the screen (which fills with the current color), sets the color to White, Homes the turtle, resets the turtle to point North, then draws a series of four lines 25 steps long, rotating 90 degrees to the Right between each line. The result is a white square with its lower-left corner in the center of the screen. Lists of commands can be surrounded with parentheses to create macros. For instance, the same square can be drawn by placing the code to draw one side of the square inside the parentheses, and then calling it four times: BCWHN4(25F2R) Macros can be called within other macros. For instance, this code draws a series of eight squares, each offset by 45 degrees, rotating around the center of the screen: BCWHN8(4(25F2R)R) Macros can be assigned a name using the efine command (Extended WSFN used instead). This code defines a macro named "X" to clear the screen and reset the drawing, and another "Z" that draws a square. It then uses these to draw the same rotating square as the example above: DX(BCWHN) DZ4(25F2R) X8(ZR) WSFN has rudimentary math capabilities consisting of a single accumulator that can be incremented and decremented with and . The letter can be placed anywhere a number could appear. One can make the series of squares grow larger by incrementing the accumulator 5 times between each step: DX(BCWHN) 25A DZ4(AF2R) X8(Z5+AR) A side-effect of the syntax is that would set the accumulator to zero, because it performs the decrement instruction by the number in A. Likewise, doubles the value in the accumulator. Program control is equally rudimentary, consisting of a number of commands that handled IF/THEN/ELSE structures. The most basic form is the est command, which follows one of two paths if the accumulator was greater or equal to zero. For instance, this command causes the turtle to turn 90 degrees left if the accumulator is non-zero, or 45 to the right if it is zero: T(2L)R Variations on the branching construct include , which randomly jumps to the first or second branch 50% of the time, and ensor, which tests if the contact sensor on the robot has been triggered. Extended WSFN modified the to return the color in front of the turtle, allowing hit detection on previous drawing, and added the dge test, which jumps to the right side macro if the turtle hit the edge of the drawing area. The original WSFN lacks an equivalent of , and instead wraps the drawing area so the turtle re-appears on the opposite side of the screen. Extended WSFN supports this style of playfield wrapping as an option. Because it uses one-letter commands and recursive syntax, WSFN code is exceedingly cryptic. For example, this is a WSFN program to draw
Sierpiński curve Sierpiński curves are a recursively defined sequence of continuous closed plane fractal curves discovered by Wacław Sierpiński, which in the limit n \to \infty completely fill the unit square: thus their limit curve, also called the Sierpi ...
s: DIT(-I2FI5RG5RI2FI+)2R DG4F DY (HN63F2R61FRC4 (2FI)) Note that the definition of the macro "I" includes calls to I within it. This is a key aspect of the WSFN concept; the language is highly
recursive Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathemati ...
in nature, which makes programming self-similar patterns like
fractal In mathematics, a fractal is a geometric shape containing detailed structure at arbitrarily small scales, usually having a fractal dimension strictly exceeding the topological dimension. Many fractals appear similar at various scales, as il ...
s easy to accomplish in a few lines of code. A key concept of Extended WSFN is that the keyboard is always active, even while macros are running. This allows keyboard input to interrupt running programs. Using this technique, one can make macros for moving the turtle in certain ways, assign them to letters on the keyboard, and then perform these movements by pressing different keys in succession. This can be aided by adding the ait command in places to give the user time to respond as the drawing takes place.


Keywords

From the original ''Dr. Dobbs'' article. From the Extended WSFN manual.


References


Bibliography

* * {{cite book , url=https://data.atariwiki.org/DOC/APX_Extended_WSFN-OCR-Print.pdf , first=Harry , last=Stewart , title=Extended WSFN , publisher=APX , date=1982 Atari 8-bit family software Atari Program Exchange software Robot programming languages Programming languages created in 1977 1977 in robotics