この付録では、1ページにKarelプログラミング言語の構造を定義します。
move();
turnLeft();
putBeeper();
pickBeeper();
/* コメントはどの部分にも含めることができます
* の a プログラム. 彼ら 開始 と a スラッシュ-星
* and end with a star-slash.
*/public class 名 extends スーパーカレル {
public void run() {
実行するコード
}
プライベートメソッドの宣言
}
frontIsClear() beepersPresent() beepersInBag() leftIsClear() rightIsClear() facingNorth() facingSouth() facingEast() facingWest() frontIsBlocked()
noBeepersPresent() noBeepersInBag() leftIsBlocked() rightIsBlocked() notFacingNorth() notFacingSouth() notFacingEast() notFacingWest() if( 調子 ){
条件がrun場合はコードrun
}
if( 調子 ){
"yes"のコードブロック
} else {
"no"のコードブロック
}
for(int i = 0; i < カウント ; i++){
繰り返すコード
}
while( 調子 ){
繰り返すコード
}
private void 名 () {
メソッドの本体にコードを記述します。
}
turnRight();
turnAround();
random( p );
paintCorner( 色 );