instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
I was browsing Stack Overflow when I saw this post in Puzzling in the hot network questions and decided to make a challenge out of it (all credit goes to the creator of the challenge). Overview A Chess Number is a number that, when converted to base 18, results in a valid chess coordinate pair, where the first characte...
stackexchange_codegolf
Sandbox Given two positive integers a and b, return the smallest multiple of b that is greater than or equal to a. Examples Definitions: true = is a multiple of b, false = is not a multiple of b. f(1,3) = 3 because 1 is false, 1+1 is false, but 1+1+1 is true. Therefore 3 is returned. f(5,3) = 6 because 5 is false, but...
stackexchange_codegolf
Wouldn't it be neat if programming functions could be inverted, just like the mathematical function they implement? Write a function (or program) that takes one input x in any form, that outputs ln(x). When the bytes of the program are reordered/reversed so that the first byte now is the last byte, it should take one ...
stackexchange_codegolf
Your task is to create a program that determines whether a given string is a valid regular expression or not using code snippets sourced from sites on the StackExchange network. For the purposes of this challenge, the regular expression dialect will be a stripped down and mostly minimal set of meta-characters: ()*?|\. ...
stackexchange_codegolf
Background You have again been given the task of calculating the number of landmines in a field. However, we have now travelled into the flatlands. You must calculate the landmine score given a list/string of numbers (which will be 2D) and the landmine number. The landmine number tells you where landmines are. For each...
stackexchange_codegolf
Imagine four people stand in a line. The first looks at a thermometer, and tells the temperature to the person on their right. This continues down the line, until the last person writes the temperature on a sheet of paper. Unfortunately, due to a miscommunication, every person in the line converts the temperature to th...
stackexchange_codegolf
For every given degree \$n\$ it is possible to construct (at least one) an integral polynomial \$p \in \mathbb Z[X]\$ such that \$p(k)\$ (\$p\$ evaluated in \$k\$) is the coefficient of the term \$x^k\$ in the polynomial for all \$0 \leqslant k \leqslant n\$. To make them unique, we require the leading coefficient (the...
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
Related: Determine the position of a non-negative number in the infinite spiral Wind me a number snake! Challenge: Given a grid, with an ID starting at the center and spiraling out, what is the ID given a position in the fewest number of bytes? Grid: +---------------+---------------+---------------+---------------+--...
stackexchange_codegolf
Your task is to print this exact text: אבגדהוזחטיכךלמםנןסעפףצץקרשת (You are allowed to print a trailing newline) SHA256 hash of the UTF-8 encoding of the text: 0ab6f1e0bf216a0db52a4a5a247f95cba6f51496de7a24dfd01f3985dfcf6085 Base64 encoding: 15DXkdeS15PXlNeV15bXl9eY15nXm9ea15zXnted16DXn9eh16LXpNej16bXpden16jXqdeq Ru...
stackexchange_codegolf
Background From Wikipedia: An Egyptian fraction is the sum of distinct unit fractions. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each other. The value of an expression of this type is a positive rational number ...
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
The partition function: In number theory, the partition function p(n) represents the number of possible partitions of a positive integer n into positive integers For instance, p(4) = 5 because the integer 4 has five possible partitions: 1 + 1 + 1 + 1 1 + 1 + 2 1 + 3 2 + 2 4 Your task: Accept an input (let's call i...
stackexchange_codegolf
Your challenge is given an input of a prison layout to work out whether any of the prisoners can escape. Input Input may be in any reasonable format such as a string, array, array of arrays etc. The input will consist of three characters, in this case #, P and space. The input will not necessarily contain all three cha...
stackexchange_codegolf
In this challenge, you'll calculate how great your land is. Write a program or function that calculates the size of your land, given a wall you have built. You're given a non-empty input string containing a set of 4 distinct characters of your choice that represent the four directions "up", "down", "left" and "right" ...
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
The goal of this challenge is to compare how well different programming languages support functional programming, by seeing how much code it takes to implement BLC8, the simplest functional programming language BLC8 is the bytewise variant of Binary Lambda Calculus, as described in my 2012 IOCCC entry at https://www.io...
stackexchange_codegolf
Inspired by this comment chain... I wanna enklact my way out of this challenge but I can't... @ETHproductions to enklact (v): to implement a lookup table using a subsection consisting of unique elements. Enklacting is a very useful way to compress a lookup table. For example, let's say you had the following list of ...
stackexchange_codegolf
Your bird has been itching for some exercise and is sick of being stuck in static positions all the time. Write a program that will show a randomly dancing ascii bird, updating every 100ms*n or 200ms*n depending on the dance move. The bird always begins with the dance move <(")>. The program should accept one input whi...
stackexchange_codegolf
Introduction Emoji use a particular alphabet for their national flags, which allows one to put two symbols together to create the appropriate flag. Your challenge, is to transform any uppercase letter into the appropriate Flag Identifier. This may be much harder for languages that do not innately handle Unicode. Each ...
stackexchange_codegolf
your task is to write a program that uses the Lucas-Lehmer primality test to check whether an input number is prime or not. This prime number candidate has the form 2p-1 with p being prime. (Mersenne prime number) The Lucas-Lehmer-test The n-th Mersenne number is prime if it is a divisor of the (n-1)-th Lucas-Lehmer nu...
stackexchange_codegolf
A brace string is defined as a string consisting of the characters *()[] in which braces match correctly: [brace-string] ::= [unit] || [unit] [brace-string] [unit] ::= "" || "*" || "(" [brace-string] ")" || "[" [brace-string] "]" This is a valid brace-string: ((())***[]**)****[(())*]* But these are not: )( **...
stackexchange_codegolf
Given an integral polynomial \$p\$, determine if \$p\$ is a square of another integral polynomial. An integral polynomial is a polynomial with only integers as coefficients. For example, \$x^2+2x+1\$ should gives truthy, because \$x^2+2x+1 = (x+1)^2\$. On the other hand, \$2x^2+4x+2\$ should gives falsy: \$2x^2+4x+2 = ...
stackexchange_codegolf
A palindrome is a word which is spelled the same backwards and forwards. For example, "racecar" is a palindrome as is "redder". A double palindrome is a palindrome whose halves are also palindromes. For example, "abbabba" is a double palindrome, as the half "abba" is also a palindrome. Similarily, "abaababaaba" is a tr...
stackexchange_codegolf
Related From Wikipedia: In number theory, the Calkin–Wilf tree is a tree in which the vertices correspond one-to-one to the positive rational numbers. The tree is rooted at the number \$1\$, and any rational number expressed in simplest terms as the fraction \$\frac{a}{b}\$ has as its two children the numbers \$\frac{...
stackexchange_codegolf
Khinchin's constant is a curious mathematical constant that, according to Wolfram MathWold, is "notoriously difficult to calculate to high precision". Here it is to 100 digits: 2.685452001065306445309714835481795693820382293994462953051152345557218859537152002801141174931847697... Write a program in 64 bytes or less ...
stackexchange_codegolf
Your Goal: Given an odd integer input n greater than 1, generate a random English word of length n. An English word is one in which the odd (1-based) indices are consonants and the even (1-based) indices are vowels, the vowels being aeiou. Random For the purposes of this challenge, you are to sample from the vowels and...
stackexchange_codegolf
If you throw an ASCII egg in a given direction, you end up with an ASCII splat of size n. It "starts" with one o (the yolk), and continues in a given direction with "lines" consisting of 2 up to n *'s. The *'s are separated by one "space", and the o and all the "lines" of *'s are separated by "lines" of "space". The di...
stackexchange_codegolf
This is taken from this question (with permission ofcourse). I'll quote: Create a function which takes a string, and it should return true or false based on whether the input consists of only a repeated character sequence. The length of given string is always greater than 1 and the character sequence must have a...
stackexchange_codegolf
I've been enslaved in a quine factory. The other workers and I can't communicate with the outside world, we can only slave away making quines all day. The masters will reject any work that isn't a proper quine. I'll have to put messages into the quines I make to let people know we're trapped here. The Challenge Help us...
stackexchange_codegolf
Imagine you have a positive integer number \$n\$. Let \$m\$ be the number obtained by reversing \$n\$'s digits. If \$m\$ is a whole multiple of \$n\$, then \$n\$ is said to be a reverse divisible number. If neither are a palindrome, \$m\$ is called a palintiple. For example, \$1089 \cdot 9 = 9801\$, so \$9801\$ is a pa...
stackexchange_codegolf
Suppose you have a set of sets of integers. It's possible that some of the sets will overlap (i.e. sharing elements). You could get rid of the overlaps by deleting elements from the sets, but then some of them might end up empty; that would be a shame. Can we make all the sets disjoint without emptying any of them? Not...
stackexchange_codegolf
In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing Complete...in other words, allow it to do any computation possible with any other language. In this challenge, we'll be doing somewhat of the opposite, and finding the minimum numbe...
stackexchange_codegolf
You will be given a string s. It is guaranteed that the string has equal and at least one [s and ]s. It is also guaranteed that the brackets are balanced. The string can also have other characters. The objective is to output/return a list of tuples or a list of lists containing indices of each [ and ] pair. note: The s...
stackexchange_codegolf
Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's sa...
stackexchange_codegolf
Here's a very simple little problem that I don't believe has been asked before. Challenge Write a program or a function that takes in four positive integers that represents the lengths of movable but unbreakable and unbendable straight fences. Output the area of the largest rectangular yard that can be fully encompasse...
stackexchange_codegolf
Challenge Hi, given a string as input, remove any salutations found at the start of the string. The program which performs the most correct substitutions in under 50 bytes wins. Salutations Hey, a salutation is defined as one of the following words: hi hey hello dear greetings hai guys hii howdy hiya hay heya hola hih...
stackexchange_codegolf
Pyramid Scheme is a language being developed by @ConorO'Brien. In Pyramid Scheme, the code that you write looks like this: ^ ^ / \ /3\ / \ --- / + \ ^-------^ /9\ /3\ /123\ --- ----- Now, that code has two obvious qualities: It's difficult to parse, and it's difficult...
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
Introduction A pentagonal number (A000326) is generated by the formula Pn= 0.5×(3n2-n). Or you can just count the amount of dots used: You can use the formula, or the gif above to find the first few pentagonal numbers: 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc... Next, we nee...
stackexchange_codegolf
I have been recently told to read an entire physics textbook by the new year (true story, unfortunately). I need your help to determine what chapters I should read each day. This is where you come in. Input Two dates, in any format. The second date will always be later than the first. A list of chapter numbers. This c...
stackexchange_codegolf
This challenge is based on actual collision detection I had to write for a simple game recently. Write a program or function which, given two objects, returns a truthy or falsy value depending on whether the two objects are in collision (i.e. intersect) or not. You need to support three types of objects: Line segments...
stackexchange_codegolf
Originally from a CMC I proposed for the last BMG event Challenge Given a non-negative integer \$n\$, create a 2D array of size \$2^n × 2^n\$ which is generated in the following manner: Divide the matrix into four quadrants of size \$2^{n-1} × 2^{n-1}\$. Visiting order of the four quadrants is defined to be the Z-shap...
stackexchange_codegolf
Skat I'm a fan of anagrams, so given two strings s1 and s2 write a program or function that outputs a truthy value if s2 is an anagram of s1, and a falsey value otherwise (not accounting for spaces and capital letters). For example: Input: s1 = "Anagram"; s2 = "Nag a ram" true Input: s1 = "stack overflow"; s2 = "fewe...
stackexchange_codegolf
Given a word, decide if it is an ambigram. When rotated: b > q d > p l > l n > u o > o p > d q > b s > s u > n x > x z > z Assume only lowercase letters as input. Test input: this, another, lll, lol, dad, dab, dap, wow, ooi, lollpopdodllol, Ones That Should Return Truthy Values: lll, lol, lollpopdodllol, Note tha...
stackexchange_codegolf
Sequel to Verify Tents and Trees solution. Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no two tents touch each other in 8 directions (horizontally, vertically, and diag...
stackexchange_codegolf
Here is a list of 30 English nouns in their singular and plural form. Your job is simply to write the shortest regular expression that matches all the nouns in one form and none in the other (easy, all English nouns end in s in plural form right?). SINGULAR PLURAL --------- -------- car cars boat ...
stackexchange_codegolf
The rundown Create a program that generates an array of random length with random numbers, then apply a series of rules that alter the array. After the rules have been applied, print the sum of the array unless specified otherwise Array setup The array must be a random length between 5 and 10 inclusive, with random int...
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
Background The special linear group \$ SL_2(\mathbb{Z}) \$ is a multiplicative group of \$ 2 \times 2 \$ matrices whose elements are integers and determinant is 1. It is known that every member of \$ SL_2(\mathbb{Z}) \$ is a product of some sequence of the following two matrices \$ S \$ and \$ T \$ (reference pdf): $$ ...
stackexchange_codegolf
Introduction There is an Apple tree trunk positioned between -2 to 2 on the x-axis, where some apples fall down around it: | | | | <-------|---|-------> -2 2 Everyday, n apples fall down. Each apple maintains its x coordinate as falls straight to the ground. But if it lands on top of anoth...
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
Your task is to write a program which prints following four verses extracted from the lyrics from The Beatles' song "Hey Jude" (© Sony/ATV Music Publishing LLC): Hey Jude, don't make it bad\n Take a sad song and make it better\n Remember to let her into your heart\n Then you can start to make it better\n \n Hey Jude, d...
stackexchange_codegolf
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 to run, obviously the baseline is set at while(1>0)/*stmt*/ or 10 additional characters for a single line and while(1>0)...
stackexchange_codegolf
Background This is Post's lattice: Credit: EmilJ It denotes the lattice of all clones on a two-element set {0, 1}, ordered by inclusion (from Wikipedia). That can be a bit of a mouthful so lets look at a concrete example. MP (located near the top) is a set that contains all boolean circuits that can be made with and a...
stackexchange_codegolf
World Bowling scoring Many people have gone to their local bowling center to play a few games of bowling, and many people continue to struggle to calculate their scores. World Bowling has introduced a simplified scoring system in order to attract more people to the sport. This scoring system is utilized in internation...
stackexchange_codegolf
Your goal is to write a hash function, that accepts morse code character and returns a hash code that you get to define. You can be sure, passed string will be: One of the Latin characters (A-Z) encoded into Morse Code using . and -, or One of the digits (0-9) encoded into Morse Code using . and -, or Empty So, there...
stackexchange_codegolf
There are radiation hardened quines, palindromic quines, but has anyone tried both?! I think not! Rules So the challenge here is to make a quine that if any symbol is deleted it prints its original source code, and the quine needs to be the same read forward and backwards(before radiation damage)! All code will be scor...
stackexchange_codegolf
You are fish in a pond that needs to survive by eating other fish. You can only eat fish that are the same size or smaller than yourself. You must create a program that takes a shoal of fish as sorted input. From this you must work out how many fish you can eat and ultimately the size you will grow to. Size chart +----...
stackexchange_codegolf
Background Alice and Bob play a game called construct a binary word. To play the game, you fix a length n >= 0, a set G of length-n binary words called the goal set, and a length-n string t containing the letters A and B, called the turn order. The game lasts for n turns, and on turn i, the player defined by t[i] selec...
stackexchange_codegolf
Taken from StackOverflow Question Challenge Given an encoded string in format n[s] where n is the amount of times s will be repeated, your task is to output the corresponding decoded string. n will always be a positive number s can not contain empty spaces strings only contains letters from the alphabet s length can b...
stackexchange_codegolf
In the 1990s, COBOL computer engineers worked out a way to extend six-digit date fields by converting them to YYYDDD where YYY is the year - 1900 and DDD is the day of the year [001 to 366]. This scheme could extend the maximum date to 2899-12-31. In the year 2898, the engineers started panicking because their 900 yea...
stackexchange_codegolf
An Izhikevich neuron is a simple yet quite effective model of a biological neuron, designed for use in a discrete time-stepping simulation. In this golfing challenge, you will be implementing this model. Parameters This model involves only 7 variables organized into 2 differential equations, compared to the dozens of p...
stackexchange_codegolf
Normal brackets ((),[],<> and {}) are nice and unambiguous, however someone thought it would be a good idea to use non bracket characters as brackets. These characters, | and ", are ambiguous. For example does """" correspond to (()) or ()() It is impossible to tell. Things start to get interesting when you mix ty...
stackexchange_codegolf
Print or return the following text: Hello world! The quick brown fox jumps over a lazy dog. However, your submission will not be scored in bytes. Instead, primarily it will be scored by the width in pixels of the program when written in Arial in a 12pt font. In particular, the score is: $$ (\text{visual width in px}) ...
stackexchange_codegolf
This is an answer-chaining post, so in this challenge every answer (except the first answer) depends on the previous answer. The goal of this challenge is to output the restricted characters. The restricted characters are the most common n - 1 characters of all answers, if happens to be a tie, then the characters with ...
stackexchange_codegolf
Given a text like this: # #### ## # ## # ## # #### ## Output the same text but by connecting the pixels with the characters ─│┌┐└┘├┤┬┴┼. If a pixel doesn't have any neighbours, don't change it. So the output of the last text is: │ ─┬── ┌─ │ └─ │ ┌┘ │ └──┘ ─┘ You can take input as a boolean array. The inp...
stackexchange_codegolf
Let's define a 2-quine as a program that prints its source code two times. For example, if the program ABC printed ABCABC, it would be a 2-quine. Let's define a 3-quine as a program that prints its source code three times. For example, if the program ABC printed ABCABCABC, it would be a 3-quine. Let's define a n-quine...
stackexchange_codegolf
Your task is to create a program or function which randomly errors. Specifically, there must be a nonzero probability of erroring, but also a nonzero probability of running without error. An error is anything that causes a program to terminate abnormally, such as dividing by zero or using an uninitialized variable. Thi...
stackexchange_codegolf
Given a string as input, determine whether it is a noun or not. You will be scored on the 1000 most common English words, by how many you correctly label as a noun or not. The program or function which correctly classifies the most of those words in 50 bytes or less will win. Nouns A noun is a word that represents a th...
stackexchange_codegolf
Write the shortest possible program or function that will join a list of columnar strings. For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, is separated by a newline character. Some examples, separated by ---: a b c d...
stackexchange_codegolf
Background Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) Also, same cell can't be used more than once in a word...
stackexchange_codegolf
A number spiral is an infinite grid whose upper-left square has number 1. Here are the first five layers of the spiral: Your task is to find out the number in row y and column x. Example: Input: 2 3 Out : 8 Input: 1 1 Out : 1 Input: 4 2 Out : 15 Note: Any programming language is allowed. This is a code-golf cha...
stackexchange_codegolf
The Reuleaux triangle is the shape formed by the intersection of three circles, with each circle passing through the others' centers. Regardless of rotation, a Reuleaux triangle's width will always equal the radius of the circles: Image: Wolfram MathWorld Write a program that takes a width r as input and displays a Re...
stackexchange_codegolf
What are some tips for code-golfing in Swift? Its focus on safety seems to make it difficult to golf in, but that makes little tips and even more useful. Are there any features in Swift that may help it excel in code-golf in certain applications? Please post one tip per answer.
stackexchange_codegolf
The Euclidean GCD Algorithm is an algorithm that efficiently computes the GCD of two positive integers, by repeatedly subtracting the smaller number from the larger number until they become equal. It can be visualised as such: We start with a MxN grid, where M and N are the numbers. In this example I'll use M=12, N=5: ...
stackexchange_codegolf
Given a string, your task is to collapse it into a zigzag-like structure as described below. Folding into a Zigzag We'll take the string "Mississippi" as an example: First, output the longest prefix consisting of unique characters only: Mis When you reach the first duplicate character C, ignore it, and output the lo...
stackexchange_codegolf
For example, if n is 5 and r is 2, it would mean the number of lists below: [1,1,1,1,1] [1,1,1,2,2] [1,1,2,2,2] [2,2,1,1,1] [2,2,2,1,1] [2,2,2,2,2] which is 6. If n is 4 and r is 3: [1,1,1,1] [1,1,2,2] [1,1,3,3] [2,2,1,1] ... [3,3,3,3] which is 9. where each item has a neighbour whose value is the same. For example, ...
stackexchange_codegolf
Given dimensions of a 2D array, except 1xn, that results in an odd number of elements, find the midpoint index. Example: Input is 3x5, representing the 2D array [0,0] [0,1] [0,2] [0,3] [0,4] [1,0] [1,1] [1,2] [1,3] [1,4] [2,0] [2,1] [2,2] [2,3] [2,4] The midpoint index is [1,2] Input 3 5 Output 1 , 2 Rules Stand...
stackexchange_codegolf
The Challenge Your task is to create a program that takes any given string input, and outputs the input in a squared format. Empty strings should return an empty string. Examples Given the input: golf Your program should output: golf o l l o flog Input: 123 Output: 123 2 2 321 Input: a Output: a Input: Hello, w...
stackexchange_codegolf
In chemistry class, we were learning about titrations, and attempting one as a lab. We were using phenolphthalein as the indicator for the titration, so on top of grading the lab normally, my teacher held a little contest to see who had the lightest shade of pink, and thus the most accurate transition. Your task is to ...
stackexchange_codegolf
A doubling sequence is an array of numbers where each subsequent number is at least twice the previous number. Given an ordered list of numbers, determine if the numbers in the list (\$n_{x}\$) have the property that: \$n_1 \times 2 \le n_2\$ \$n_2 \times 2 \le n_3\ ...\$ and so on until reaching the end of the list. I...
stackexchange_codegolf
Input: A valid 6 HEX digit color code wihout a # prefix Valid: 000000 FF00FF ABC123 Your job is to find to which one of these: Red: FF0000 Green: 00FF00 Blue: 0000FF White: FFFFFF Black: 000000 the input color is the closest too, in this case you try to only match it to black or white when the RGB is the same v...
stackexchange_codegolf
You're a plumber working on a house, and there's some pipes that must be connected at weird angles. You have 8°, 11.25°, 22.5°, 45°, and 90° fittings at your disposal, and you want to use as few as possible to match the angle as closely as possible. Goal Match the desired angle as closely as possible, with as few fitt...
stackexchange_codegolf
Links Chat room The official game report Github repo - In case of bugs to report Here's the official score table: <script src="https://ajfaraday.github.io/nose_poker/ogres.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><table> <thead> <tr> <th>Ogre</th> <th>Han...
stackexchange_codegolf
A set of dominoes consists of tiles with two numbers on them such that every combination of integers from 0 to N are represented. Examples below refer to N=6 out of convenience, but N=9 and N=12 are also common. The orientation of the tiles does not matter (they are usually printed with dots rather than digits), so [1-...
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
Challenge You need to generate a program or function that takes in a positive integer N, calculates the first N terms of the Fibonacci sequence in binary, concatenates it into a single binary number, converts that number back to decimal, and then outputs the decimal as an integer. For example 1 -> [0] -> 0 to decimal o...
stackexchange_codegolf
Your task is to make a bidirectional compressor. It takes a list of bytes as input and returns a list of bytes as output. It has the property than whenever it is iterated twice it returns the original input. In other words, if f is your program as a function, then f(f(x))=x for all x. Now, since this is a "compressor",...
stackexchange_codegolf
I have the following Haskell code to generate the the values of the Fibonacci sequence which are even as an infinite list: z=zipWith(+) g=z((*2)<$>0:0:g)$z(0:g)$(*2)<$>scanl(+)1g This works by starting with 0,2 and then defining every following term to be the sum of: twice all prior terms the previous term twice the ...
stackexchange_codegolf
Recently a friend of mine posed the following: What subset of the integers satisfies the condition if distinct a and b are in the subset, their average is not in the subset? I know the set of non-0 squares satisfies the condition, but I wonder if there exists a more... dense set that satisfies the condition. (It turn...
stackexchange_codegolf
Input A string S of length between 10 and 16 inclusive. The characters are taken from the 95 printable ASCII characters, byte values 32 (0x20) to 126 (0x7E) ( to ~) Output Your code must compute and output all strings within Levenshtein distance 2 of S. You can have duplicates as long as you also have all the differen...
stackexchange_codegolf
An Abjad is a writing system where each symbol stands for a consonant, and where vowels are omitted. An impure Abjad is an abjad in which there are additionals symbols for vowels, usually diacritics. Write a program or function that, given a string of lowercase text (i.e. nothing but ASCII letters from a to z, commas a...
stackexchange_codegolf
This challenge is in honor of mathematician John Conway who passed away April 11, 2020 due to COVID-19. He was famous for coming up with the Game of Life cellular automaton and many other mathematical contributions such as the surreal numbers and the monster group. The advanced math of those topics is out scope for thi...
stackexchange_codegolf
I want to be down with the kids of the 1990's and start speaking this L33T speak of their's. For any given input I would like the resulting L33T speech as an output. I don't want to go to far down the rabbit hole so let's start simple. Consider the following replacements: B or b = 8 E or e = 3 I or i = 1 S or s = 5 Let...
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 is similar to simplifying fractions, but with Dates! The input of your program must be of the form mm/dd For example 3/4 //March 4 12/15 //December 15 1/1 // January 1 We assume that the input will be valid such that the months have these numbers of days in them: January 31 February 28 March 31 April 30 May 31 Ju...
stackexchange_codegolf
Minesweeper is a puzzle game where mines are hidden around a board of nondescript tiles with the goal of identifying the location of all mines. Clicking on a mine loses the game, but clicking on any other tile will reveal a number from 0-8 which signifies how many mines directly surround it. Given a number, you must di...
stackexchange_codegolf
Given a lower case string. Ex: s = 'abcdefghijklmnopqrstuvwxyz' The goal is to make every other vowel uppercase. Desired output here: abcdEfghijklmnOpqrstuvwxyz As you can see, from aeiou, \$`e`\$ and \$`o`\$ get uppercased. For aeiou, the desired output is: aEiOu There are only lowercase characters in the strings i...
stackexchange_codegolf
...will you help me immortalize it? I've had this pillow a few years now, and apparently it's time to get rid of it. Can you please write a function or program, that I can bring with me and use to recreate this pillow whenever I want to reminisce a bit. It must work with no input arguments. The output should look exa...
stackexchange_codegolf