instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
I'll start off by saying I checked and checked again that this question should be on topic. I will also clearly state that this is a tips question about further golfing a certain set of code not a challenge. I recently answered the following challenge: Scramble words while preserving their outlines: It is well know...
stackexchange_codegolf
Your task is, given a array of numbers, that is strictly increasing, output the crate stack. The input is an array of positive integers which represents which layer has how many crates there are. So the first number is the top layer and so on. The sum of the array is the size of the crate. Since the array order follows...
stackexchange_codegolf
Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code. Aheui is esolang written in only Korean character. Because of its nature, Aheui can't use Arabic numbers. But, of course, there is way to generate number. Brief introduction to Ahe...
stackexchange_codegolf
I'm sure you know about the $9.99 price scheme, instead of using $10. Well, in your new job as a sys admin at a large retail store, they want prices to adhere to a similar scheme: All prices are in whole dollars, no cents. All prices should end with 5 or 9, rounding to the closest but up if the last digit is right bet...
stackexchange_codegolf
I have some books and a bookshelf. I would like to put as many books on the shelf as possible but I have a rule. All dimensions of the books (height, width and depth) should form a non-increasing sequence on the shelf. This means every books has to be at least as high as the ones after it on the self. The same goes for...
stackexchange_codegolf
This is a cops-and-robbers puzzle the robbers' thread can be found here. Your task will be two write two programs (or functions) such that they are anagrams of each other and one performs the left inverse of the other. These programs may accept and output as many integers or complex numbers as you wish. If you choose...
stackexchange_codegolf
Recently I've been playing a game called Alcazar. It is a board puzzle game where your goal is to enter from one door, pass through all squares, and exit through another door. The only rules are: Enter once, leave once; Pass through all squares; Do not pass through a square more than once The image below shows an exa...
stackexchange_codegolf
Background You awake on the ground. Above you is a giant stepped pyramid-like structure. Based on your ancient history lessons, you recognize it as a ziggurat. You have been transported by Dr. Sargostein back into ancient Mesopotamia to play a game. In this King of the Hill Ziggurat challenge, you will write a bot that...
stackexchange_codegolf
Surprised that we don't have a symmetric difference challenge yet. Given two lists only containing positive integers, return all items among these two lists that aren't contained in both of the lists. Rules From the set definition: A set is a collection of definite distinct items. So you can assume the items in the ...
stackexchange_codegolf
What general tips do you have for golfing in Uiua? I'm looking for ideas that can be applied to code golf problems in general that are specific to Uiua. (e.g. "remove comments" would not be an answer.) Please post one tip per answer.
stackexchange_codegolf
You must make a regex that matches everything except itself. For example, PPCG must not match PPCG, but must match everything else, like something, PPC, and PPCG!. Surrounding slashes are not considered part of the regex in flavors where they are usually part of the syntax. The same is true of all delimiters. The rege...
stackexchange_codegolf
This is the cops' thread. For the robbers' thread, click here. Cops' Task First, write a quine in a language of your choosing. Next, scramble the quine. Make sure to do this well as the robbers will be trying to unscramble it and find the original source code! Note that the scrambled code does not need to work. Post a...
stackexchange_codegolf
If you have ever looked at an objdump of a C++ program, you have likely seen something like this: _ZN3foo3bar3bazI6sampleEE3quxvi3foo This is a C++ mangled symbol, which encodes the namespaces, classes, and function/template arguments, using the Itanium ABI. Specifically, it is for the following function: void foo::ba...
stackexchange_codegolf
How many of you that still use your own knuckle to determine whether a month is having a full 31 days or less? You job is to write a program to count how many months, in a month range, are having a full 31 days and how many are having less than 31 days by "counting the knuckles". Courtesy: amsi.org.au Input A pair of...
stackexchange_codegolf
Just because the reverse and palindrome were not too challenging individually :) Write a program (full program or function) that satisfies the following: given a string input, the program as-is outputs the input string unchanged. the program reversed outputs the input string reversed. the program palindromized outputs...
stackexchange_codegolf
In this challenge, your task is to detect (vertical) Skewer Symmetry. This means that one half of the pattern can be produced by mirroring the other half along a vertical axis, and then moving it vertically. For example, the following pattern has skewer symmetry: asdf jkl;fdsa ;lkj Because if you start from th...
stackexchange_codegolf
Strassen's algorithm was the first method of matrix multiplication in subcubic time complexity, namely O(n**log2(7)) for a pair of n*n matrices (assuming the numbers therein are large enough that their O(n*log2(n)) exact multiplication has become the constraint on your performance, and any nested structures and functio...
stackexchange_codegolf
Given an MxN grid of numbers, find the greatest product of a length 4 subsequence in any row, column, or diagonal. Subsequences cannot wrap around (e.g. 5 1 2 3 in the row 1 2 3 4 5). I/O can be anything reasonable: files, stdin/stdout, copy+pasting expressions/arguments, variables. (If I'm missing any esoteric I/O opt...
stackexchange_codegolf
Your job is to create the longest period iterating quine, where the length of each program in the sequence is bounded by 500 bytes. That is, if you repeat the following steps: Start with your initial program Run the current program Go back to step 2 You will eventually get back to your original program. The number of...
stackexchange_codegolf
Input: You get a series of integers (fed via stdin or prompt). Every pair of integers in this series represents a building's WIDTH [valid range: 1..10] and HEIGHT [valid range: 0..10] Assume input to be well-formed. Sample input (the second line is for demonstration purposes only): 1 2 1 1 1 0 2 4 1 3 1 2 2 1 W H W ...
stackexchange_codegolf
I noticed that there's no such question, so here it is: Do you have general tips for golfing in x86/x64 machine code? If the tip only applies to a certain environment or calling convention, please specify that in your answer. Please only one tip per answer (see here).
stackexchange_codegolf
Problem Given no input write a program or a function that outputs or returns the following string: (<(<>(<>.(<>.<(<>.<>(<>.<>)<>.<>)>.<>).<>)<>)>) Rules Shortest program wins. Trailing whitespace allowed. Trailing newlines allowed. Unused parameters for functions allowed.
stackexchange_codegolf
2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year. Because they are only 12 animals in the Zodiac, your code will need to be as short as possible. Examples Your program must get t...
stackexchange_codegolf
EDIT: In the interest of increasing the complexity, i've added more to the challenge. In mathematics, a vampire number (or true vampire number) is a composite natural number v, with an even number of digits n, that can be factored into two integers x and y each with n/2 digits and not both with trailing ze...
stackexchange_codegolf
Setup Take the following 4x4x4 cube along with a 2D view of 3 of its faces, with a common 1x1x1 cube highlighted: The arrows represent the points of view that generated the V1, V2 and V3 faces drawn underneath the big cube. Given an arrangement of some 1x1x1 cubes inside the main cube we can try and identify it with o...
stackexchange_codegolf
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded. Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h...
stackexchange_codegolf
Toki Pona is a constructed language with 137ish words, designed to constrain the speaker to expressing ideas in a simple and straightforward manner, reducing ideas to more essential forms. Often, people attempt to avoid directly expressing numeric quantities in Toki Pona, opting to express them in more practical terms....
stackexchange_codegolf
The TV series "Breaking Bad" replaced the letters Br and Ba with a periodic-table like representation, printing [Br35]eaking [Ba56]d. Create a program that takes a string input, does a replacement and prints an output. The replacement shall subsidize any substring that matches an element symbol with the notation demons...
stackexchange_codegolf
A pleasing number (according to this definition) is a number that can be passed through the following process (let's use 41802000 as an example): Separate the trailing identical numbers (41802000 => [41802, 000]) Sort the first half of the digits and take the maximum ([41802, 000] => [8, 000]) Take the length of the f...
stackexchange_codegolf
Preface The available keys are the keys of the A through G and A minor through G minor. The Challenge Create a program that creates and saves to a playable audio file a "song" of using (uniformly distributed) random chords. The song must be of length n and in key k. The chords in each "song" must conform to the key. If...
stackexchange_codegolf
Goal Create a program or pair of programs that collectively disrupt and fix files with the intent of preventing LZMA2 from working effectively. The disrupt and fix routines must be reciprocal, so you can recover the original file exactly. Targets The collected works of Shakespeare in plain UTF-8 (5,589,891 bytes) Wik...
stackexchange_codegolf
Write a program, that sends its own source code over network. Network example is TCP/UDP or web socket. Ethernet, Bluetooth, Wi-Fi and internet over USB are allowed. No need to write receiver program. You can use any encoding protocol, but decoder will be realizable. Rules Network is not a stdout, screen, USB, UART, G...
stackexchange_codegolf
This challenge is for the largest finite number you can get BrainFuck programs of given lengths to contain in memory. We must use one of the BF versions that uses big integers for the cells rather than byte values as not to be capped at 255. Do not use negative positions and values in memory. Do not use the BF instruct...
stackexchange_codegolf
Challenge : Check : if there are exactly n exclamation marks ! between every pair and whether the sum of each pair equals to 10. Input : A string of arbitary length. The number of exclamation marks to check for Output : if there are exactly n exclamation marks between each pair, return truthy value, otherwise fal...
stackexchange_codegolf
Challenge: Given a list of multi-line strings, overlap them (in the top-left) and output the result. Example: Input: ["aaaa\naaaa\naaaa\naaaa","bb\nbb\nbb","c"] Output: cbaa bbaa bbaa aaaa Challenge rules: Input-format is flexible. You are allowed to get the input as a 2D list of lines (i.e. [["aaaa","aaaa","aaaa","a...
stackexchange_codegolf
This is my first time here at Code Golf SE so feel free to add your input/advice/suggestions to improve my post if necessary. The week after my computer science exam, the solutions were publicly published. One problem had a 45 line example solution but my solution was only 18 lines, (which I was very proud of), but I b...
stackexchange_codegolf
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 operator will change to it. The possible operators are: "+", "-", "*", "/", and "%", which correspond to their meanings in ...
stackexchange_codegolf
The challenge given to me is comparatively easy, and specific to MySQL only. I'm given a table expressions which have mathematical calculations done by a kid. Basically, I've to select all the right calculations! The table have the following properties, a : an integer, the left operand. b : an integer, the right opera...
stackexchange_codegolf
Goal Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer. Rules Standard loopholes apply except for searching for the answer online. In fact, you are expected to find the answer online. You are allowed ...
stackexchange_codegolf
A theorem in this paper1 states that every integral n-by-n matrix M over the integers with trace M = 0 is a commutator, that means there are two integral matrices A,B of the same size as M such that M = AB - BA. Challenge Given an integral matrix M with trace M = 0 find some integral matrices A,B such that M = AB - BA....
stackexchange_codegolf
While implementing polynomial multiplication in Itr I found the following interesting operation on strings To compute the convolution of two strings (for instance Hello and World) first combine all pairs of letters with indices that add up to the same number (ordered by the index of the first element) 0 -> "HW" 1 -> "...
stackexchange_codegolf
You are given 3 non negative numbers: \$x\$, \$y\$ and \$z\$, and must minimize the number of digits (non negative) inserted at any place in the numbers \$x\$, \$y\$, or \$z\$ to make $$x + y = z$$ (a clarification: you can add any non negative digit any number of time at any place ) (you can assume that \$x\$, \$y\$, ...
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
Problem Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers \$x_1, x_2, x_3... x_n\$ representing n rounds of coin flipping. At each round, we randomly flip \$x_i\$ number of coins at random. i.e Coins that were heads become tails, and vice versa. Within each round,...
stackexchange_codegolf
Pig-latin is a made-up language that is translated into by moving the first letter of a word to the end and adding ay to the end. For example: hello translates into pig-latin as ellohay. Therefore, translating pig-latin back into English is dropping the ay at the end and moving the last letter to the start (like oodbye...
stackexchange_codegolf
The name of the challenge was prompted by this GIF and the GIF also gave me the idea. Your challenge today is to take a input guaranteed to be \$2<=n<=100\$ and output a sequence of x and - characters. The output for a number N represents a sequence of operations applied to 1 where x means "multiply by 2" and - means "...
stackexchange_codegolf
It is known that any natural number can be decomposed into the sum of three triangular numbers (assuming 0 is triangular), according to Fermat's Polygonal Number Theorem. Your task is to come up with an algorithm of decomposing number into 3 triangular numbers that has the best asymptotic complexity. As an input you ar...
stackexchange_codegolf
It's 22022 and the Unicode consortium is having a problem. After the writing system of the ⮧⣝Ⅲⴄ⟢⧩⋓⣠ civilization was assigned the last Unicode block, the consortium members have been scrambling to find a new encoding to replace UTF-8. Finally UTF-∞, a proposal by Bob Rike, was adopted. UTF-∞ is backwards compatible wit...
stackexchange_codegolf
Wren is a small, fast, class-based concurrent scripting language. Does anyone have any tips for this language? Please make sure to post 1 tip per answer, and don't post answers like "remove whitespace".
stackexchange_codegolf
You must write functions for addition, subtraction, multiplication, and division; however, you can never use any of your language's number types / primitives -- this means no ints, no floats, no Integers; no nothing. You cannot reference these types at all; not even implicitly, e.g. no pushing and popping numbers on a ...
stackexchange_codegolf
Background A polyomino of size \$n\$ is a contiguous shape made from joining \$n\$ unit squares side by side. A domino is a size-2 polyomino. A polydomino of size \$2n\$ is defined as a polyomino of size \$2n\$ which can be tiled with \$n\$ dominoes. The following are some examples of polydominoes for \$n=3\$ (hexomino...
stackexchange_codegolf
The goal is to write a simple "99 Bottles of Beer" program .. that is valid in at least 2 distinct languages (e.g. not Python 2 and Python 3). It must be a complete file that will run or compile. Interesting answers should be up-voted, but compactness also counts. (Of course, language diversity is the main goal.) EDIT:...
stackexchange_codegolf
The scene is: Peter is at the gym with his buddy Brian when Brian suddenly is in dire need of his inhaler. Brian manages to tell Peter the code to his combination lock before he collapses on the floor. The moment Peter gets to Brian's locker and sees what the indicator is pointing at, Stewie ambushes him and sprays a f...
stackexchange_codegolf
Given a compressed string \$s\$ made of printable ASCII characters (32 to 126), your task is to print or return the original text by applying this simple decompression algorithm: Start with \$k=0\$ Look for the first occurrence of the digit \$k\$ in \$s\$ and the sub-string \$s'\$ consisting of the \$2\$ characters pr...
stackexchange_codegolf
Word's A▲ and ᴀ▼ buttons change the font size according to these rules: The starting font size is 11. If ᴀ▼ is pressed when the font size is 1, the size stays 1. The font size changes with 1 point in the range 1 – 12. The font size changes with 2 points in the range 12 – 28. The choices are 28, 36, 48, 72, and 80 in t...
stackexchange_codegolf
Your Challenge You must write a program/function etc. that takes a domain name of a StackExchange site and outputs the domain for the meta version of the site passed to it. Examples: stackoverflow.com => meta.stackoverflow.com codegolf.stackexchange.com => codegolf.meta.stackexchange.com mathoverflow.net => meta.mathov...
stackexchange_codegolf
This is a challenge in which two people, 1 and 2, are running for office. People deterministically vote in certain ways in the world of 1 and 2, which can allow for the candidates to figure out the results before the election. NOTE: this is not meant to refer to any outside elections or other political events. Two peop...
stackexchange_codegolf
What is the shortest C expression that is defined to evaluated to false the first time and true for every time after that: Reference implementation: bool b = false; // you get this for free. (b ? true : b = true, false) // only this line is measured.
stackexchange_codegolf
This is the follow up question to standard Sudoku solver. You are given a Sudoku grid where . represents an empty cell and the other cells are filled with numbers 0-8 (inclusive). Rules: All the numbers in Sudoku must appear exactly once in all left-top to right-bottom diagonals. All the numbers in Sudoku must appear ...
stackexchange_codegolf
Challenge Unlike the circumference of a circle (which is as simple as \$2\pi r\$), the circumference (arc length) of an ellipse is hard. Given the semi-major axis \$a\$ and semi-minor axis \$b\$ of an ellipse (see the image below, from Wikipedia), calculate its circumference. By definition, you can assume \$0 < b \le a...
stackexchange_codegolf
I have a crank-operated music box that can play a series of four notes. When I turn the crank, it plucks one of four strings, depending on the position of the crank and the direction of the turn. When the crank is turned due north, the box (with its strings numbered 1 through 4) looks like this: 1 | 2 | O 4...
stackexchange_codegolf
Given a string, character list, byte stream, sequence… which is both valid UTF-8 and valid Windows-1252 (most languages will probably want to take a normal UTF-8 string), convert it from (that is, pretend it is) Windows-1252 to UTF-8. Walked-through example The UTF-8 string I       ♥        U  T  F  -  8 is represente...
stackexchange_codegolf
Church Subtraction Lambda calculus has always been a fascination of mine and the emergent behaviors of passing functions into each other is delightfully complex. Church numerals are representations of natural numbers contructed from the repeated application of a function (normally the unary addition of a constant). For...
stackexchange_codegolf
Black Box is a board game, Your task is to reveal all clues. What is black box Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues. I/O Input The atoms can be any 1-char that is not newline (Used for separator) Like this. O.... ...O. ..O.. ..... ....O Output When the code...
stackexchange_codegolf
In Haskell the list notation: [a,b,c] Is just syntactic sugar for: a:b:c:[] And the string notation: "abc" Is just syntactic sugar for: ['a','b','c'] This means that the string: "abc" Is the same as: 'a':'b':'c':[] Task Given a string you should output what the de-syntaxed version would look like in Haskell. Rule...
stackexchange_codegolf
An integer \$x\in[0,2^{32}-1]\$ divided by an integer \$d\in{[1,2^{31}]}\$ will produce an integral quotient \$q\$ and a remainder \$r\$, so that \$x=d\times q+r\$. Any \$q\$, in fact, can be calculated by the following formula. $$y=\left\lfloor\frac{mx}{2^{32}}\right\rfloor\\q=\left\lfloor\frac{y+f\lfloor(x-y)/2\rfloo...
stackexchange_codegolf
Bi-directional translator The challenge is to create a translator that can translate a [a-zA-Z ] string into another string according to the mappings below. The translator should also be able to translate translated text back into its normal form (hence bi-directional). Case doesn't have to be maintained and can be eit...
stackexchange_codegolf
This is cops-and-robbers. This is the Robbers thread. For the cops thread, go here. I've noticed a number of OEIS challenges since I joined the site. It seems only fair that we have a cops-and-robbers challenge that determines who is the master of online integer sequences, once and for all. Cops Write a program or func...
stackexchange_codegolf
You are little speck on a Cartesian plane. Pondering your existence, you decide to roam around your plane and touch things. You notice that every coordinate pair you visit has a light switch. To entertain yourself, you decide to toggle every switch that you come across. The Challenge: Create a program that will take an...
stackexchange_codegolf
This challenge is partly an algorithms challenge, partly an optimization challenge and partly simply a fastest code challenge. A T matrix is fully specified by its first row r and first column c. Each remaining element of the matrix is just a copy of the element that is diagonally up and left. That is M[i,j] = M[i-1,j-...
stackexchange_codegolf
In celebration of HyperNeutrino getting back his account and rep, following Mr. Xcoder. Apologies for rotating the picture for drawability. Print or output this ASCII art exactly. You may have trailing spaces and/or a trailing newline. _______________ / \ / / \ \ / / ...
stackexchange_codegolf
It's Nowruz and you want to set up a Haft-Sin table by words. This means finding seven words that start with letter s. The Challenge Write a program which its input is a list of words separated by space, and output at most first 7 words which starts by letter s. If the s is before letter h it doesn't count because it w...
stackexchange_codegolf
Your task Given a integer input, \$ n \$ (such that \$ n > 1 \$), decide whether it can be written as the sum of (at least 2) consecutive square numbers. Test cases Truthy: Input Explanation 5 1 + 4 13 4 + 9 14 1 + 4 + 9 25 9 + 16 29 4 + 9 + 16 30 1 + 4 + 9 + 16 41 16 + 25 50 9 + 16 + ...
stackexchange_codegolf
Romanization of Japanese is converting Japanese text into Latin characters. In this challenge, you will be given a string of Japanese characters as input and expected to convert them to the correct ASCII string. What You'll Need To Know The Japanese language has three writing systems: hiragana (the curvy one used for s...
stackexchange_codegolf
You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your essay with the least movement. Formally, you have to assign to each character of !"$%&'()+,-./0123456789:;<=?[]`abcdef...
stackexchange_codegolf
Based on a comment by Jo King on my previous question (called 'Inverse-quotes-quine'), I present this new question. The rules are similar, but just, the opposite: If your program is run normally, all of the code not in the speech marks (" - double quotes) should be printed. If your program is wrapped in double quotes ...
stackexchange_codegolf
I recently stumbled across this image on wikimedia commons. It's a little bit of an information overload at first, but after examining it a bit it shows an interesting number system for writing nibbles. Image created by user Watchduck. First off a "nibble" is a 4 bit number which is really a number ranging from 0 to ...
stackexchange_codegolf
Input 4 integers w, x, y, z from the range -999 to 999 inclusive where none of the values is 0. Output 4 integers a, b, c, d so that aw + bx + cy + dz == 0 where none of the values is 0. Restrictions Your output should be the solution with the smallest sum of absolute values possible. That is the smallest value of \$|...
stackexchange_codegolf
Guide the Alphabet Given an array of directions, where the directions are defined as follows: NW N NE W . E SW S SE Or as indexes (you may use these indices for directions instead of the strings above): 0 1 2 3 . 4 5 6 7 You may choose either format, supporting both is not required by the challenge. Generate ...
stackexchange_codegolf
Assuming StackExchange doesn't decide to restore my account after deleting it due to age restrictions (even though I'm 14 already and almost 15 ಠ_ಠ), a lot of people on this site just lost reputation from my upvotes being deleted. This happened at around 5:30 PM on June 20th, 2017, UTC. So, your challenge is to show ho...
stackexchange_codegolf
On TeX.SE the Help Centre says that the following is on topic: Formats like LaTeX, ConTeXt and plain TeX Engines like pdfTeX, LuaTeX and XeTeX Distributions like TeX Live, MiKTeX, and MacTeX Related software and tools, BibTeX, MakeIndex, Lyx, etc. I wanted you to write a program to tell me whether my TeX is in the on-...
stackexchange_codegolf
This is a code golf puzzle: shortest byte count wins. The program should do the following (standard loopholes obviously forbidden): Input a hexadecimal number Convert to octal Then interpret the digits as if in decimal (765 octal -> 765 decimal) Divide the number by two Convert to hexadecimal Example: Input: 4a3d Out...
stackexchange_codegolf
The goal of this challenge is to take a positive integer n and output (in lexicographic order) all sequences \$S = [a_1, a_2, ..., a_t]\$ of distinct positive integers such that \$\max(S) = n\$. For example, for an input n = 3 your program should output the following eleven sequences in the following order: [ [1, 2, ...
stackexchange_codegolf
I'm trying to make a pointfree function f that can act like APL's dyadic forks/Husk's §, so f g h i a b equals g (h a) (i b), where g is a binary function, h and i are unary functions, and a and b are integers (I'm only dealing with integers and not other types right now). I converted the function to pointfree in the f...
stackexchange_codegolf
Background I feel that for a site named code-golf we have a shockingly little amount of golf being played. Let's fix that. Challenge Determine whether the hole of a minigolf course can be reached after exactly a certain number of movements and whether it can be reached at all. How to play Inputs are an integer "power l...
stackexchange_codegolf
Dice Cricket is a game I was introduced to as a child and have used as a way to pass time for years since. I couldn't find a Wikipedia page so I'll explain the rules below. Dice Cricket Rules Premise Dice Cricket is a game similar to scoring a game of cricket as you watch it but rather than watching and recording the r...
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
Your goal is simple: the program must turn the screen of your computer totally black. After the program is started, the screen must quickly turn completely black, and remain so until the program is exited (any key, or alt+F4, mouse movement, etc.), after which things should turn back to normal. So shutting down the co...
stackexchange_codegolf
Is the path correct ? Given a string, your program must determine whether or not Alice can reach Bob, following the signs on the map. You must return a truthy or falsy value. The input string will contain the following characters : (space) and \n. Only used for padding. >, <, ^, v, are the "signs". They show the dire...
stackexchange_codegolf
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running program B in language A produces program C. Program C, when run in language A or language B, prints "Wrong language!". Prog...
stackexchange_codegolf
Create a script that, when run from a console, will display the text already in the console, prior to running. Challenge How will the winner of the challenge will be determined? The golf with the shortest length (in bytes) will win. Example Input and Output Input: (Shown is Windows) Microsoft Windows [Version 10....
stackexchange_codegolf
Given \$A = (a_1,\dots,a_k)\ k\ge2 \$ a sequence of positive integers, in which all elements are different. Starting from \$i=2\$, while \$a_i\in A:\$ (until the last element) If \$d=|a_i-a_{i-1}|\$ is not already in \$A\$, append \$d\$ to \$A\$ Increase \$i\$ Output the completed sequence. This is code-golf Example ...
stackexchange_codegolf
This is a pretty run of the mill question. I will define a sequence and you golf some code to output a entry given a index. The first item in the sequence is 2. The nth item in the sequence is the smallest positive integer other than n and 1 sharing at least one factor with n (other than 1) that has not already appea...
stackexchange_codegolf
Output the infinite list of pairs of integers (a, b), where both \$ a > 1 \$ and \$ b > 1 \$, ordered by the value of \$ a^b \$. When there are multiple pairs where \$ a^b \$ is equal, they should be ordered lexicographically. For example, \$ 2^4 = 4^2 = 16 \$, but (2, 4) should come before (4, 2), because it is lexico...
stackexchange_codegolf
So, here's a map of, let's say, a dungeon... ########## # ##### # ##### ########## ########## ########## ########## #### ## #### ## ########## Let's say that the hero is in Room A (at the top left) and their goal (a prince in distress?) is in Room B (to the bottom right). Our map does not allow the hero to...
stackexchange_codegolf
This is a relatively simple question. I'm trying to golf a Snake game I've written, and I'm trying to work out if there's a way to golf the following conditional assignments which control x and y coordinates of the snake ensuring a wrap around of the play area: if (P<0) { P = T-1; } if (P>T-1) { P = 0; } if (Q<0) {...
stackexchange_codegolf
Inspired by this challenge, which got closed. This is meant to be an easier, but no less interesting version of that. This is the robbers thread of a cops-and-robbers challenge. For the cops thread, see here. Cops will provide a program/function and a flag. Robbers will guess a password. When the password is given to t...
stackexchange_codegolf
Related You are a manager at a large number factory. You want to show everyone your business is doing well, by showing randomly chosen samples. Unfortunately, your business is not doing that well. But luckily, you have a bit of ingenuity... Write a program or function that when given an array of unique, positive numbe...
stackexchange_codegolf
What general tips do you have for golfing in sed? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to sed (e.g. "remove comments" is not an answer). Please post one tip per answer.
stackexchange_codegolf
Modern mathematics has been formalised using set theory by various systems of axioms. Zermelo Frankel set theory with the axiom of choice (ZFC) forms an intuitive set of axioms and is hence most popular, though stronger choices exist. Inspiration: A Relatively Small Turing Machine Whose Behavior Is Independent of Set T...
stackexchange_codegolf