A competition to solve a particular problem through the usage and manipulation of strings.
28
votes
27answers
5k views
Take a ride on the Reading, If you pass Go, collect $200
Monopoly Board
For this code-golf challenge we will be building the board game Monopoly.
Rules:
Take no input.
Output a 11x11 board where each ASCII character forming the board is the first letter ...
3
votes
0answers
130 views
Ungolf batch programs [on hold]
This question wants you to golf batch programms. In Batch you can use
set x=averylongbatchcommand
%x% arg1
which expands to
set x=averylongbatchcommand
averylongbatchcommand arg1
Your task is it ...
45
votes
59answers
5k views
N(e(s(t))) a string
To "function nest" a string, you must:
Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the ...
6
votes
2answers
244 views
String Calculator
Assume you're writing in one method, (or whatever you call them) with 3 inputs: the first string, a character that contains a +, - or * symbol, and the second string.
Example in Java:
public String ...
19
votes
23answers
1k views
Spaced-out numbers
Given a list of N non-negative integers, output those numbers with each left-padded by spaces to a length of N. (Alternatively, return a character/string list.) You may assume that N is greater than ...
0
votes
1answer
111 views
The brain is smarter than you think [duplicate]
As you may (or may not) know, the human brain is very good at filtering stuff out. Making things easier for us. Take the next sentence for example:
Tihs is a vrey esay seetcnne wtih smoe lnog wdros ...
32
votes
9answers
2k views
Find the Infinity Words!
(Note: This is a spin-off of my previous challenge Find the Swirling Words!)
Definition of Infinity Word:
If you connect with curves all the characters of an Infinity Word on the alphabet (A-Z) you ...
10
votes
42answers
2k views
Nest a string inside an array n times
You must produce a function which nests a string s inside an array, n times
>>> N("stackoverflow",2)
[['stackoverflow']]
Parameters:
s - An ascii string
n - An integer >= 0
Rules
...
17
votes
15answers
1k views
Letter-replacement challenge
The idea is simple. You've to create a "visualised" letter-replacement, by providing 3 strings (input can be comma separated, separate inputs, or as an array). The first segment is the word you want ...
18
votes
32answers
1k views
Export The $PATH Variable, Line-By-Line
Inspired by this question on AskUbuntu.
Your job is extremely simple. Take the PATH environment variable (echo $PATH) and export it such that each entry (separated by the : character) is on its own ...
20
votes
25answers
1k views
Exploded Suffixes
Given an ASCII string, output the exploded suffixes of it. For example, if the string was abcde, there are 5 suffixes, ordered longest to shortest:
abcde
bcde
cde
de
e
Each suffix is then exploded, ...
10
votes
12answers
303 views
Given a string, Return its Cumulative Delta [duplicate]
Related
Explanation
Given a string such as DCBA, convert it to ASCII ordinals, such as 68 67 66 65. Then, take the differences between each value, eg 67 - 68 = -1, 66 - 67 = -1... giving -1 -1 -1 ...
33
votes
40answers
2k views
EvenSt-ring C ode - g ol!f
An 'Even string' is any string where the parity of the ASCII values of the characters is always alternating. For example, the string EvenSt-ring$! is an even-string because the ASCII values of the ...
38
votes
9answers
2k views
Square, diamond, square, diamond
Task
Given a non-empty string of lowercase ASCII letters a-z, take its first character, and:
Surround it with a square of copies of the second character,
Surround that with a diamond of copies of ...
29
votes
21answers
3k views
Simulate keystrokes
Your job is to simulate a couple of keystrokes that a user types in.
Input
A string array or string with a delimiter of your choice (outside the range 32-126) containing at least one 'keystroke'.
...
3
votes
1answer
141 views
String Similarity using Jaro-Winkler
String Similarity
String similarity is basically a ratio of how similar one string is to another. This can be calculated in many ways, and there are various algorithms out there for implementing a ...
27
votes
29answers
3k views
Let's do the Wave!
Input:
A string (the wave-snippet) with a length >= 2.
A positive integer n >= 1.
Output:
We output a single-line wave. We do this by repeating the input string n times.
Challenge rules:
If ...
18
votes
6answers
367 views
Movie Title Styled String
Challenge
Ever seen those movie trailer titles (namely Martian, Interstellar, etc) where they have huge gaps in between letters slowly spreading out?
The challenge is to recreate this effect given ...
18
votes
11answers
572 views
KITT car ASCII art
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked ...
41
votes
8answers
1k views
Find the Swirling Words!
Don't ask me how or why but while coding on a project I noticed that the characters of a couple of words had a particular pattern referred to the alphabet, I connected each character of the words with ...
17
votes
3answers
282 views
Smallest Hamming distance to a palindrome containing a substring
This was inspired by a now removed CS.SE question.
Task
Given two non-empty input strings A and B, output the smallest distance from A to a palindrome that contains B as a substring. Distance is ...
34
votes
13answers
3k views
Incrementing Gray Codes
Introduction
A Gray Code is an alternative to binary representation in which a number is incremented by toggling only one bit, rather than a variable amount of bits. Here are some gray codes along ...
-5
votes
1answer
125 views
How much wood would a woodchuck chuck if a woodchuck could chuck wood? [duplicate]
The aim of this golf, is to output the text: "How much wood would a woodchuck chuck if a woodchuck could chuck wood?", request the user's input (which is a string), and then print "A woodchuck would ...
39
votes
46answers
3k views
Now I know my ABCs, won't you come and golf with me?
Write a program or function that outputs this exact text, case-insensitive:
A, B, C, D, E, F, G,
H, I, J, K, L, M, N, O, P,
Q, R, S,
T, U, V,
W, X, Y, Z.
(Based on the alphabet song that many ...
6
votes
5answers
306 views
Some ASCII art for N64's 20th B-Day
The official release of the Nintendo 64 in North America was on September 29, 1996.[1] I figured that this anniversary deserved an ASCII art challenge. There's one small twist though, you have to ...
9
votes
2answers
260 views
Convert pointfree to pointful
Being a Haskell hacker, I prefer pointfree notation over pointful. Unfortunately some people find pointfree notation hard to read, and I find it hard to get the correct number of parentheses when I ...
23
votes
9answers
934 views
Praming Puzles & Colf: Condense a String
Having spend some time on this site I have come to enjoy things being as short as possible. That may be the reason why I'm recently kind of offended by strings containing the same characters more than ...
8
votes
20answers
665 views
String and ASCII [duplicate]
The Challenge
Given a non-empty string containing only lowercase or uppercase letters and no spaces:
Sum up the ASCII values for each character instance in the input string.
The sum will be ...
11
votes
37answers
2k views
Output a string's cumulative slope
Challenge
Given a string such as Hello World!, break it down into its character values: 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33.
Then calculate the difference between each ...
24
votes
13answers
4k views
Cheating a multiple choice test, part 2
This is sequel to this challenge by Adnan. If you like this challenge, chances are you'll like the other one too. Check it out!
A multiple choice test with 8 questions each with 4 choices might have ...
24
votes
18answers
2k views
Draw a Bumpy String
(Inspired by this challenge.)
Let's say we have a string ABBCBA. We can say that there is a rise between A and B, for B follows A; we can say that there is a run between B and B, for nothing changes; ...
12
votes
10answers
508 views
ASCII Odd/Even Cipher
We'll define the ASCII Odd/Even Cipher via the below pseudocode:
Define 'neighbor' as the characters adjacent to the current letter in the string
If the one of the neighbors is out of bounds of the ...
27
votes
16answers
1k views
Implement tab completion
Tab completion is a useful feature that auto-completes partially written commands. You're going to be implementing it.
For example, if the available commands were ['apply','apple','apple pie','eat'],...
8
votes
10answers
395 views
String Concatenation
The Challenge
Given two strings containing only lowercase letters and no spaces, the result should be the shorter string, followed by an underscore, followed by the longer string with the first ...
23
votes
20answers
2k views
Jimmy these arrays down
My coworker, Jimmy is kinda new to C/C++. He's also kind of a slow learner. Now, to be fair, his code always compiles, but he has some really sloppy habits. For example, everybody knows that you can ...
25
votes
30answers
2k views
Substring Chainification
Introduction
For this example, let's take the string Hello, World! and the array [3, 2, 3]. To find the substring chain, we go through the following process:
The first number of the array is 3, so ...
24
votes
56answers
3k views
Is it an Odd Word?
Challenge
Given a single word as input, determine if the word is odd or even.
Odd and Even words
Assume the general rules:
odd + odd = even
even + odd = odd
odd + even = odd
even + even = even
In ...
20
votes
23answers
1k views
Close-Knit Words
Introduction
According to Rand Al'Thor's post in the Puzzling SE, a close-knit word is any word that contains three alphabetically consecutive letters (in any order).
Words like education, foghorn ...
17
votes
6answers
445 views
Minecraft castle fractal
Inpsired by a youtube video from a fellow PPCG user...
You challenge is to use ASCII-art draw a Minecraft castle wall of Andesite and Diorite. The shape of the wall is the Cantor Set. For reference, ...
4
votes
0answers
120 views
Expand the variadic expression
One of the cool features introduced in the C++11 standard is the ability to declare a template parameter as being variadic; i.e. that parameter represents a sequence of an arbitrary number of ...
28
votes
23answers
1k views
String Distance
Challenge
Given an input of an all-lowercase string [a-z], output the total distance between the letters.
Example
Input: golf
Distance from g to o : 8
Distance from o to l : 3
Distance from l to f ...
13
votes
24answers
3k views
English to Alien translator
Briefing
Aliens have settled on earth and strangely enough, their alphabet is the exact same as ours. Their language is also very similar to ours with some very distinct and easy to compute ...
16
votes
19answers
3k views
An A , or An An?
In English, there is the fun and simple difference between an and a: you use an when preceding a word starting with a vowel sound, and a when the word starts with a consonant sound.
For the sake of ...
32
votes
50answers
4k views
StringgnirtSStringgnirtSStringgnirtS
Here is a relatively simple challenge for you.
Given a string of length N, output the string forwards, then backwards, then forwards, then backwards... etc. N times. For example, if your input was
...
8
votes
2answers
312 views
The ten hundred most common words
This question is written because "Thing Explainer" is fun to read, and gave me an idea.
Write "stuff that makes computer do things" that reads/takes a set of letters, numbers and things like this "#%|...
4
votes
0answers
135 views
Generate Menu Access Keys
This is thematically similar to Generate keyboard shortcuts for a menu, but its actually a pretty different challenge.
Let's take PHPStorm's menu as an example:
New Project
New
Open Directory
Open
...
18
votes
11answers
3k views
Source code GO!
Let's use augmented reality to hunt small creatures hidden in source-code. Write a quine program that outputs its own code source, except for 5 consecutive characters that will be modified and that ...
29
votes
20answers
3k views
Parse the comments out of my esoteric code
Earlier this week, we learned about how to format esoteric languages for commenting. Today, we're going to do the inverse of that. I need you to write a program or function that parses some well-...
31
votes
11answers
4k views
How long is a Welsh word?
Write a program or function which receives as input a string representing a Welsh word (UTF-8 unless otherwise specified by you).
The following are all single letters in Welsh:
a, b, c, ch, d, dd, ...
30
votes
30answers
5k views
Is it a Bumpy Word?
(inspired by this challenge over on Puzzling -- SPOILERS for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!)
If a letter in a word occurs alphabetically ...