Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#BBC Basic, (削除) 120 (削除ここまで) 117 bytes

BBC Basic, (削除) 120 (削除ここまで) 117 bytes

#BBC Basic, (削除) 120 (削除ここまで) 117 bytes

BBC Basic, (削除) 120 (削除ここまで) 117 bytes

added 112 characters in body
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112
 INPUTw,h,R,G,B,r,g,b: :REM Input size and colours
 VDU22,4 :REM Change to MODE 4 (2 colours) as the default mode gives odd behaviour
 VDU19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb :REM Reprogram the colours to R,G,B and R^r,G^g,B^b
 VDU24,0;0;w;h;16 :REM Setup a graphics viewport of the right size, and "clear" it to change background colour
5 INPUTr,x,y :REM take input coordinates
 VDU25,4,x;h-y; :REM move to x,y (h-y required as BBC BASIC y axis increases upward, reverse of spec)
 VDU25,154,r;0; :REM draw circle in "logical inverse colour" of existing pixels (this implementation seems however to XOR with colour 1 instead)
 GOTO5 :REM repeat infinitely until user presses escape
 INPUTw,h,R,G,B,r,g,b: :REM Input size and colours
 VDU22,4 :REM Change to MODE 4 (2 colours) as the default mode gives odd behaviour
 VDU19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb :REM Reprogram the colours to R,G,B and R^r,G^g,B^b
 VDU24,0;0;w;h;16 :REM Setup a graphics viewport of the right size, and "clear" it to change background colour
5 INPUTr,x,y :REM take input coordinates
 VDU25,4,x;h-y; :REM move to x,y (h-y required as BBC BASIC y axis increases upward, reverse of spec)
 VDU25,154,r;0; :REM draw circle
 GOTO5 :REM repeat infinitely until user presses escape
 INPUTw,h,R,G,B,r,g,b: :REM Input size and colours
 VDU22,4 :REM Change to MODE 4 (2 colours) as the default mode gives odd behaviour
 VDU19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb :REM Reprogram the colours to R,G,B and R^r,G^g,B^b
 VDU24,0;0;w;h;16 :REM Setup a graphics viewport of the right size, and "clear" it to change background colour
5 INPUTr,x,y :REM take input coordinates
 VDU25,4,x;h-y; :REM move to x,y (h-y required as BBC BASIC y axis increases upward, reverse of spec)
 VDU25,154,r;0; :REM draw circle in "logical inverse colour" of existing pixels (this implementation seems however to XOR with colour 1 instead)
 GOTO5 :REM repeat infinitely until user presses escape
edited body
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112

#BBC Basic, 120(削除) 120 (削除ここまで) 117 bytes

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html

I.w,h,R,G,B,r,g,b:V.22,4,19,0,1619;16,r,g,b,19,1,16275;16,R EORr,G EORg,B EORb,24,0;0;w;h;16
5I.r,x,y:V.25,4,x;h-y;25,154,r;0;:G.5

BBC Basic has a range of colour modes allowing you to plot raster graphics according to basic logic operations: OR, AND, XOR etc.

It also supports pallete reprogramming, meaning that for example here a 2 colour image can have its colours reprogrammed to any of 4096 colours. The implementation used here has some (undocumented) differences from the original BBC implementation, in which the EOR operators would not be necessary.

Ungolfed

 INPUTw,h,R,G,B,r,g,b: :REM Input size and colours
 VDU22,4 :REM Change to MODE 4 (2 colours) as the default mode gives odd behaviour
 VDU19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb :REM Reprogram the colours to R,G,B and R^r,G^g,B^b
 VDU24,0;0;w;h;16 :REM Setup a graphics viewport of the right size, and "clear" it to change background colour
5 INPUTr,x,y :REM take input coordinates
 VDU25,4,x;h-y; :REM move to x,y (h-y required as BBC BASIC y axis increases upward, reverse of spec)
 VDU25,154,r;0; :REM draw circle
 GOTO5 :REM repeat infinitely until user presses escape

Typical output screen

Example image scaled up by a factor of 10 in units / factor of 5 in pixels (BBC basic uses 1 pixel = 2 units.)

enter image description here

#BBC Basic, 120 bytes

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html

I.w,h,R,G,B,r,g,b:V.22,4,19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb,24,0;0;w;h;16
5I.r,x,y:V.25,4,x;h-y;25,154,r;0;:G.5

BBC Basic has a range of colour modes allowing you to plot raster graphics according to basic logic operations: OR, AND, XOR etc.

It also supports pallete reprogramming, meaning that for example here a 2 colour image can have its colours reprogrammed to any of 4096 colours. The implementation used here has some (undocumented) differences from the original BBC implementation, in which the EOR operators would not be necessary.

Ungolfed

 INPUTw,h,R,G,B,r,g,b: :REM Input size and colours
 VDU22,4 :REM Change to MODE 4 (2 colours) as the default mode gives odd behaviour
 VDU19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb :REM Reprogram the colours to R,G,B and R^r,G^g,B^b
 VDU24,0;0;w;h;16 :REM Setup a graphics viewport of the right size, and "clear" it to change background colour
5 INPUTr,x,y :REM take input coordinates
 VDU25,4,x;h-y; :REM move to x,y (h-y required as BBC BASIC y axis increases upward, reverse of spec)
 VDU25,154,r;0; :REM draw circle
 GOTO5 :REM repeat infinitely until user presses escape

Typical output screen

Example image scaled up by a factor of 10 in units / factor of 5 in pixels (BBC basic uses 1 pixel = 2 units.)

enter image description here

#BBC Basic, (削除) 120 (削除ここまで) 117 bytes

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html

I.w,h,R,G,B,r,g,b:V.22,4,19;16,r,g,b,275;16,R EORr,G EORg,B EORb,24,0;0;w;h;16
5I.r,x,y:V.25,4,x;h-y;25,154,r;0;:G.5

BBC Basic has a range of colour modes allowing you to plot raster graphics according to basic logic operations: OR, AND, XOR etc.

It also supports pallete reprogramming, meaning that for example here a 2 colour image can have its colours reprogrammed to any of 4096 colours. The implementation used here has some (undocumented) differences from the original BBC implementation, in which the EOR operators would not be necessary.

Ungolfed

 INPUTw,h,R,G,B,r,g,b: :REM Input size and colours
 VDU22,4 :REM Change to MODE 4 (2 colours) as the default mode gives odd behaviour
 VDU19,0,16,r,g,b,19,1,16,R EORr,G EORg,B EORb :REM Reprogram the colours to R,G,B and R^r,G^g,B^b
 VDU24,0;0;w;h;16 :REM Setup a graphics viewport of the right size, and "clear" it to change background colour
5 INPUTr,x,y :REM take input coordinates
 VDU25,4,x;h-y; :REM move to x,y (h-y required as BBC BASIC y axis increases upward, reverse of spec)
 VDU25,154,r;0; :REM draw circle
 GOTO5 :REM repeat infinitely until user presses escape

Typical output screen

Example image scaled up by a factor of 10 in units / factor of 5 in pixels (BBC basic uses 1 pixel = 2 units.)

enter image description here

edited body
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112
Loading
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112
Loading

AltStyle によって変換されたページ (->オリジナル) /