{"id":15653169,"url":"https://github.com/tyleryep/stanfordkarel","last_synced_at":"2025-04-14T15:40:45.895Z","repository":{"id":37936859,"uuid":"255498694","full_name":"TylerYep/stanfordkarel","owner":"TylerYep","description":"Python Implementation of Karel for CS106A at Stanford","archived":false,"fork":false,"pushed_at":"2025-04-09T01:51:51.000Z","size":1782,"stargazers_count":38,"open_issues_count":4,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T02:35:57.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TylerYep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-14T03:15:12.000Z","updated_at":"2025-04-09T01:51:53.000Z","dependencies_parsed_at":"2023-12-26T01:27:44.933Z","dependency_job_id":"893e0fe8-cf40-4714-9c3d-eb5422cd460f","html_url":"https://github.com/TylerYep/stanfordkarel","commit_stats":{"total_commits":253,"total_committers":10,"mean_commits":25.3,"dds":0.6363636363636364,"last_synced_commit":"c00153a94823ca7e924e1943d9863665825918ad"},"previous_names":["tyleryep/stanford-karel"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerYep%2Fstanfordkarel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerYep%2Fstanfordkarel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerYep%2Fstanfordkarel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerYep%2Fstanfordkarel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TylerYep","download_url":"https://codeload.github.com/TylerYep/stanfordkarel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248907842,"owners_count":21181410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:44:52.071Z","updated_at":"2025-04-14T15:40:45.872Z","avatar_url":"https://github.com/TylerYep.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stanford-karel\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![PyPI version](https://badge.fury.io/py/stanfordkarel.svg)](https://badge.fury.io/py/stanfordkarel)\n[![Build Status](https://github.com/TylerYep/stanfordkarel/actions/workflows/test.yml/badge.svg)](https://github.com/TylerYep/stanfordkarel/actions/workflows/test.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/TylerYep/stanfordkarel/main.svg)](https://results.pre-commit.ci/latest/github/TylerYep/stanfordkarel/main)\n[![GitHub license](https://img.shields.io/github/license/TylerYep/stanfordkarel)](https://github.com/TylerYep/stanfordkarel/blob/main/LICENSE)\n[![Downloads](https://pepy.tech/badge/stanfordkarel)](https://pepy.tech/project/stanfordkarel)\n\nThis is a Python implementation of Karel for Stanford's CS 106A. This package is available on PyPI and allows you to run Karel programs without any additional setup!\n\nHuge props to @nick-bowman for rewriting this project from scratch!\n\n**StanfordKarel now supports:**\n\n- Pip-installable package means you can run Karel programs from anywhere!\n- Solution code no longer needed to grade assignments - instead, the output worlds are compared.\n- Karel in ASCII! Plus autograder support.\n- Improved autograding, testing, linting, and auto-formatting.\n- Exception trace makes suggestions if you misspell a command (e.g. `turnLeft()` -\u003e `turn_left()`).\n\n# Usage\n\n`pip install stanfordkarel`\n\n# Documentation\n\nFollow the Karel tutorial on the\n[Karel Reader!](https://compedu.stanford.edu/karel-reader/docs/python/en/intro.html)\n\n## Running Karel\n\nFirst, ensure that StanfordKarel is correctly installed using pip.\nAny `.py` file can become a Karel program!\n\n**collect_newspaper_karel.py**\n\n```python\nfrom stanfordkarel import *\n\n\ndef main():\n    \"\"\"Karel code goes here!\"\"\"\n    turn_left()\n    move()\n    turn_left()\n\n\nif __name__ == \"__main__\":\n    run_karel_program()\n```\n\nSave the file and run:\n\n```\npython collect_newspaper_karel.py\n```\n\n![Karel Program](images/karel_program.png)\n\n## Available Commands\n\n| Karel Commands       |                        |                          |\n| -------------------- | ---------------------- | ------------------------ |\n| `move()`             | `right_is_clear()`     | `facing_east()`          |\n| `turn_left()`        | `right_is_blocked()`   | `not_facing_east()`      |\n| `put_beeper()`       | `beepers_present()`    | `facing_west()`          |\n| `pick_beeper()`      | `no_beepers_present()` | `not_facing_west()`      |\n| `front_is_clear()`   | `beepers_in_bag()`     | `facing_south()`         |\n| `front_is_blocked()` | `no_beepers_in_bag()`  | `not_facing_south()`     |\n| `left_is_clear()`    | `facing_north()`       | `paint_corner(color)`    |\n| `left_is_blocked()`  | `not_facing_north()`   | `corner_color_is(color)` |\n\n## Available Colors\n\n- Red\n- Black\n- Cyan\n- Dark Gray\n- Gray\n- Green\n- Light gray\n- Magenta\n- Orange\n- Pink\n- White\n- Blue\n- Yellow\n\n### Folder structure\n\nYou can set a default world by passing a world name to run_karel_program,\ne.g. `run_karel_program(\"collect_newspaper_karel\")`\n\nWorlds should be saved/loaded in a `worlds/` folder in the same folder as the file being run.\n\n- `assignment1/`\n  - `worlds/` (additional worlds go here)\n    - `collect_newspaper_karel.w`\n    - `collect_newspaper_karel_end.w`\n  - `collect_newspaper_karel.py`\n\n## Creating Worlds\n\nIf using the pip-installed version, create a Python file containing:\n\n```python\nfrom stanfordkarel.world_editor import run_world_editor\n\nif __name__ == \"__main__\":\n    run_world_editor()\n```\n\nThen run `python world_editor.py`.\n\n![World Editor](images/world_editor.png)\n\n## Grading\n\n`./autograde` runs the available tests using pytest in the `tests/` folder and prints out any output differences in the world.\n\n### Functionality\n\nThe tests use the student's code and the expected world output to determine correctness. If the output is not the same, the test driver will print out an ASCII representation of the differences.\n\n![Autograder](images/autograder.png)\n\n### Style\n\nThe autograde command also runs the builtin Karel Style Checker that performs linting automatically.\n\n## Development\n\nEverything important is located in `stanfordkarel/`.\n\n- `stanfordkarel/` is the exported package, which contains all of the available functions and commands for students to use.\n- `karel_application.py` is responsible for loading student code and displaying it to the screen.\n\n# Contributing\n\nAll issues and pull requests are much appreciated!\n\n- First, run `pip install pre-commit` and `pre-commit install`.\n- To see test coverage scripts and other auto-formatting tools, use `pre-commit run`.\n- To run all tests, run `pytest`.\n\n## Future Milestones\n\nIn the future, I hope to add:\n\n- Automatic student style checking\n- Ways of determining the student's strategy or approach from observing Karel movements\n- Autograde more worlds, broken down by assignment\n- Allow students to autograde their own work\n- Accessibility for visually-impaired students\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyleryep%2Fstanfordkarel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyleryep%2Fstanfordkarel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyleryep%2Fstanfordkarel/lists"}