CodingTrain / CodingTrain/Logo

Berkeley Logo Conformity

オープン
#74 コメント 2 件 リアクション 0 件 担当者 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

No files or tests are named. Start by locating the JavaScript interpreter's command registration, abbreviation handling, case handling, and color parsing entry points; compare them with the Berkeley Logo excerpt. Done means full command names, documented abbreviations including BK, uppercase commands, and color numbers 0–15 are supported with tests or equivalent verification.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
frontend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。