google / google/codeworld

Smarter coordinate plane

オープン
#944 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

discussion
主要言語
Haskell
スター
1.3k
フォーク
201
PR マージ指標
30日以内にマージされた PR はありません

説明

@alphalambda I'm creating this issue to capture thoughts about the coordinate plane.

Trying to sum up the current state of things: the built-in `coordinatePlane` picture extends from -10 to 10 in each direction. It is useful when it's added as-is with no transformations. However, attempting to scale it, translate it, etc. doesn't work so great, because (a) it's a fixed size, (b) the granularity of guidelines is fixed, and (c) the labels don't stay readable if you stretch them, especially non-uniformly. It would be great for a lot of educational purposes if one could instead get a coordinate plane of any dimension, and trust it to look right (the right bounds, readable labels, and a reasonable choice of guides).

The rest of this document is brainstorming how to make this work.

### Option 0

Do nothing. CodeWorld doesn't need to solve all problems, and sometimes the complexity cost of adding a solution outweighs the benefit.

### Option 1

Create a new function that draws a coordinate plane with specific parameters. Looks like this could be an internal size (range of values in x and y that can be represented on the plane), and maybe also external size (amount of screen space to draw it in).

### Option 2

Make the `coordinatePlane` picture "smart", so it reacts to being transformed. It would be somewhat unique among pictures, both in that it's infinite in size (of course, the implementation would be to just draw the visible part), and would actually adjust the picture when it's transformed, so that for instance if it's scaled down, the granularity of the guidelines would change, and the labels would be drawn at the correct place, but without other transformations.

I don't think there's anything wrong with an infinite picture. None of the built-in pictures are infinite, but one could imagine changing that in some future world. It makes semantic sense. (Some students already complain about having to choose some arbitrarily large size to make a background for their programs, and would like a `everywhere :: Picture` that's infinite and solid, so they could write `background = colored(everywhere, blue)`. I'm not proposing to add this, but it's not unreasonable.

The latter difference, though, definitely breaks the denotational semantics of the `Picture` type as `Point -> Color` (see #456) which I don't like if it's avoidable. Then again, `coordinatePlane` is kind of a debugging feature anyway, and debugging often breaks abstractions.

### Option 3

(just brainstorming here; I don't really like this one.)

Deprecate `coordinatePlane` as a picture entirely. Instead, add a debug control to draw a coordinatePlane that can be toggled at runtime. In conjunction with #938, students could get more flexibility in the abstract size of their canvas, and that may satisfy many of the use cases for coordinate planes. On the other hand, it's bad for students who might want to use a coordinate plane as *part* of a bigger animation or drawing. Here's an example of that: https://code.world/#PrjRYVwRnctivph7EKKInwg I could never have made that animation had `coordinatePlane` been a toggle button in the UI instead of part of the code.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

これはブレインストーミング用のissueであり、実装ファイルやテストは指定されていません。まず現在のcoordinatePlaneの動作を確認し、次に#456と#938にあるリンク先の議論を読み、提案されている選択肢を比較してください。issueではアプローチが選択されておらず、受け入れ基準も指定されていないため、完了の定義はありません。

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

評価

技術スタック
haskell
領域
computer-graphics
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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