Skip to main content

cege_gopher

A Karel-style grid robot for teaching introductory Python, themed as Goldy Gopher. Written for CEGE 3101 — Computer Applications I at the University of Minnesota.

Ported from the MATLAB robot used in earlier offerings of the course, which was itself a port of the KAIST CS101 HUBO exercise (otfried/cs101) — Karel the Robot, at the root of it.

Why this exists

The original libraries open a live window and animate each command as it runs. Google Colab cannot host one.

So this version records, then replays. Every command appends a frame to a buffer; nothing is drawn until show(), which renders the whole run as an inline animation:

write the whole program → run the cell → watch it play back

Students never drive the robot interactively; every program is pre-coded, which is also how the homework is graded.

Install

pip install cege-gopher

Or, from the course repository:

pip install "git+https://github.com/benchoi93/CEGE3101_Computer_Applications.git#subdirectory=packages/cege-gopher"

The 13 world files ship inside the package, so nothing needs uploading — load_world("harvest1.wld") just works.

Use

from cege_gopher import *

load_world("harvest1.wld")       # or: create_world(10, 10)
goldy = Gopher()
goldy.set_trace("maroon")

while goldy.front_is_clear():
    if goldy.on_carrot():
        goldy.pick_carrot()
    goldy.move()

show()                           # the animation renders here

list_worlds() returns the bundled world names.

API

Module create_world(avenues, streets), load_world(name), list_worlds(), show(fps=), show_final(), get_world()
Move move(), turn_left(), turn_right()
Carrots pick_carrot(), drop_carrot()
Sense front_is_clear(), left_is_clear(), right_is_clear(), facing_north(), on_carrot(), carries_carrots()
Display set_trace(color), get_pos()

Robot is an alias for Gopher, and pick_beeper/pick_coin for pick_carrot, so code written against cs1robots or the MATLAB version still runs.

A bug fixed in this port

The MATLAB version had leftIsClear and rightIsClear swapped — facing east it checked south for "left", when turnLeft rotates counter-clockwise (E→N) so left of east is north. This port uses left = (-dy, dx), right = (dy, -dx).

License

MIT.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cege_gopher-0.3.1.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cege_gopher-0.3.1-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file cege_gopher-0.3.1.tar.gz.

File metadata

  • Download URL: cege_gopher-0.3.1.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cege_gopher-0.3.1.tar.gz
Algorithm Hash digest
SHA256 490ceccf8779d180d34b78f3e38160f09df9507d46275b5f4eb2a721657ef7f7
MD5 03b53e89c896291e90d02d5d27afc3b3
BLAKE2b-256 1881b89881d5c29c57ff9d27935fde2f19a768990efe1c82f0647e7cafdb3760

See more details on using hashes here.

File details

Details for the file cege_gopher-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: cege_gopher-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cege_gopher-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0b9f6622f63a7c5e9608f62c3523ca6b4c097b2d2aca8193eb29edff057fc84
MD5 620f24cab2caf9cd955c5336eacf946c
BLAKE2b-256 daa46494a7f0627e1ee36e35c7cc865783dc5ee32277fdfcf57af4050d0b2b98

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.3

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page