Skip to main content
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
Results tagged with
Search options not deleted user 26997

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

8 votes
2 answers
796 views

Trap the mouse!

Write the shortest program possible that traps the mouse cursor inside an upward pointing equilateral triangle with a side length of 274 pixels and a centroid at the exact middle of the screen. (Trian …
Calvin's Hobbies's user avatar
2 votes

Implement a Truth-Machine

Shtriped, 33 bytes e : t : . d : i : p : . . p : This prints the 0 or the infinite stream of 1's without any trailing newlines or spaces. Explanation: e : \ initialize a variable named ":" t : …
Calvin's Hobbies's user avatar
2 votes

List the combinations of elements in a set

Python, 102 p=lambda s:p(s[1:])+[x+[s[0]]for x in p(s[1:])]if s else[s];c=lambda s,k:[x for x in p(s)if len(x)==k] Call c to run: c([5, 6, 7], 2) => [[6, 7], [5, 7], [5, 6]] It gets all the p …
Calvin's Hobbies's user avatar
6 votes
2 answers
604 views

Crosswalk Efficiency

A standard road intersection contains 4 sidewalk corners and four crosswalks connecting them. It could also have 2 diagonal walks. sRRRRs iOOOOi dAAAAd eDDDDe side0----1walk ROAD|\ / …
Calvin's Hobbies's user avatar
20 votes
7 answers
2k views

Minecraft Chest Placement

The video game Minecraft is all about placing and removing different types of blocks in the 3D integer lattice that makes up the virtual world. Each lattice point can contain exactly one block or be e …
Calvin's Hobbies's user avatar
16 votes
11 answers
2k views

Output the answer above yours

Write a program that outputs the contents of the first HTML <code>...</code> block of the answer to this question that is just above yours when the answers are sorted by votes. Output Top! if you are …
Calvin's Hobbies's user avatar
18 votes
8 answers
986 views

Relative vs Absolute

If someone facing north at point A in this grid wanted directions to follow the green path (as they can only follow gridlines) to point B you might tell them: Go North, North, West, East, East, Sou …
Calvin's Hobbies's user avatar
57 votes
4 answers
5k views

Nether Portal Detection

The video game Minecraft is all about placing and removing different types of blocks in the 3D integer lattice that makes up the virtual world. Each lattice point can contain exactly one block or be e …
Calvin's Hobbies's user avatar
34 votes
5 answers
2k views

Where does the laser go?

Take a 2-dimensional grid and draw a number of line segments on it to represent mirrors. Now pick a point to place a theoretical laser and an angle to define the direction it's pointing. The question …
Calvin's Hobbies's user avatar
8 votes
9 answers
637 views

Subdivide-Sum Sequence

Consider the digits of any integral base above one, listed in order. Subdivide them exactly in half repeatedly until every chunk of digits has odd length: Base Digits Subdivided Digit …
Calvin's Hobbies's user avatar
2 votes

Simplify a fraction

Python 2.7, 124 from fractions import gcd;x,y=map(int,raw_input().split('/'));g=gcd(x,y);print'%d/%d'%(x/g,y/g)if g!=1 else'Already reduced' Very simple solution, though I know it would be shorter in …
Calvin's Hobbies's user avatar
9 votes
1 answer
543 views

Graph Google Search Results

When you search for something on Google, it conveniently gives a message near the top of the page saying something like About 53,000,000 results (0.22 seconds). (The numbers change depending on what w …
Calvin's Hobbies's user avatar
11 votes

Interlocking Brackets

Python 2, 163 bytes def f(b,e='([{<)]}>',q=range(4)): b=[b[b.index(e[j])+1:b.index(e[j+4])]for j in q] print sum(sum(abs(b[k].count(e[j])-b[k].count(e[j+4]))for j in q)for k in q)/2 This looks at …
Calvin's Hobbies's user avatar
4 votes

Simple cat program

Shtriped, 20 bytes e ) " r ) s ) " " This cheekily demonstrates that nearly any printable ASCII string is a valid identifier in Shtriped. How it works: e ) \ declares a variable named ) " \ …
Calvin's Hobbies's user avatar
14 votes
2 answers
1k views

Introspective Programming: Code that analyzes its source and its output

Write a program that outputs the total number of characters and the frequency of each character in its source and its output. You must follow the format illustrated in the example. Example If your c …
Calvin's Hobbies's user avatar

1
2 3 4 5
16
15 30 50 per page