The Roger Frank Lessons
Introduction to Computer Science: GvR Unit

Guido van Robot World Reference Guide

A Guido van Robot world file (with the .wld extension) defines the environment where Guido lives and moves. It specifies the layout of streets and avenues, boundary and interior walls, the placement of beepers, and Guido's starting position, orientation, and beeper-bag contents.

World Coordinate System

Guido's world is a two-dimensional grid of intersections called corners:

General Syntax Rules

Every line in a .wld file specifies a component of Guido's world.

The Robot Statement

The Robot statement positions Guido in the world, specifies the direction he is facing, and gives the initial number of beepers inside his beeper-bag.

Robot <avenue> <street> <direction> <beepers>

Parameters:

Rules:

Examples:

Robot 1 1 E 0    # Guido starts at 1st Ave & 1st St, facing East, with 0 beepers
Robot 4 3 N 0    # Guido starts at 4th Ave & 3rd St, facing North, with 0 beepers
Robot 1 5 E 4    # Guido starts at 1st Ave & 5th St, facing East, with 4 beepers
Robot 1 2 N -1   # Guido starts at 1st Ave & 2nd St, facing North, with unlimited beepers

The Wall Statement

The Wall statement places interior walls that block Guido's path. If Guido attempts to move into a wall, an error shut-off occurs and the program terminates.

Wall <avenue> <street> <direction> [<length>]

Parameters:

Wall Extension Rules:

Examples:

Wall 2 4 N       # 1-block horizontal wall north of corner (2, 4)
Wall 2 4 E       # 1-block vertical wall east of corner (2, 4)
Wall 4 4 N 2     # 2-block horizontal wall north of 4th Street, starting at 4th Ave and extending East
Wall 7 3 E 6     # 6-block vertical wall east of 7th Avenue, starting at 3rd Street and extending North

The Beepers Statement

The Beepers statement places one or more beepers at a specific corner in the world for Guido to pick up during execution.

Beepers <avenue> <street> <number_of_beepers>

Parameters:

Examples:

Beepers 4 4 1    # Places 1 beeper at the corner of 4th Avenue and 4th Street
Beepers 2 5 3    # Places 3 beepers at the corner of 2nd Avenue and 5th Street

World File Statements Summary


Statement Syntax Description
Robot Robot <ave> <st> <dir> <beepers> Sets Guido's starting corner, facing direction (N, S, E, W), and beepers in bag. (Required, exactly one)
Wall Wall <ave> <st> <dir> [<length>] Places a wall of length ≥ 1 (default 1) blocking movement in direction dir. Extends East (horizontal) or North (vertical).
Beepers Beepers <ave> <st> <count> Places count beepers on corner (ave, st).

Complete Example World File


Here is a complete example of a world definition file (maze.wld):
# ==========================================
# Guido van Robot Example World
# ==========================================

# Place Guido at 1st Avenue and 5th Street, facing East with 1 beeper
Robot 1 5 E 1

# Place beepers on corners
Beepers 3 5 1

# Define maze walls
Wall 2 4 N
Wall 2 4 E
Wall 3 4 E
Wall 4 4 N 2
Wall 2 5 N
Wall 2 6 E
Wall 3 6 E
Wall 4 5 N 2

Language Reference | Index | Lesson 1

Copyright © 2026 Stas Zytkiewicz, Jeffrey Elkner, Roger Frank.