instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Create a function that takes in a generator function as its only parameter, and returns an object that can be used as both as a generator and a generator function for said generator. The idea is to be able to create an object that behaves like a generator (that is, it follows the iteration protocols) but also has the a... | stackexchange_codegolf |
The naming conventions for games in the Super Mario series is very strange, and don't match up between regions.
| Japanese Name | American Name |
|---------------------|------------------------------------|
| Super Mario Bros. | Super Mario Bros. |
| Super Mario Bros. 2 | S... | stackexchange_codegolf |
Create a quine that cannot be golfed. Your score is your byte count, where higher is better. If someone finds a shorter version, their score is your original byte count, and you lose points
Scoring example:
original submission, 34 bytes // score is 34
function(this){self.printquine();}
golfed, 31 bytes ... | stackexchange_codegolf |
I started a CodeWars kata in Python, just two days ago, related to code golf.
Task: Given two congruent circles a and b of radius r, return the area of their intersection rounded down to the nearest integer, in less than 128 chars.
Has to be a one-liner.
Version: Python 3.6
External libraries: You may import NumPy as ... | stackexchange_codegolf |
Background
The birthday paradox is a popular problem in probability theory which defies (most people's) mathematical intuition. The problem statement is:
Given N people, what is the probability that at least two of them have the same birthday (disregarding the year).
The problem is usually simplified by ignoring leap... | stackexchange_codegolf |
Challenge
Take a number and output it with 4 digits or less using letters and numbers. For example; 270,030 would turn into 270K.
Key
Billion -> B
Million -> M
Thousand -> K
Rules
You may choose to accept input numbers that include commas delimiting every three decimal places (such as 123,456,789).
Round to nearest, h... | stackexchange_codegolf |
Most people are familiar with the trope about counting sheep to fall asleep. There's a herd of sheep, some of them jumping over a fence, and you count the sheep as they jump. Supposedly, this helps quiet your mind and gets you into a sleep-like state so that you'll fall asleep.
Here's an ASCII sheep facing to the right... | stackexchange_codegolf |
This is a quine challenge related to Write the shortest self-identifying program (a quine variant)
Write a function or a full program that compares lexicographically its source code and input, that is, output three distinct values of your choice telling if input / source code is Bigger, Equal or Less than source code /... | stackexchange_codegolf |
Gaussian integer is a complex number in the form \$x+yi\$, where \$x,y\$ are integer and \$i^2=-1\$.
The task is to perform such operation for Gaussian integers \$a,b\$, that
\$a=q \cdot b+r\$ and \$|r|<|b|\$ (\$q,r\$ are Gaussian integers, \$|z|\$ is defined as \$\sqrt{a^2+b^2}\$ for \$a+bi=z\$).
Need to output only ... | stackexchange_codegolf |
In this challenge, you receive a string as input containing a string of X's, Y's and Z's eg. "XYZZ". X, Y and Z represent a particular character. This pattern is then compared with a second string input. If the pattern exists as a substring in the second input, return True, otherwise, return False. Once a pattern is fo... | stackexchange_codegolf |
There's a satirical song called Little Boxes, originally by Malvina Reynolds, about suburban sprawl that has lyrics as follows:
Little boxes on the hillside,
Little boxes made of ticky-tacky,
Little boxes on the hillside,
Little boxes all the same.
There's a green one and a pink one
And a blue one and a yell... | stackexchange_codegolf |
Penalty shootout
Welcome to CG world cup. Your job: Code a penalty shooter and goal keeper!
Rules of the game:
The goal is 700 cm wide and 200 cm tall. If I have to make a rectangle out of it, the goal is ABCD where A is (0,0), B is (0,200), C is (700,200), D is (700,0).
The shooter gives me the coordinate where he wi... | stackexchange_codegolf |
Inspired by the Lego gear ratios challenge by Keith Randall.
I, too, plan on building a giant lego robot that will eventually be able to destroy the other robots in the never-before-mentioned competition.* In the process of constructing the robot, I will be using a lot of gear trains to connect different parts of the r... | stackexchange_codegolf |
You are given an array A of non-negative integers. You can pick any non-empty subset, S from the array A. The score of a subset S is the sum of the elements in S raised to the power of K, i.e. for a subset S={s1,s2,…,sm}, the score of S is (s1+s2+…,sm)K. Output the sum of scores over all possible non-empty subsets of A... | stackexchange_codegolf |
Ice mazes have been one of my favorite staples of Pokémon games since their debut in Pokémon Gold and Silver. Your task will be to make a program that solves these types of problems.
Ice mazes primarily consist of, as the name suggests, ice. Once the player moves in a direction on ice they will continue to move in th... | stackexchange_codegolf |
In this challenge, your task is to input a rectangle ASCII pattern (You may assume only printable characters need to be handled, and you may assume a trailing newline or not), C4_4 symmetrify, and output it.
Here, C4_4 symmetric means symmetric under 90-degree rotation around a corner of the corner character. The corre... | stackexchange_codegolf |
Robbers Thread
Cops, your task is to chose a program that prints a string (you can choose).
Although, if you change 1 character in your code, it should print another string.
But there's a twist: You should make your code hard to read, so that the robbers can't find your "changeable" character.
The winner cop is the use... | stackexchange_codegolf |
Today (or tomorrow, depending on your timezone, by the time of posting) is the birthday of the great mathematician and physicist Leonhard Euler. To celebrate his birthday, this challenge is about one of his theorems in geometry.
For a triangle, we define its incircle to be the largest circle inside the triangle and its... | stackexchange_codegolf |
Write the shortest code that calculates all possible (legal) moves of current player from a given FEN string. What is FEN string? (Wikipedia)
Shortest code wins, language doesn't matter.
Output moves must obey chess rules of movement except en passant, castling, and pawn promotion.
Ignore check, checkmate, and stale... | stackexchange_codegolf |
Your input will be an English sentence, phrase, or word. It will only contain a-zA-Z' -,.!?. Your task is to take the input, remove spaces, and then redistribute capitalization such that letters at indexes that were capitalized before (and only letters at indexes that were capitalized before) are capitalized.
For examp... | stackexchange_codegolf |
In this challenge you will take a an ascii art image of a highway like so
| | | | | |
| | | |
| | | | | |
| | | |
| | | | | |
| | | |
| | | | | |
And you need to put rain across its lanes like so
|\\\|\\\| |\\|\\|
|\\\\\\\| |\\\\\|
|\\\|\\\| |\\... | stackexchange_codegolf |
Challenge
The main objective of the challenge is pretty simple, this is an answer chaining contest, where you have to serially print numbers from 1. That means User 1's answer will print 1, then User 2's answer will print 2 and so on. But there are some rules to make the contest tougher.
Rules
You can't use the charac... | stackexchange_codegolf |
We are all used to the old-school telephone keypad, right? For reference, here is what it looks like:
Given a String consisting only of lowercase ASCII letters and single spaces, your task is to return the number of taps one should make in order to type down the full String with a telephone keypad as the one above.
F... | stackexchange_codegolf |
In a 9 by 9 grid some points have been marked. The task is it to
make a program that counts all distinct squares that can be made
using four marked points. Note that squares can also be placed
diagonally (any angle).
Input can be one of the following:
A character string of length 81 containing two distinct characters
... | stackexchange_codegolf |
Calculate the maximum number of circles of radius r that can fit in a rectangle with width x and height y. Write a function that take r, x and y as input and returns the number of circles that fit in the rectangle.
| stackexchange_codegolf |
You are a historian studying a long forgotten language. You have just discovered a clay tablet which seems to list all known words in the language, in alphabetical order. Your task is to find this alphabet's order, if it exists.
The Task
Given an ordered list of words, try to output an ordered list of characters such t... | stackexchange_codegolf |
Inverse function of this challenge
To (properly) multiply an string by an integer, you split the string into characters, repeat each character a number of times equal to the integer, and then stick the characters back together. If the integer is negative, we use its absolute value in the first step, and then reverse t... | stackexchange_codegolf |
These are ASCII dandelions:
\|/ \ / |
/|\ | \|/ |
| | | _\|/_
| | | /|\
ASCII dandelions have three parameters: Length of the stem (positive number between 1 and 256, number of seeds (positive number between 0 and 7), and orientation (^ or ... | stackexchange_codegolf |
Creating a golfing language can be hard. Let's help budding golfing language creators out and provide some helpful tips on how to create one.
I'm looking for tips on:
The design process
Implementation
Community engagement
One tip per answer would be appreciated, and tips like "don't create a new language, use an exis... | stackexchange_codegolf |
Definition
Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. Characters with 10 or more instances will define 2 or more digits of the returned integer. For example, aaaaaaaaaaaaaaaaaaaaaa... | stackexchange_codegolf |
Use any programming language to generate two random digits between 1 and 9 (including both). Then your program should display:
in the first line: the first random digit,
in the second line: the second random digit,
in the third line: a number whose tens and units digits are the first and second random digits res... | stackexchange_codegolf |
This is going to be relatively quick...
Challenge
Given a lower-case word as input, calculate the Pearson's Correlation Coefficient between the letter position of the word (nth letter within the word, x), and the letter position within the alphabet (nth letter of the alphabet, y).
Background
Pearson's Correlation Coeff... | stackexchange_codegolf |
"Let's face it, aligned images are like little gifts from Heaven. Welcome, but unexpected." - Geobits
+10000 reputation to whoever wins this challenge.
Rules:
1) You are to generate a program.
2) Input will be an image, however whether it is passed as a file or a list of numbers is up to you.
3) Output will be a file w... | stackexchange_codegolf |
The McGill Billboard Project annotates various audio features of songs from a random sample of the Billboard charts. I scraped this data to produce the following file of chord progressions:
chords.txt
Write the shortest code that outputs the above file (or its contents).
Edit: Here's a quick description of the notation... | stackexchange_codegolf |
The Catalan numbers (OEIS) are a sequence of natural numbers often appearing in combinatorics.
The nth Catalan number is the number of Dyck words (balanced strings of parenthesis or brackets such as [[][]]; formally defined as a string using two characters a and b such that any substring starting from the beginning has... | stackexchange_codegolf |
For an integer n that satisfies n > 0, write its value as a right-descending path based on its binary representation.
Rules
The first (most significant) set bit is always in the top-left corner.
When the next bit is set (a 1), draw a character ("filled") on the next line in the same column as the previous character dr... | stackexchange_codegolf |
This is a program I wrote in JavaScript to validate some inputted credentials, with an intentional vulnerability. The credentials_validator function takes an object as input, with usernames and passwords. It returns a function, which takes a username and password and returns true if the credentials are valid.
Your chal... | stackexchange_codegolf |
Here in California, we're in a drought so we need to know how much water we have left so we can conserve as much water as possible.
Because water is limited supply, your code will need to be as short as possible.
Examples
| |
| |
|~~~|
|___|
Output: 0.5
|~~~~~|
| |
| |
|_____|
Output: 1
| |
|__|
Outpu... | stackexchange_codegolf |
In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices:
1) Increment the number by 1.
2) Reverse the integer (remove leading zeros after reversing)
Input: n=42
Output: 1>2>3>4>5>6>7>8>9>10>11>12>13>14>41>42 **... | stackexchange_codegolf |
The Challenge
Given an integer n>0 output a n+1 X n+1 matrix containing all integers from 1 to 2n as shown in the test cases bellow
Test Cases
n=1
1 2
2 2
n=2
1 2 4
2 3 4
4 4 4
n=5
1 2 3 4 5 10
2 3 4 5 6 10
3 4 5 6 7 10
4 5 6 7 8 10
5 6 7... | stackexchange_codegolf |
My dog ate my calendar, and now my days are all mixed up. I tried putting it back together, but I keep mixing up the days of the week! I need some help putting my calendar back together, with the days in the correct order.
And since I need my calendar put together as fast as possible, don't waste my time by sending me ... | stackexchange_codegolf |
Introduction
You are a supervisor of a parking lot and your manager is preparing for shrinking the size to the extreme.
It is a simplified and adapted version of a problem in last year's PAT top-level.
Challenge
You are asked to calculate how many cars are in the lot at the same time, at most.
Standard rules apply. And... | stackexchange_codegolf |
Introduction
In the United States, national elections are normally held on the first Tuesday after the first Monday in November.
Challenge
Write a program that takes a Year as integer, and a pair of (day of week as character and ordinal as integer) and output the date as "yyyy-mm-dd"
Remember, the second pair is after... | stackexchange_codegolf |
Your task is to output the exact string
The Jabberwocky
without taking input. Normal rules for input and output apply, so both functions and programs are allowed.
Of course there is a catch, it wouldn't be fun without a catch. Your program, when stripped of non-alphabetic characters, must start the poem The Jabberwo... | stackexchange_codegolf |
Task
Provide two programs/functions A and B (not necessarily in the same language) with the following properties:
Either program, when given its own source code as input, produces an accepting output.
Either program, when given the other program's source code as input, produces a rejecting output.
It doesn't matter w... | stackexchange_codegolf |
A traveler needs to stay for n days in a hotel outside town. He is out of cash and his credit card is expired. But he has a gold chain with n links.
The rule in this hotel is that residents should pay their rent every morning. The traveler comes to an agreement with the manager to pay one link of the golden chain for e... | stackexchange_codegolf |
Something unusual: a code golf question with a purpose.
I occasionally find myself in scenarios resembling the following:
Suppose you have two computers, A and B. Both of them have a fresh copy of Windows 10 installed. It comes with all the usual stuff, like notepad and paint and a browser, but no extras, like a Linu... | stackexchange_codegolf |
Given a string which is guaranteed to be either odd, even, square, cube, prime or composite, your program or function must return an integer \$100\le N\le 999\$ which meets this description.
Rules
Your code must be deterministic.
The choice of the integers is up to you. However, the six answers must be distinct. (For ... | stackexchange_codegolf |
Following last year's event, we're doing Code Golf Advent Calendar 2022!
On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast ... | stackexchange_codegolf |
Write a program or function that given an integer radius r returns the number of unit squares the circle with radius r centered at the origin passes through. If the circle passes exactly through a point on the grid that does not count as passing through the adjacent unit squares.
Here's an illustration for r = 5:
Illu... | stackexchange_codegolf |
Background
You are planning your trip away from the Diamond City, and must travel through Diamond Road. However, Diamond Road branches away from Diamond City to different locations.
Out of curiosity, you'd like to measure the total distance of unique roads used for all paths.
We define a path as a string that only cont... | stackexchange_codegolf |
A string of digits (positive integer) can be converted to plain English in various ways. For instance, 115 can be read as "hundredfifteen", "oneonefive", "elevenfive", "twoonesfive". So question's challenge is to output the shortest string representation for a given digits string.
Rules:
The input string can start wi... | stackexchange_codegolf |
In any programming language, make a program that outputs infinite subsequent powers of two, starting at any power of two with finite integer exponent. There does not need to be a seperator between outputs.
Note: it only has to theoretically output infinite subequent powers of two given infinite integer size (so you can... | stackexchange_codegolf |
For this challenge, submissions should be a program or function shaped like a right triangle, which produces a right triangle of the same size.
What is a right triangle?
For this challenge, a right triangle consists of 1 or more lines, each containing a number of characters (assume all non-newline characters are the sa... | stackexchange_codegolf |
Your challenge is to print/output/return this text:
_____ _____
| 1 | | 2 |
| H | ... | stackexchange_codegolf |
You’re given two \$r×c\$ grids. Each cell contains either 0 or 1. What are the minimum number of swaps (between horizontally and vertically adjacent cell elements, no wrapping i.e no swapping between last and first element of a row) are required in the first grid for it to match the second. If the matched arrangement c... | stackexchange_codegolf |
Introduction
Tensor contraction is an operation that can be performed on a tensor. It is a generalization of the idea of the trace of a matrix. For example, if we have a rank-2 tensor (a matrix) and we contract along both of its axes, we take the sum of each entry in which the indices of these axes are equal. In this c... | stackexchange_codegolf |
Problem source: https://oj.vnoi.info/problem/backtrack_j
We have these two shapes:
#.
##
and
.#
##
Let's call the first shape the L and the second shape the flipped L.
On a 4x4 board, there are 16 cells. Each cell can be either free or occupied. In all the illustrations, # represents an occupied cell and . represents... | stackexchange_codegolf |
This challenge is inspired from this answer at the Ask Ubuntu Stack Exchange.
Intro
Remember the Windows ME screensaver with the pipes? Time to bring the nostalgia back!
Challenge
You should write a program or function which will output an ASCII representation of the screensaver. In the screensaver there should be a... | stackexchange_codegolf |
Whyte Notation is a classification method mainly for steam locomotive, that classifies by wheel arrangement. On a steam locomotive ( we're only focusing on non articulated locomotives here ), the wheels are generally disposed like this : you have a specific number of leading wheels, then a specific number of driver whe... | stackexchange_codegolf |
We say two positive integers are anagrams of each other if the digits in one of them (in decimal representation) can be rearranged to form the other. Leading zeros don't count. For example, 110020222 is an anagram of 212102020, but not of 221100011; neither is 22002211 even though it can be written as 022002211.
Intere... | stackexchange_codegolf |
Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number.
Task: Given a prime power pn > 1, return the prime p.
Testcases:
input output
9 3
16 2
343 7
2687 2687
59049 3
Scoring: This is code-golf. Shortest answer in bytes wins.
| stackexchange_codegolf |
There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever.
Your task is to create a program that gives the next word in sequence giv... | stackexchange_codegolf |
Write a program/function that finds the amount of fuel needed to escape Earth's gravity well given the exhaust velocity of the fuel and the amount of mass to transport using the Tsiolkovsky rocket equation:
$$\Delta v = v_\text{exhaust}\ln\dfrac{m_\text{start}}{m_\text{end}}$$
where
\$\Delta v\$ is the change in veloc... | stackexchange_codegolf |
This is the cops' thread. The robbers' thread is here.
Your challenge is to write a program or function that, with a certain input, prints the exact string Hello, World! and a newline. Capitalization, spacing and punctuation must be exact.
Input may be taken via standard input, a file, or command-line/function argument... | stackexchange_codegolf |
Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milk-white, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows:
White bulls \$=... | stackexchange_codegolf |
The basis vectors for geometric algebra are
$$(e_0=1), e_1, e_2,\dots,e_n$$
They all square to 1 (we do not consider vectors which square to -1 or zero)
$$e_i \cdot e_i = 1$$
They are associative and anticommutative (except \$e_0=1\$ which is associative and commutative)
$$e_i \cdot e_j =-e_j \cdot e_i \: \; (i\neq j);... | stackexchange_codegolf |
So this is my first challenge on this site.
The challenge is to take in an input integer \$n\$, which will be positive, and print, in ascending order (\$1\$ to \$n\$, including n), the output of \$i^{(n-i)}\$ (where \$i\$ is the current integer).
Example
Given the input 5, the program will print:
1
8
9
4
1
... | stackexchange_codegolf |
Challenge
Your task is to write a piece of code that outputs another piece of code. That code must in turn output yet another code until the final code outputs the integer 1. The chain ends the first time 1 is outputted.
None of your programs may share any characters (there's one exception in the Rules-section).
The w... | stackexchange_codegolf |
There is a building with an infinite number of floors and you are the only passenger in an elevator which can lift an infinite number of people. You are going home, but before the elevator gets to your floor, the elevator stops at another floor to allow people to enter the elevator and input their destination floors. Y... | stackexchange_codegolf |
Write a program that accepts HTTP requests on any port of your choice above 1024, and responds to requests on any URL of your choice with its own source code. It must work with, at least, Firefox and Chrome. The code should be delivered as text/plain (removed requirement because none of the answers but one met it) with... | stackexchange_codegolf |
Background
An almost regular hexagon is a hexagon where
all of its internal angles are 120 degrees, and
pairs of the opposite sides are parallel and have equal lengths (i.e. a zonogon).
The following is an example of an almost regular hexagon, with side lengths 2 (red), 4 (blue), and 3 (yellow).
A triangular domino ... | stackexchange_codegolf |
You are the roughest, toughest, coolest cowboy west of the Mississippi. However, some weird guy on a wacky nerd website decided that it would be cool to plop you into random unfinished landscapes and fight. No matter, you'll still win. However, to help you win those grueling gunfights you'll write home about, it's help... | stackexchange_codegolf |
A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.
Input
The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine... | stackexchange_codegolf |
in my country we have a children's song which goes like this:
Priletela muha na zid, muha na zid, muha na zid.
Priletela muha na zid,
muha na zid.
Pralatala maha na zad, maha na zad, maha na zad.
Pralatala maha na zad,
maha na zad.
Preletele mehe ne zed, mehe ne zed, mehe ne zed.
Preletele mehe ne zed,
mehe ne zed.
... | stackexchange_codegolf |
Challenge
Given a positive integer \$N\$, repeat each of its digits \$d_1, d_2, d_3, \cdots, d_n\$ a number of times corresponding to its position in \$N\$. In other words, each digit \$d_k\$ should be repeated \$k\$ times (for each \$1\le k\le n\$, 1-indexed), thus creating the new number:
$$\overline{d_1d_2d_2d_3d_3d... | stackexchange_codegolf |
Challenge:
In a hypothetical scenario, the countdown timer for a race has random intervals between the counts, to prevent premature starting, e.g.
3 (0.82 seconds pass), 2 (0.67 seconds pass), 1
Input:
nothing
Output:
Write a program (or function) that prints the 3 numbers with a random time interval from 0.50 seco... | stackexchange_codegolf |
Given three integers >= 2, create an ASCII cube in an orthogonal (cabinet) projection.
The three integers represent height, width and depth (measured in visible characters) including the corners. The corners should be 'o's or '+', free choice.
w: 10, h: 5, d: 4
Thus gives:
o--------o
/ /|
/ / |
o... | stackexchange_codegolf |
As I'm sure many of you know, synonyms can range from very similar to not-so-similar-but-I-can-see-how-it's-similar. It's common for dictionaries to use "See also" to denote occurrences of words that have especially good synonyms. Thesauruses (Thesauri?), on the other hand, list every word that is remotely close in def... | stackexchange_codegolf |
Behold! The Crystal Maze™ Time Matrix!
0 1 2 3 4 5 6 7 8 9 10
1 0 5 10 15 20 25 30 35 40 45 50
2 0 10 20 30 40 50 60 70 80 90 100
3 0 15 30 45 60 75 90 105 120 135 150
4 0 20 40 60 80 100 120 140 160 180 200
5 0 25 50 75 100 125 150 175 200 2... | stackexchange_codegolf |
Challenge
Given an email in plain text format, including headers, decide if the email is either spam or ham, and output SPAM or HAM respectively. The emails will be given below. Your code must be able to correctly identify all of the samples, but should be general enough to work on any email.
Scoring
This is a code go... | stackexchange_codegolf |
Challenge:
Given an index integer n, either output the n'th item in this sequence, or output the sequence up to and including index n:
25,25,7,28,29,20,21,22,23,14,35,26,7,28,29,20,16,29,12,15,28,21,14,17,30,13,16,29,12,15,28,21,10,6,12,18,15,11,7,13,19,17,13,9,15,21,18,14,10,16,22,19,15,11,17,23,20,16,12,18,24,21,17,1... | stackexchange_codegolf |
INTRO
Let's say you write a passage and you are close to the end of the line wanting to write down a large word. In most languages, you just leave some blank and move to the next line, like a sir.
Example - English:
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah this man is ... | stackexchange_codegolf |
The goal of radiation hardening is to make a program still work after you remove a byte. However, what if a skilled competitor is purposefully trying to mess with you?
In this game, each bot will take turns removing one character from the next bot down the line. If the bot fails to produce valid output next turn you ga... | stackexchange_codegolf |
Background
The computer game NetHack dates from 1987, before the use of graphics in computer games was widely established. There are lots of monsters in the game, and potentially a lot need to fit on screen at once, so monsters are drawn in a very minimal way: a monster is simply drawn as an ASCII character on screen.
... | stackexchange_codegolf |
Related but different.
Part II
Taken from the book: Marvin Minsky 1967 – Computation:
Finite and Infinite Machines, chapter 14.
Background
As the Gödel proved, it is possible to encode with a unique positive integer not just any string
but any list structure, with any level of nesting.
Procedure of encoding \$G(x)\$ i... | stackexchange_codegolf |
The J language has a very silly syntax for specifying constants. I want to focus on one cool feature in particular: the ability to write in arbitrary bases.
If you write XbY for X any number and Y any string of alphanumerics, then J will interpret Y as a base X number, where 0 through 9 have their usual meaning and a t... | stackexchange_codegolf |
An incremental word chain is a sequence of words of a vocabulary such that each word is the result of either prepending or appending a single character to the previous word, ignoring capitalization. An example of such a chain can be found below.
I → is → his → hiss
Your task is to write a program that for a given voc... | stackexchange_codegolf |
Input:
Ten unique integer coordinates, between (0,0) and (100,100).
Output:
The coordinates arranged in the order/an order such that a path drawn between the coordinates in that order is the shortest path possible.
This is code golf so the shortest code wins!
| stackexchange_codegolf |
(Despite 60+ questions tagged chess, we don't have a simple n-queens challenge.)
In chess, the N-Queens Puzzle is described as follows: Given an n x n chessboard and n queens, arrange the queens onto the chessboard so that no two queens are threatening each other. Below is an example solution for n = 8, borrowed from W... | stackexchange_codegolf |
According to TIO there are two types of programming languages:
Practical (seen in many corporate environments as a development standard).
Recreational (if seen in a corporate environment, you're probably fired).
Your Task
Mix together one language from each of these realms to achieve the simple goal of calculating th... | stackexchange_codegolf |
Given a positive integer N ("virality"), your program should create an ASCII-art drawing of a tree with two branches of length N extending downwards and/or rightwards from the top-left corner.
The direction taken by each branch after the first asterisk can be either rightwards or downwards, and this choice should be ma... | stackexchange_codegolf |
First 15 numbers of the A046173:
1, 99, 9701, 950599, 93149001, 9127651499, 894416697901, 87643708742799, 8588189040096401, 841554882220704499, 82463790268588944501, 8080609891439495856599, 791817305570802005002201, 77590015336047156994359099, 7603029685627050583442189501
Your task is simple, output the first 20 numbe... | stackexchange_codegolf |
The Challenge:
In this question: Name the poker hand you had to take a five card poker hand and identify it. This question is similar, with two twists:
First, the output will be in all lower case. This allows for more golfing, as you don't have to worry about the capitalization of flush and straight
high card
one pair
... | stackexchange_codegolf |
The king of Ancient Rome is having difficulties determining if a magic square is valid or not, because the magic square he is checking does not include any separators between the numbers. He has hired a software engineer to help him determine if a magic square is valid or not.
Input Description
Input comes in on STDIN... | stackexchange_codegolf |
Note: This is an attempt at recycling guest271314's permutation question(s)
There's an interesting pattern that forms when you find the differences between lexographically sorted permutations of base 10 numbers with ascending unique digits. For example, 123 has permutations:
123 132 213 231 312 321
When you find the d... | stackexchange_codegolf |
* and don't have a word processor with top-left align support :D
Take several lines of input, with at least four unique characters of your choice including newline and space. The input can also be taken as a space-padded matrix of characters. Squash it upwards, then squash it left. Output this, with any amount of trail... | stackexchange_codegolf |
Introduction
A bell tower will ring its bells every hour, n times, with n being the the current hour on a 12 hour clock.
For example, a bell will ring 5 times at 5pm, and 10 times at 10am.
Task
Given two times in a suitable format, output the number of times the bell will ring, inclusive of the start and end times
Exam... | stackexchange_codegolf |
John, a knight wants to kill a dragon to escape the castle! The dragon has A heads and B tails.
He knows, that:
if you cut off one tail, two new tails grow
if you cut off two tails, one new head grows
if you cut off one head, one new tail grows
if you cut off two heads, nothing grows
To defeat the dragon, John needs ... | stackexchange_codegolf |
This challenge will behave more or less like a traditional code-golf. The only difference is that instead of scoring answers by their number of characters or bytes, users will assign
weights to different characters in the comments and the program with the lowest cumulative weight will win.
Challenge
Your task is to wri... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.