Mark
  • Member for 7 years, 10 months
  • Last seen this week
Shortest infinite loop producing no output
33 votes

C, 15 bytes main(){main();} Yes, it's possible to call main() recursively. If you've got a compiler that does tail-call optimization (say, gcc with the -O2 option), it doesn't even segfault: the ...

View answer
Make an error quine!
29 votes

Commodore 64 Basic ?SYNTAX ERROR When run on the emulator of your choice (or an actual Commodore 64), produces ?SYNTAX ERROR This is, in fact, a syntactically-valid one-line program. The ...

View answer
Shut down the computer!
12 votes

AppleScript, 30 bytes tell app "Finder" to shut down Does exactly what it says: tells Finder to shut the computer off.

View answer
Programming Languages Through The Years
12 votes

1975 - Microsoft BASIC The original Microsoft BASIC interpreter was written by Bill Gates and Paul Allen for the Altair 8800, despite neither of them having access to one. It was a success, and was ...

View answer
Shortest code to produce non-deterministic output
11 votes

Commodore 64 Basic, 4 bytes 1S|0 PETSCII substitution: | = SHIFT+Y The zero page of a Commodore 64 is an area of 256 bytes of memory that can be accessed faster than the rest of RAM. Consequently, ...

View answer
Shortest Error Message
10 votes

Commodore 64 Basic, 15 bytes ?SYNTAX ERROR Produces ?SYNTAX ERROR (Note two spaces in the error message, where the program has three) ?SYNTAX ERROR is tied with ?VERIFY ERROR as the third-...

View answer
Find an Illegal String
9 votes

Commodore 64 Basic, 2 bytes B (that's a newline followed by the letter "B"). Any line in a Commodore 64 program must begin with either a line number or a BASIC keyword, and stored programs only ...

View answer
Write a program that makes 2 + 2 = 5
9 votes

Commodore 64 Basic 1 POKE 2070, 51 2 PRINT 2+2

View answer
Detect MS Windows
7 votes

QBasic, 31 bytes ?INSTR(ENVIRON$("COMSPEC"),"W") Prints non-zero under Windows, 0 under everything else. COMSPEC is an environment variable unique to Microsoft OSs. It points to the command ...

View answer
Golf you a quine for great good!
6 votes

Commodore Basic, 54 41 characters 1R─A$:?A$C|(34)A$:D♠"1R─A$:?A$C|(34)A$:D♠ Based on DLosc's QBasic quine, but modified to take advantage of Commodore Basic's shortcut forms. In particular, the ...

View answer
Shortest infinite loop producing no output
5 votes

Commodore Basic, 3 bytes 1R╭ PETSCII substitution: ╭ = SHIFT+U, ungolfs to 1 RUN. Taking advantage of Commodore Basic's shortcut forms and the fact that any immediate-mode command can also be used ...

View answer
Monte Carlo estimator of Pi
5 votes

Commodore 64 Basic, 45 bytes 1F┌I=1TO1E3:C=C-(R/(1)↑2+R/(1)↑2<1):N─:?C/250 PETSCII substitutions: ─ = SHIFT+E, / = SHIFT+N, ┌ = SHIFT+O Generates 1000 points in the first quadrant; for each, ...

View answer
Rosetta Stone Challenge: What's Average Anyways?
5 votes

Languages: 5 POV-Ray 3.7 Scene Description Language: 304 bytes #fopen I"i"read#declare S=0;#declare N=0;#declare Q=0;#declare P=1;#declare R=0;#while(defined(I))#read(I,V)#declare S=S+V;#...

View answer
Make your code error, but only sometimes!
4 votes

INTERCAL, 10 bytes DO%9GIVEUP The only way to terminate an INTERCAL program without an error is to execute a GIVE UP statement -- running off the end of the source code is a runtime error. This ...

View answer
The Letter A without A
4 votes

Commodore 64 BASIC, 6 bytes 2?"♠" There's a non-printing character after the first quotation mark, with byte value 14. How this works: The Commodore 64 has two character sets: "shifted mode" (which ...

View answer
Print out all IPv6 addresses
4 votes

Commodore BASIC 2.0, 339 bytes In order to get lower-case hex digits, this program is written in "shifted mode" (press <SHIFT>+<C=>) 1k=65535:a=0 2fOb=0tok:fOc=0tok:fOd=0tok:fOe=0tok:fOf=...

View answer
yes is 91 lines long
4 votes

Commodore 64 Basic: 14 13 bytes 1?C|(11↑2):R╭ As usual, I've made substitutions for characters in PETSCII that are not present in Unicode. | is used to represent SHIFT+H, while ╭ represents SHIFT+U....

View answer
Output programming language name
3 votes

COMMODORE 64 BASIC, 11 bytes 1sY830*78-2 To get around the case-sensitive "can't use the characters of the languages's name" restriction, put the computer in "shifted mode" so you ...

View answer
Program which behaves differently in/out of a debugger
3 votes

Robotalk, 22 bytes debug l: chronon l ifg If the debugger is active, the debug instruction pauses execution until the end of the current game tick. In this case, the variable "chronon" is always 1 ...

View answer
Remove all occurrences of the first letter of a string from the entire string
3 votes

TECO, 15 14 bytes Editing text? When in doubt, use the Text Editor and COrrecter! After much trial-and-error (mostly error), I think this is the shortest generic TECO program that will do the job. ...

View answer
1, 2, Fizz, 4, Buzz
3 votes

Commodore Basic, 87 bytes 1F┌I=1TO100:F=F+1:B=B+1:IFF=3T|?"FIZZ";:F=0 2IFB=5T|?"BUZZ";:B=0 3IFF>0A/B>0T|?I; 4?:N─ Or in "shifted mode" to get both lower- and upper-case letters, but with the ...

View answer
"Hello, World!"
3 votes

Commodore Basic, 16 bytes In order to input this program, you'll need to switch your Commodore 64 to character set 2 by pressing <SHIFT> + <C=>. 1?"hELLO wORLD! The Commodore home ...

View answer
I'm not the language you're looking for!
3 votes

Commodore 64 Basic/QBasic, 169 In order to get the capitalization right, you'll need to switch your Commodore 64 to character set 2 by pressing <SHIFT> + <C=>. 1 c$ = "QBasic": d$ = "...

View answer
Random Golf of the Day #2: Numbers from a Normal Distribution
3 votes

Commodore 64 Basic, 76 70 63 bytes 1INPUTS,N:S=R/(-S):F┌I=1TON:?S●(-2*LOG(R/(1)))*S╮(2*π*R/(1)):N─ Since the PETSCII character set contains some symbols not present in Unicode, I've made ...

View answer
Write a function
2 votes

Commodore 64 Basic, 13 bytes 1DEFFNI(X)=X The identity function. This, or any other function with a 1-byte body, is the shortest possible function in C64 Basic. (Oddly, the empty function is ...

View answer
Which Row is the Key On?
2 votes

Perl, 96 77 76 bytes Run using perl -p. Make sure you're feeding it just single characters; for example, to run it from a file key.pl (to avoid mucking around with shell escape sequences) echo -n q|...

View answer
What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?
2 votes

Commodore Basic, 1000000 1?1E6

View answer
Simple cat program
2 votes

TECO, 4 bytes <^T^T> ^T is CTRL+T. It should be self-explanatory how this works.

View answer
Shortest infinite loop producing no output
2 votes

RoboTalk, 5 bytes 0 rti RoboTalk has three "goto" instructions: jump, return, and rti. Jump and return are plain "go to the address on the top of the stack" instructions, while rti has the side ...

View answer
Death By Shock Probe: That's a lot of dice
2 votes

Commodore Basic, 37 bytes 1F┌I=1TO2↑20:C=C+INT(R/(1)*4+1):N─:?C PETSCII substitutions: ─ = SHIFT+E, / = SHIFT+N, ┌ = SHIFT+O Estimated runtime based on runs with lower dice counts: 4.25 hours. It'...

View answer