12
votes
0answers
51 views

Splitting up ASCII

Given the 95 printable characters in ASCII plus newline, break it apart into two equal, 48 character groups (hereafter called group A and group B). Create a one-to-one mapping of your choice (you have ...
18
votes
6answers
377 views

Cardinals and ordinals, 1 to 100

Here's a simple one to stretch your compression muscles. Your code (a complete program) must output the spelled-out English representation of all the cardinal numbers from 1 to 100, and then all the ...
13
votes
0answers
137 views

Solve a traffic intersection

The task Write a program or function that takes a traffic intersection structure and outputs the sequence, in which vehicles will pass. The output should contain at most four lines with the ...
-9
votes
0answers
27 views

iam using net beans glassfish server wat to do this error [on hold]

i'am using net beans Glass fish server what to do this error glass Fish Server 4.1, deploy, null, false BUILD FAILED (total time: 1 second)
23
votes
2answers
189 views

Argyle ASCII Art

Write a program (or function) that takes in a positive integer. If the input is 1, print (or return) two diamonds neighboring side-by-side, each with a side length of 1 slash: /\/\ \/\/ For every ...
14
votes
12answers
839 views

Lookalike shapes

Similar figures Two rectangles are similar if the ratios of their sides are the same. Consider these two rectangles; a rectangle 5 lines tall and 11 chars wide: =========== =========== =========== ...
4
votes
3answers
159 views

Role-Playing Game Dice-Rolling

Background When playing an RPG such as Dungeons & Dragons, Pathfinder, or Paranoia, players each need a set of dice. You are hosting one such game this weekend, and some of the friends you ...
17
votes
16answers
905 views

Lookup without conditional statements

This challenge was inspired by programming an Arduino microcontroller. I have 6 LEDs and 6 buttons connected to various pins on the board. In the code, each button and LED is assigned an ID number ...
13
votes
3answers
163 views

Calculate A(N) / B(N) with C(N) digits

Consider three number sequences, A, B and C: A: A Fibonacci sequence, f(n) = f(n-1)+f(n-2), starting with f(1) = 3, f(2) = 4. So, the sequence begins like this: 3 4 7 11 18 29 47 76 ... B: The ...
16
votes
0answers
240 views

My god, it's full of spaces!

Some people insist on using spaces for tabulation and indentation. For tabulation, that's indisputably wrong. By definition, tabulators must be used for tabulation. Even for indentation, tabulators ...
-2
votes
0answers
41 views

how to clear the space form and element ! [on hold]

when i change the height attribute of canvas tag in http://www.anthonyterrien.com/knob/ , for example in this section : data-width="100" data-displayInput=false when i through the inspect element ...
65
votes
40answers
5k views

I'm not the language you're looking for!

Isn't it annoying when you find a piece of code and you don't know what language it was written in? This challenge attempts to somewhat solve this. Challenge You will have to write a program that ...
5
votes
0answers
86 views

The Swift Make-It-Compile Challenge #4

This is a challenge for the people using Swift 2.0 beta 6, it's not code golf, but it's a programming puzzle so I'm pretty sure this belongs here. The basic idea is: Make it compile. There are more ...
3
votes
3answers
153 views

Output optimal trill fingerings

Note: all array references in this post are zero-indexed. When playing the piano, two notes on the same key must be pressed with two different fingers. You could use the same finger, but it doesn't ...
13
votes
5answers
220 views

Text Processing #1: Hyphenation

Background This is the first part of a 3-hole golf course on text processing. The over-arching idea is that if you take an input text and pipe it through the solutions to all three challenges (with a ...
0
votes
0answers
42 views

UDP client server programming related question [on hold]

Write an algorithm each for UDP client and UDP server with the following specifications:  Client should prompt a user to enter two numbers  Client program will send these numbers to the server.  ...
8
votes
7answers
2k views

Have you mooed today?

The Debian Linux distribution (and Debian-based distros, like Ubuntu, Kali and others) uses a package-manager called APT. To install program foo you would type into a terminal sudo apt-get install ...
4
votes
2answers
382 views

What is the shortest infinite loop statement?

I'm working on a golf for Java and I need an infinite loop. Obviously, I don't want to spend any more bytes than I have to, especially in such an expressive language. Assuming I have some code I want ...
10
votes
36answers
1k views

Find the occurrences of a character in an input string

Challenge Write a program that, given a string x which is 10 characters long and a character y, outputs the number of times character y occurs in string x. The shortest program in bytes to do so ...
31
votes
11answers
3k views

Print This Question ↓

The basic idea of a kolmogorov-complexity challenge is to print a set output in the shortest code (though that meaning has changed now). We have had many of them, from Borromean Rings to The ...
3
votes
0answers
175 views

The spoak laugh generator [on hold]

The spoak laugh For those who don't know, in Brazil some people laugh on chats like this: aposkpaoskaposkaposkpaokspaoskpaoksa. So here is the challenge: To make a program that generate this laugh ...
8
votes
1answer
207 views

Plot a hyperbolic plane tessellation

Make a plot (Poincare disk) of a tessellation on a hyperbolic plane, such as: The program takes four inputs: 1) How many edges/polygon (three in this example). 2) How many intersect at each ...
12
votes
3answers
379 views

How bold is this post?

Preamble In Stack Exchange markdown, we use ** to bold out text. For example, this markdown: The **quick brown fox jumps over the lazy** dog. Renders as: The quick brown fox jumps over the ...
39
votes
9answers
4k views

It's super effective!

In Pokémon there are 18 types: Normal Fighting Flying Poison Ground Rock Bug Ghost Steel Fire Water Grass Electric Psychic Ice Dragon Dark Fairy A Pokémon can ...
11
votes
1answer
197 views

Count the trees

A tree is a connected, undirected graph with no cycles. Your task is to count how many distinct trees there are with a given number of vertices. Two trees are considered distinct if they are not ...
14
votes
1answer
278 views
+150

Recursive ASCII Spirals

In the great tradition of ASCII Art Challenges on this site, here's another one. Given an input, draw a spiral. &>----v ||>--v| |||>v|| |||@||| ||^-<|| |^---<| ^-----< Simple, ...
7
votes
2answers
163 views

Output ISO8601 date

The Task Given the positive value of unix timestamp output any of two valid ISO 8601 time formats: YYYY-MM-DDTHH:mm:SS or, alternatively, YYYY-MM-DD HH:mm:SS You may ignore any leap seconds, if ...
6
votes
0answers
78 views

GOLF CPU - Implement Arbitrary Precision Integer Division

This question was inspired this question and @orlp's comment and a lot of the explanation was copied from there. Write a GOLF assembly program that given two arbitrary size decimal integers a, and b ...
15
votes
4answers
580 views

What's the voltage over each component?

The picture below shows a RLC circuit. A RLC circuit is an electrical circuit consisting of a resistor (R), an inductor (L), and a capacitor (C), connected in series or in parallel. (1) In order to ...
16
votes
16answers
1k views

A calculator as a list of numbers and operators

Your task is to take a list of arguments that are either integers or operators, and parse them like so: There is a current operator, which starts as +. Each time an operator is found, the current ...
29
votes
12answers
4k views

Visually Explain the Pythagorean Theorem

A common visual explanation of the Pythagorean theorem is as such: The squares are meant to represent the side length's squared, and the areas of a + b = c, just like the Pythagorean theorem says. ...
1
vote
0answers
186 views

Back to the future: Post-quantum cryptography [on hold]

If you know your programming history, you may know that one of the earliest code golf challenges was to implement RSA encryption. Now, I'm challenging you to code golf an encryption system that is ...
-3
votes
0answers
98 views

Sing the Australian National Anthem - joyfully! [on hold]

We Australians have a pretty awful national anthem. Here it is in all its glory: To the tune of Advance Australia Fair Australians all let us rejoice, For we are young and free; We've golden ...
10
votes
1answer
282 views
+50

An optimization version of the Hadamard problem

First, some definitions. A Hadamard matrix is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. The Hadamard conjecture proposes that a Hadamard matrix of ...
19
votes
44answers
3k views

Comparing two numbers

Challenge Given two integers A and B as input, you must write a program which outputs if A>B, A==B or A<B. The integers will be in any reasonable range supported by your language which ...
11
votes
3answers
285 views

Possible Tetris sequences

Write code to figure out whether a run of Tetris pieces could be generated by the official Tetris algorithm. Fewest bytes wins. Official Tetris games generate the sequence of falling pieces in a ...
27
votes
6answers
3k views

Is the pizza fair?

This question is inspired by, and is the inverse of this one. Dennis (E), Doorknob (D), Martin (M) and Chris (C) have ordered a pizza. The rectangular pizza is divided into square pieces, each marked ...
19
votes
10answers
2k views

Dead code elimination

Dead code sits there doing nothing, staring at us knowing it will never be executed... but today we can take revenge. Specification The input will be a multiline string. Each line may either be an ...
3
votes
2answers
157 views

Interpreted Interpreter [duplicate]

Duplicate? I knew somebody must've done this before. Programming a programming language in itself is something that has interested me since I knew what a programming language was. So I thought I'd ...
1
vote
0answers
66 views

Corrupted linked list [closed]

Suppose you are given a pointer to the head of a singly linked list. Normally each node in the list has a pointer to the next element, and the last node's pointer is Null. Unfortunately the list might ...
38
votes
9answers
950 views

Zigzagify a String

Write a program (or function) that takes in a non-empty string of any printable ASCII characters. Print (or return) a zigzagging chain of the characters in the string with every neighboring pair of ...
0
votes
0answers
61 views

very simple prime program [closed]

I keep getting the error floating point exception (core dumped). For this simple prime test I made. I am very new to C++ so I'm having trouble tracking down the bug. #include <iostream> using ...
36
votes
7answers
1k views

Dennis, Doorknob, Martin Büttner, Chris Jester-Young - Pizzeria!

Programming Puzzles & Code Golf is about to get a new moderator, Dennis! This challenge is a tribute to him and our other active (or recently active) moderators: Doorknob, Martin Büttner, and ...
96
votes
218answers
13k views
+100

“Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
25
votes
9answers
1k views

Fond Memories of Past Primes

Consider a prime number p, written in base 10. The memory of p is defined as the number of distinct primes strictly less than p that are contained as substrings of p. Challenge Given a non-negative ...
18
votes
1answer
316 views

Who is the rightful ruler?

Who will rule the realm? You are given a family tree which contains: name, sex, date of birth, date of death and a list of heirs, for each family member. You may use any convenient (nested) list ...
18
votes
4answers
1k views

Golfing strings in Fourier

Challenge Given a string as input, golf down the Fourier program which outputs that string. In Fourier there is no easy way to output a string: you have to go through each character code and output ...
18
votes
1answer
231 views

Convert Brainfuck to MarioLANG

MarioLANG is a two-dimensional programming language where the source code resembles a Super Mario Bros. level. Furthermore, its instruction set is very similar to Brainfuck's. This means that ...
33
votes
4answers
2k views

Enumerate valid Brainf**k programs

Golunar/Unary is a way to encode all valid Brainfuck programs, but it is not an enumeration, since most natural numbers do not correspond to a valid program. For the purpose of this challenge, assume ...
10
votes
4answers
232 views

A backwards relationship

Write a program or function that, given two ASCII strings A and B, will produce strings A' and B' where the common substrings are reversed in their place. The process for finding A' is as follows: ...

15 30 50 per page