ArticleslgStudy

computer science

WSFN (programming language)

WSFN (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand WSFN (programming language) rather than just read about it. In short: WSFN (Which Stands for Nothing) is an interpreted programming language for controlling robots created by Li-Chen Wang. It was designed to be as small as possible, a "tiny" language, similar to Wang's earlier effort, Palo Alto Tiny BASIC.

Key takeaways

  • WSFN (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect WSFN (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of WSFN (programming language) from memory before moving on to harder problems.

Reference excerpt

WSFN (Which Stands for Nothing) is an interpreted programming language for controlling robots created by Li-Chen Wang. It was designed to be as small as possible, a "tiny" language, similar to Wang's earlier effort, Palo Alto Tiny BASIC. 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 display, or graphically on a Cromemco Dazzler display. This is similar to the turtle graphics added to the Logo programming language in 1969. Extended WSFN is an implementation created for the Atari 8-bit computers written by Harry Stewart and published by the Atari Program Exchange 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 an "educational graphics language for beginning programmers".

Syntax WSFN consists of a number of single-letter commands to control the movement of a turtle or robot. Any of these commands can be repeated by prefixing it with a number. For instance, F moves the turtle Forward one step, while 25F moves 25 steps. R and L make the turtle turn one unit to the Right or Left, respectively, and it can also be reset to point North. 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 H returns the turtle Home in the center of the screen and C 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 Define 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 A that can be incremented and decremented with + and -. The letter A 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 A- would set the accumulator to zero, because it performs the decrement instruction by the number in A. Likewise, A+ 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 Test 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 T branching construct include ?, which randomly jumps to the first or second branch 50% of the time, and Sensor, which tests if the contact sensor on the robot has been triggered. Extended WSFN modified the S to return the color in front of the turtle, allowing hit detection on previous drawing, and added the Edge 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 E, 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 curves:

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 in nature, which makes programming self-similar patterns like fractals 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 Wait 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.

See also List of robotics software

References

Bibliography Wang, Li-Chen (September 1977). "An Interactive Programming Language for Control of Robots". Dr. Dobb's Journal. Vol. 2, no. 8. pp. 334–345. Stewart, Harry (1982). Extended WSFN (PDF). APX.

Worked examples

Example 1 — a first encounter with WSFN (programming language)

Start with the simplest possible case. Write down what WSFN (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to WSFN (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about WSFN (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of WSFN (programming language)

In research
WSFN (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses WSFN (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
WSFN (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1977 in robotics, Atari 8-bit computer software, Atari Program Exchange software, so understanding it makes those chapters shorter.
In everyday life
Look for WSFN (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “WSFN (programming language)” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study WSFN (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what WSFN (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain WSFN (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is WSFN (programming language) in simple terms?

WSFN (Which Stands for Nothing) is an interpreted programming language for controlling robots created by Li-Chen Wang. It was designed to be as small as possible, a "tiny" language, similar to Wang's earlier effort, Palo Alto Tiny BASIC.

Why does WSFN (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study WSFN (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on WSFN (programming language).

Tags

  • 1977 in robotics
  • Atari 8-bit computer software
  • Atari Program Exchange software
  • Programming languages created in 1977
  • Robot programming languages

Keep exploring