カテゴリ
全体プログラミング scheme verilog 未分類 以前の記事
2016年 04月2016年 03月 2016年 02月 2016年 01月 2015年 12月 2015年 11月 2015年 10月 2015年 09月 2015年 08月 2015年 07月 2015年 06月 2015年 03月 お気に入りブログ
PHPで競技プログラミングメモ帳
最新のトラックバック
ライフログ
検索
タグ
racket
その他のジャンル
ブログパーツ
最新の記事
外部リンク
ファン
記事ランキング
ブログジャンル
画像一覧
|
REALM OF RACKET p.89 Chapter ChallengesのEasyを解きました。 【問題】 Find an image of a locomitive. Create an animation that runs the locomotive from just past the left margin to just past the right margin of the screen. Next, modify your program so the locomotive wraps around to the left side of the screen after passing the right margin. (拙訳) 蒸気機関車の画像を探してください。次に、画面の左端から右端まで蒸気機関車が走るアニメーションを作ってください。また、右端まで来た時に左端に戻るよう修正してください。 ※この記事では、問題の前半だけ扱います。 【蒸気機関車の画像】 私が描いた絵です。 【ソースコード1】 画面の左端から右端まで蒸気機関車が走るアニメーション #lang racket (require 2htdp/universe 2htdp/image) (define LOCOMOTIVE ) (define WIDTH 800) (define HEIGHT 100) (define IMG-WIDTH (image-width LOCOMOTIVE)) (define IMG-HEIGHT (image-height LOCOMOTIVE)) (define T-MAX (- WIDTH IMG-WIDTH 1)) (big-bang -30 ; init {on-tick (lambda (t) (+ t 3))} {on-draw (lambda (t) (place-image/align LOCOMOTIVE (max 1 (min t T-MAX)) (/ HEIGHT 2) "left" "center" (empty-scene WIDTH HEIGHT)))} {stop-when (lambda (t) (>= t T-MAX))} ) 【スナップショット】
by tempurature
| 2015-12-10 22:42
| scheme
| ||||||||||||||||||||||
ファン申請 |
||