BBC BASIC
リビジョンB、234バイト
1つの白と1つの赤十字を描く代わりに、徐々に背景が狭くなる100個の十字を描き、60の座標で白の背景から赤の前景に切り替えます。
p=20761m=1049w=600h=300F.i=-1TO1V.29,w;h;18;4,m;134*i;0;m;w*i;-233;p;0;466;m;0;67*i;m;-466;h*i;p;932;0;18;1,m;511*i;h*i;25;89*i;0;29977;0;0;m;w*i;-h*i;28953;0;45*i;
N.F.c=-100TO0q=25881-c DIV60*512V.m;-c;-h;q;c;h;m;-w;-c;q;w;c;
N.
http://www.bbcbasic.co.uk/bbcwin/bbcwin.htmlから無料で通訳をダウンロード
完全にゴルフ、249バイト
1バイトのVDUコードは、たとえば25,0
2バイトのリトルエンディアンなどに結合され25;
、一般的な値の定数を最大限に使用します。短縮形に圧縮されたキーワード。例:FOR
=> F.
(インタプリタは自動的に展開されます。)
p=20761q=26393r=25881m=1049c=100w=600h=300F.i=-1TO1V.29,w;h;18;4,m;134*i;0;m;w*i;-233;p;0;466;m;0;67*i;m;-466;h*i;p;932;0;18;1,m;511*i;h*i;25;89*i;0;29977;0;0;m;w*i;-h*i;28953;0;45*i;
N.V.m;-c;-h;q;c;h;2m;-w;-c;q;w;c;m;-60;-h;r;60;h;m;-w;-60;r;w;60;
半ゴルフ
生のVDUコード。BBC BASICでは、文字をVDUコントローラーに送信できますVDU65
(Aを出力します)。グラフィック用のBBCに固有の特定の特殊文字があります。これらの後には、座標などを指定する他のいくつかのバイトが続く必要があります。ここでは、PLOT
=> VDU25
、GCOL
=> VDU18
、ORIGIN
=> を使用していますVDU29
。
c=100w=600h=300 :REM constants 100,width,height
FORi=-1TO1 :REM loop -1 and 1 (0 draws nothing)
VDU29,w;h; :REM set origin (bring inside loop for golfing reasons)
VDU18;4 :REM change to blue and draw triangles
VDU25,4,134*i;0;25,4,w*i;-233;25,81,0;466;25,4,0;67*i;25,4,-466;h*i;25,81,932;0;
VDU18;1 :REM change to red and draw parallelograms
VDU25,4,511*i;h*i;25,0,89*i;0;25,117,0;0;25,4,w*i;-h*i;25,113,0;45*i;
NEXT
VDU25,4,-c;-h;25,103,c;h;25,4,-w;-c;25,103,w;c; :REM draw white background rectangles
VDU25,4,-60;-h;25,101,60;h;25,4,-w;-60;25,101,w;60; :REM draw red foreground rectangles
まず、対角部分の半分を描画します。2つの青い三角形と2つの赤い平行四辺形です。次に、スケールを-1から+1に変更し、残りの半分を描画します。最後に、水平部分と垂直部分を上に描画します。2つの白い長方形が白い十字を形成し、次に2つの赤い長方形を描画します。ループの最初の反復後の画像と最終的な画像を以下に示します。

ゴルフではないコード
BBCベーシックは、グラフィックカーソルの最後の2つの位置を記憶しています。PLOT81は、指定された新しい座標とこれらの最後の2つの位置の間に三角形を描画します。PLOT113とPLOT117は、同様の方法で平行四辺形を描画します。平行四辺形の3つの角は、周囲に沿って見つかる順序で指定する必要があります。PLOTコードの最後の3ビットは、指定された座標が絶対座標か相対座標か、および前景色と背景色のどちらを使用するかを定義します。より重要なビットは、描画される形状のタイプ(点、線、三角形、平行四辺形、長方形など)を定義します。
ORIGIN600,300 :REM move the origin (which will be centre of flag) away from the corner of the screen.
FORi=-1TO1 :REM at scales of -1 and 1, plot half each of the diagonal parts (i=0 plots nothing).
GCOL0,4 :REM blue foreground colour
PLOT4,134*i,0 :REM absolute move to peak of upper/lower triangle
PLOT4,600*i,-233 :REM absolute move to left hand corner
PLOT81,0,466 :REM relative move to right hand corner, plotting triangle
PLOT4,0,67*i :REM absolute move to peak of left/right triangle
PLOT4,-466,300*i :REM absolute move to lower corner
PLOT81,932,0 :REM relative move to upper corner, plotting triangle
GCOL0,1 :REM red foreground colour
PLOT4,511*i,300*i :REM absolute move to long edge of flag
PLOT0,89*i,0 :REM relative move to corner of flag (top right / bottom left)
PLOT117,0,0 :REM absolute move to centre of flag, plotting parallelogram (stripe)
PLOT4,600*i,-300*i :REM absolute move to corner of flag (bottom right / top left)
PLOT113,0,45*i :REM relative move to short edge of flag, plotting parallelogram (stripe)
NEXT :REM diagonal parts completed, now plot vertical/horizontal parts on top.
PLOT4,-100,-300 :REM move to bottom left of vertical white stripe
PLOT103,100,300 :REM move to top right corner, plot it in background colour (white)
PLOT4,-600,-100 :REM move to bottom left corner of horizontal white stripe
PLOT103,600,100 :REM move to top right corner, plot it in background colour (white)
PLOT4,-60,-300 :REM move to bottom left of vertical red stripe
PLOT101,60,300 :REM move to top right corner, plot it in foreground colour (red)
PLOT4,-600,-60 :REM move to bottom left corner of horizontal red stripe
PLOT101,600,60 :REM move to top right corner, plot it in foreground colour (red)