Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
3
votes
Shortest code to produce infinite output
[BASIC] 10 9 bytes
1?:goto 1
Try it online!
Infinite carriage return/line feeds. (I saved a byte when I realized I could just output new lines without a 0 or other character!)
It's the first program …
0
votes
Write an interpreter for "interpreter"
YaBASIC, 130 bytes
dim c$(1)
n=split(i$,c$())
for j=1 to n
c=mod(len(c$(j)),6)
if c a=a*or(and(6,9/c),c<2)/2+xor(mod(3/2^(c-3),6),2)-2
if !c ?a;
next
A basic interpreter interpreter running in an int …
0
votes
Reverse and error!
[BASIC], 2 bytes
?a
Try it online!
a?
The reverse will just generate a Syntax Error
Basically (pun totally intended) if you can't make a 2-3 byte program in almost any language that'll crash if reve …
2
votes
Print A-Z and their alphabet index without using 1,2,4,6
BASIC, 41 bytes
for i=!0 to 33-7:?i,". ",chr$(8*8+i):next
Try it online!
2
votes
1, 2, miss a few, 99, 100
Yabasic, 46 bytes
?5-4,", ",5-3,", miss a few, ",33*3,", ",5*5*4
Try it online!
Replaced calculated numbers for 1 and 2 with \x hex codes for ASCII 49 and 50 and saved 3 bytes!
(Can't do the above be …
0
votes
Reverse source code and double the input
YaBASIC, 8 bytes
//$i,$i?
Try it online!
?i$,i$//
!enilno ti yrT
A basic BASIC answer - hide the reversed source behind a comment! Original does nothing, reversed prints input i$ twice. This dialect …
2
votes
Write a Deadfish Interpreter
Yabasic, 119 115 bytes
a=0
for j=1 to len(i$)
c=instr("isdo",mid$(i$,j,1))
if c<4 a=a+2-c
if c=2 a=a*a
if c=4 ?a;
if a<0 or a=256 a=0
next
Try it online!
The actual input is done via reading DATA sta …
1
vote
How even is a number?
BASIC, 36 bytes
while(!mod(a,2)):a=a/2:b=b+1:wend:?b
Try it online!
It's never going to win, but it's interesting to see how competitive good old fashioned BASIC can be in this sort of thing. I manag …
2
votes
Print 0 to 100 without 1-9 characters
BASIC, 32 27 bytes
for a=0 to asc("d"):?a:next
Try it online!
while(a<asc("e")):?a:a=a+!0:wend
Of course, a FOR loop is shorter than using WHILE. Thanks Lars for your example.
My earlier (apparen …
1
vote
"Hello, World!"
Deadfish~, 1 byte
w
Try it online!
Kind of cheating really... but then I think there are some zero byte answers!