CodingTrain / CodingTrain/Logo

Berkeley Logo Conformity

未关闭
#74 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
47
派生
33
PR 合并指标
30 天内没有已合并 PR

描述

In the [Berkeley Logo User Manual](https://people.eecs.berkeley.edu/~bh/usermanual) the commands are implemented as full words and then aliased with shorter two-letter abbreviations and all commands are specified in screaming-case (all uppercase).

- We currently only implement the abbreviated commands.
- The abbreviation for `BACK` appears to be incorrect (currently `bd`).
- Uppercase commands are not currently accepted by the interpretor. (Should be case-insensitive?)
- It seems we should also be able to specify colors using the numbers 0-15 (see below).

Excerpt from the Berkeley Logo User Manual

GRAPHICS
-------------

Berkeley Logo provides traditional Logo turtle graphics with one turtle.
Multiple turtles, dynamic turtles, and collision detection are not supported.
This is the most hardware-dependent part of Logo; some features may exist
on some machines but not others. Nevertheless, the goal has been to make
Logo programs as portable as possible, rather than to take fullest advantage
of the capabilities of each machine. In particular, Logo attempts to scale
the screen so that turtle coordinates [-100 -100] and [100 100] fit on the
graphics window, and so that the aspect ratio is 1:1.

The center of the graphics window (which may or may not be the entire
screen, depending on the machine used) is turtle location [0 0]. Positive
X is to the right; positive Y is up. Headings (angles) are measured in
degrees clockwise from the positive Y axis. (This differs from the common
mathematical convention of measuring angles counterclockwise from the
positive X axis.) The turtle is represented as an isoceles triangle; the
actual turtle position is at the midpoint of the base (the short side).
However, the turtle is drawn one step behind its actual position, so that
the display of the base of the turtle's triangle does not obscure a line
drawn perpendicular to it (as would happen after drawing a square).

Colors are, of course, hardware-dependent. However, Logo provides partial
hardware independence by interpreting color numbers 0 through 7 uniformly
on all computers:

0 black 1 blue 2 green 3 cyan
4 red 5 magenta 6 yellow 7 white

Where possible, Logo provides additional user-settable colors; how many
are available depends on the hardware and operating system environment.
If at least 16 colors are available, Logo tries to provide uniform
initial settings for the colors 8-15:

8 brown 9 tan 10 forest 11 aqua
12 salmon 13 purple 14 orange 15 grey

Logo begins with a black background and white pen.

TURTLE MOTION
-------------

FORWARD dist
FD dist

moves the turtle forward, in the direction that it's facing, by
the specified distance (measured in turtle steps).

BACK dist
BK dist

moves the turtle backward, i.e., exactly opposite to the direction
that it's facing, by the specified distance. (The heading of the
turtle does not change.)

LEFT degrees
LT degrees

turns the turtle counterclockwise by the specified angle, measured
in degrees (1/360 of a circle).

RIGHT degrees
RT degrees

turns the turtle clockwise by the specified angle, measured in
degrees (1/360 of a circle).

SETPOS pos

moves the turtle to an absolute position in the graphics window. The
input is a list of two numbers, the X and Y coordinates.

SETXY xcor ycor

moves the turtle to an absolute position in the graphics window. The
two inputs are numbers, the X and Y coordinates.

SETX xcor

moves the turtle horizontally from its old position to a new
absolute horizontal coordinate. The input is the new X
coordinate.

SETY ycor

moves the turtle vertically from its old position to a new
absolute vertical coordinate. The input is the new Y
coordinate.

SETHEADING degrees
SETH degrees

turns the turtle to a new absolute heading. The input is
a number, the heading in degrees clockwise from the positive
Y axis.

HOME

moves the turtle to the center of the screen. Equivalent to
SETPOS [0 0] SETHEADING 0.

ARC angle radius

draws an arc of a circle, with the turtle at the center, with the
specified radius, starting at the turtle's heading and extending
clockwise through the specified angle. The turtle does not move.

贡献指南

打开贡献指南

调研方向

未指定文件或测试。首先定位 JavaScript 解释器中的命令注册、缩写处理、大小写处理和颜色解析入口;将它们与 Berkeley Logo 片段进行比较。完成的标准是:支持完整的命令名称、文档中记录的缩写(包括 BK)、大写命令以及颜色编号 0–15,并通过测试或等效验证。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。