instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Given two non-zero 16-bit integers a and b, decide the smallest number of shift operations needed to turn a into b. A shift is one of the following (big-endian) operations: shl (shift left): move all bits to the left, adding a 0x0 bit to the right. shr (shift right): move all bytes to the right, adding a 0x0 bit to th...
stackexchange_codegolf
A numerical polynomial is a polynomial \$p\$ in one variable with rational coefficients such that for every integer \$i\$, \$p(i)\$ is also an integer. The numerical polynomials have a basis given by the binomial coefficients: $$p_n = {x \choose n} = \frac{x(x-1)\cdots(x-n+1)}{n!}$$ For instance: \$p_0 = 1\$ \$p_1 = x\...
stackexchange_codegolf
Introduction: I think we've all heard of it, but here a very brief summary: Noah gathered two of every species of animal on the planet, male and female, to save in his Ark during a great flood. The actual quote from the Bible is: Genesis 7:2-3 You must take with you seven of every kind of clean animal, the male and it...
stackexchange_codegolf
Intro Two numbers are a reversed multiple pair if they satisfy the following property: $$ a\cdot b = \operatorname{reversed}( (a-1)\cdot b ) $$ Here, \$\operatorname{reversed}()\$ means to reverse the digits of a number (e. g 123 becomes 321.) Example $$ a=6,\quad b=9,\quad 6\cdot 9=54,\quad 5\cdot 9=45 $$ As you can ...
stackexchange_codegolf
In this challenge we considered a frog hopping around a lily pond. To recap the lily pond was represented as a finite list of positive integers. The frog can only jump forward or backwards by a distance equal to the number at its current location. So for example: [2, 3, 1, 4, 1] Here the frog is on a 1 so i...
stackexchange_codegolf
See also: Rotatagons Challenge Given a string as input, output its wordagon. Wordagons A wordagon is a way of representing a string in a hexagon. Now, let's create a wordagon from the string hexa: Firstly, you start with the first character in the string a place it in the centre: h Then, you take the next character in...
stackexchange_codegolf
Problem John bought 5 apples. You are given the weights of every group of four apples, and must then find the weights of the apples themselves. For example, if all apples without the first one weigh 798 g, without the second - 794 g, without the third - 813 g, without the fourth - 806 g, and without the fifth - 789 g, ...
stackexchange_codegolf
Given a non-empty string, keep removing the first and last characters until you get to one or two characters. For example, if the string was abcde, your program should print: abcde bcd c However, if it was abcdef, it should stop at two characters: abcdef bcde cd Trailing newlines and trailing spaces at the end ...
stackexchange_codegolf
The primorial \$p_n\#\$ is the product of the first \$n\$ primes. The sequence begins \$2, 6, 30, 210, 2310\$. A Fortunate number, \$F_n\$, is the smallest integer \$m > 1\$ such that \$p_n\# + m\$ is prime. For example \$F_7 = 19\$ as: $$p_7\# = 2\times3\times5\times7\times11\times13\times17 = 510510$$ Adding each num...
stackexchange_codegolf
In most programming languages, arithmetic is written with infix notation -- i.e. the operator is put in between the operands -- e.g. 1+2. In contrast, with Polish notation (a.k.a prefix notation), the operator comes before the operands -- e.g. +1 2. As long as the number of operands for each operator is fixed, this mea...
stackexchange_codegolf
In the absurdist play Rosencrantz and Guildenstern are Dead, the two main characters Rosencrantz and Guildenstern(or are they?) are always mixing up which of them is who—or sometimes which of their own body parts is which—because of a perceived lack of individual identity. Wouldn't it be absurd if they even shuffled ar...
stackexchange_codegolf
Challenge Given a binary number as input through any means, "simplify" the number using a full program or a function. Input [binary] binary is a number in binary that is over 0. Output Take the input, convert it to base 10 without using a builtin, then if that number contains only 1s and 0s, convert it into a base 1...
stackexchange_codegolf
Cops post A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string: Split the string into equal sections. Reverse the string, and starting from the start of each string. Put ru...
stackexchange_codegolf
Consider, for a given positive integer \$k\$, the sequence \$(a, a+1, a+2, ..., a+k)\$, where \$a\$ is some positive integer. Is there ever a pair \$a, k\$ such that for each element \$a+i\$ in the sequence, either \$\gcd(a, a+i)\$ or \$\gcd(a+i, a+k)\$ are greater than 1? This was investigated by Alan R. Woods as part...
stackexchange_codegolf
The Fibtraction sequence (as I call it) is similar to the Fibonacci sequence except, instead of adding numbers, you subtract them. The first few numbers of this challenge are: 1, 2, -1, 3, -4, 7, -11, 18, -29, 47, -76, 123, -199, 322, -521, 843, -1364... The sequence starts with 1 and 2. Every next number can be calcu...
stackexchange_codegolf
Background Set is a card game. The deck consists of 81 unique cards that vary in four features: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple). For convenience, let's write a card as a 4-tuple of numbers from 1 to 3, e.g. 111...
stackexchange_codegolf
The keyboard layout people commonly use is the QWERTY layout as shown below. But there are also other keyboard layouts: DVORAK COLEMAK WORKMAN Your task Your code will take two inputs: the name of the keyboard layout and a string to transcribe. Your goal is to convert your QWERTY input as if you were typing with t...
stackexchange_codegolf
Given a string, you've to split it into groups of three characters (by padding _ at the end). Related, but still it's different. Sample I/O: 'abcde' -> 'abc', 'de_' '1234' -> '123', '4__' '' -> [] or falsey value 'Three spree!' -> 'Thr', 'ee ', 'spr', 'ee!' 6 MB string This is a code-golf, so fewest bytes wil...
stackexchange_codegolf
I know, I know, yet another primes challenge... Related A lonely (or isolated) prime is a prime number p such that p-2, p+2, p-4, p+4 ... p-2k, p+2k for some k are all composite. We call such a prime a kth-times-isolated prime. For example, a 5th-times-isolated prime is 211, since all of 201, 203, 205, 207, 209, 213, 2...
stackexchange_codegolf
Given a nonnegative integer \$n\$, determine whether \$n\$ can be expressed as the sum of two square numbers, that is \$\exists a,b\in\mathbb Z\$ such that \$n=a^2+b^2\$. 0 -> truthy 1 -> truthy 2 -> truthy 3 -> falsy 4 -> truthy 5 -> truthy 6 -> falsy 7 -> falsy 11 -> falsy 9997 -> truthy 999...
stackexchange_codegolf
Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise. 0, 1, and 8 have rotational symmetry. 6 becomes 9 and vice versa. Sequence of numbers producing truthy results: OEIS A000787 0, 1, 8, 11, 69, 88, 96, 101, 111, 181, 609, 619, 689, 808, 818, 888, 906, 916, 98...
stackexchange_codegolf
TL;DR: Given an array of chars and a robot in a starting position of the array, write an algorithm than can read a string with movements (F for "go forward", R for "rotate 90 degrees right" and L for "rotate 90 degrees left") and calculate the ending position of the robot. More details in the complete text. We have a...
stackexchange_codegolf
The Matoran Alphabet is the alphabet used by many of the characters in the Bionicle universe. Your challenge is to create a program or function that takes a string as input and creates an image of the input written in the Matoran alphabet. The input will only consist of uppercase letters (A-Z), numbers (0-9), and spac...
stackexchange_codegolf
Some chess variants use interesting non-standard pieces. In order to concisely describe new pieces or to describe pieces without requiring everyone to memorize a bunch of non-standard names some new notation can be invented. In this challenge we are going to look at Parlett's movement notation and convert it to nice at...
stackexchange_codegolf
The Challenge Given two vertexes and a point calculate the distance to the line segment defined by those points. This can be calculated with the following psudocode def dist(point, v1, v2): direction := normalize(v2-v1) distance := length(v2-v1) difference := point - v1 pointProgress ...
stackexchange_codegolf
Write a few lines of Python code, X, that does not reference any global variables, such that def method(): X print(a) method() prints 1 but def method(): X X print(a) method() prints 2. So, I hate to be a stickler, but it seems like vars and locals are actually global variables in Python: def t...
stackexchange_codegolf
Before you leave, you do not have to understand much musical notation to do this challenge. EXPLANATION In standard sheet music, double clefs go across the page serving as reference points to the notes, letting you know what note should be played. If you are not already familiar with the treble and bass clef, here i...
stackexchange_codegolf
Happy New Year 2024! 2024 is a tetrahedral number. A tetrahedral number is a number that can be represented in the form \$n(n+1)(n+2)/6\$ for some positive integer \$n\$. Or, equivalently, they are the sum of the first \$n\$ triangular numbers. They are also the number of objects in a triangular pyramid which has \$n\$...
stackexchange_codegolf
This challenge is about implementing Shm-reduplication, originating in Yiddish, where one takes a word, duplicates it, and replaces the first syllable in the second word with "Shm" in order to indicate that one does not care. Some examples include: "Isn't the baby cute?", "Eh, baby shmaby" "Come buy from my store, we ...
stackexchange_codegolf
Given a setup of dominoes your task is to figure out which dominoes fall and which don't. Input Take a rectangular ASCII representation of a domino setup. The following characters are used for the ASCII grid: (space): empty cell |, -, /, \: dominoes Dominoes can fall in 8 directions, which are represented by the fol...
stackexchange_codegolf
On a recent episode of QI, the first 5 multiples of 142857 were described as anagrams of the original number. Of course, anyone with more than a passing knowledge of that number will know that those numbers are actually cyclic, not just anagrams. But that got me thinking. Please write a program or function that outputs...
stackexchange_codegolf
Drunkard's Journey Home In this challenge you are to write a program which simulates a drunkard stumbling his way home from the bar. Input: The input will be an adjacency matrix (representing a directed graph) which represents paths the drunkard can take. At each location, the drunkard will choose one path at random (E...
stackexchange_codegolf
The task is simple, given two IP adresses a and b, output all addresses within that range. Examples Example #1: f(a = 192.168.0.1, b = 192.168.0.4) 192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4 Example #2 (TIO will truncate this, use a smaller range when testing): f (a = 123.0.200.0, b = 124.0.0.0)...
stackexchange_codegolf
IUPAC in their insufferable wisdom have created a systematic element name for any newly created element. This is the temporary name of an element until they finally make up their minds about an actual name. It works like so: each digit of an element number is assigned a prefix based on its value. The prefixes are conca...
stackexchange_codegolf
Introduction In this challenge you will be solving diagonal Burrows-Wheeler transforms. Here is a general overview of what a diagonal Burrows-Wheeler transform is. To encode a message, you first must guarantee that it is odd in length (i.e. 5, 7, 9, etc.). Then you make a grid, n by n, where n is the length of the mess...
stackexchange_codegolf
Related: Deck Names Friends or Foes Paying for Spells The Magic: the Gathering card game has five colours of magical mana: white (W), blue (U), black (B), red (R), and green (G). Cards can be any of the \$2^5=32\$ subsets of these colours. Hereafter 'colours' refer just to the initials W, U, B, R, G. The order that the...
stackexchange_codegolf
The challenge is to write codegolf for the permanent of a matrix. The permanent of an \$n\times n\$ matrix \$A = a_{i,j}\$) is defined as $$\text{perm}(A) = \sum_{\sigma \in S_n} \prod^n_{i=1} a_{i,\sigma(i)}$$ Here \$S_n\$ represents the set of all permutations of \$[1, n]\$. As an example (from the wiki): $$\text{per...
stackexchange_codegolf
Background As far as we can tell from trying everything (besides cheating with ZWSPs), you can't type `\ in Stack Exchange chat. However, you can type \` by doing `\\``. So, if you want to tell someone in chat how to type backslash-backtick, you'd need to type out `\`\\`\`` to format `\\`` into a codeblock. Challenge Y...
stackexchange_codegolf
Note: This is based on Two roads diverged in a yellow wood (part 2), a previous challenge of mine. Because of the popularity of that question and Two roads diverged in a yellow wood (part 1), I wanted to make a third. But the first 2 were too easy (a 2-byte answer on the first, a 15-byte answer on the second.) So I ma...
stackexchange_codegolf
The title is an homage of the Natural Number Game, which is a nice interactive tutorial into proving certain properties of natural numbers in Lean. The definitions used in Lv1 will be reused here. I've done some improvements: Now it starts with import tactic, which means you can freely use powerful mathlib tactics. I...
stackexchange_codegolf
Introduction A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. For example, abcb is a perfect word because 1 + 2 + 3 + 2 = 8, and 8 / 4 = 2. Your task Given a word as input, output w...
stackexchange_codegolf
Let's have a list of positive integers [6,1,9,3,7,4,6,3,2,7,6,6] this will represent a river. We would like to skip a stone across this river. We can throw the stone as far as we want and whatever number it lands on it will skip that many places. So if we start by throwing it 2 spaces, it will land on the 1 skip fo...
stackexchange_codegolf
This is a overhaul of this now deleted question by ar kang. If the OP of that question would like to reclaim this question or has a problem with me posting this I'd be happy to accommodate Given a list of integers as input find the maximum possible sum of a continuous sublist that starts and ends with the same value....
stackexchange_codegolf
Introduction Sisyphus was having some troubles at work lately. It seems he just never gets anything done, and he would love to find a solution to this problem. His current employment requires rolling a rock up a hill. He usually does his job well, but every time he is near the top of the hill it rolls down again. He is...
stackexchange_codegolf
It's friday! Which means it's time for beer! Sadly though, today we will be golfing beer instead of drinking it. :( Challenge Output a beer and drink it. The amount of sips you take changes your output. Sips Your program should take one input string. This string can solely consist out of concatenated sips. If the input...
stackexchange_codegolf
Consider the Atbash transformation: A|B|C|D|E|F|G|H|I|J|K|L|M Z|Y|X|W|V|U|T|S|R|Q|P|O|N Where A ⇔ Z and L ⇔ O, e.g. There is an interesting property that some words share. When some strings are translated to their atbash-equivalent, said translation is the original word reversed. I call these Atbash Self Palindromes. ...
stackexchange_codegolf
I see GolfScript, Pyth, CJam and similar languages can make compex-ish algorithms in few bytes. This terseness makes think about genetic programming applications (using said languaes as the thing being mutated). I assume that to make a good GP language, it should have following characteristics: Programs are typically ...
stackexchange_codegolf
Dialogue by a 3Der. I was hired by Sr. 4Der to learn the 4D universe and I was willing to get to know more about it. But since I am a 3Der, I wouldn't see him, nor would I know how the real shapes look like. All I can do is illustrate. Sr. 4Der is pretty much invisible to us. We can't see him, but we can hear his voi...
stackexchange_codegolf
Your task here is to take a LifeOnTheEdge pattern and convert it to LifeOnTheSlope. A LifeOnTheEdge pattern is composed of these four characters: |_L . A pattern corresponds to a certain arrangement of "on" edges in a square grid. The pattern is placed in the grid first with the characters in the cells, and each of the...
stackexchange_codegolf
So you want to create a haiku, but you're not sure if it follows the syllable rules for a haiku. I couldn't be bothered to write a proper blurb like I usually do, so you'll have to make do with this. Let's get stuck right in. Finding a haiku out in the wild For the purposes of this challenge, we will be checking if the...
stackexchange_codegolf
Find what is the distance for a given string to its closest palindrome of the same length. For this task I decided to give the characters further away from the string's center more weight (think of it as contributing more torque), proportional to their distance to the center. Let's define the palindrome distance for a ...
stackexchange_codegolf
Output one random character for each character of source code (as illustrated below). The probability of each character is its frequency in the original source code. Thus the output will be fake source code resembling a quine. Specification Restrictions Standard quine constrains apply. No empty programs or functions....
stackexchange_codegolf
Exposition Your mathematics teacher is a big fan of Vieta's formulas, and he believes that you should use them to solve quadratic equations. Given the equation ax^2 + bx + c = 0 the product of its roots is c/a, and their sum is -b/a. When all of a, b and c are nonzero integers, assuming the roots are rational numbers,...
stackexchange_codegolf
In Emoji Math, a user created module for the video game Keep Talking And Nobody Explodes, numbers are written as strings of emoticons, where each emoticon represents a base 10 digit. Below is the conversion table between digits and emoticons. Digit | Emoticon 0 | :) 1 | =( 2 | (: 3 | )= ...
stackexchange_codegolf
Setup: For two sets \$A,B\$, we say \$A \subseteq B\$ if every element in \$A\$ is also in \$B\$. Another way of saying this, is that we can order the elements of \$A,B\$ into two lists \$L_A,L_B\$, such that \$L_A[i] = L_B[i]\$ where \$i\$ ranges over the indices of \$L_A\$. We proceed to extend this idea, to define ...
stackexchange_codegolf
Challenge Given a list of unique colour names as input, sort them in the order that they first appear in Joseph's Amazing Technicolour Dreamcoat. Example Input: green, blue, red, brown Output: red, green, brown, blue The full list of colours, in order, is: 1. red 2. yellow 3. green 4. brown 5. scarlet 6. black...
stackexchange_codegolf
You are given a bunch of ASCII test-tubes, your task is to reduce number of test-tubes used. Each test tube looks like this: | | | | | | |~~| | | | | | | | | |__| Obviously, ~~ is the water level. Test-tube can be also empty, in which case there are no ~~ characters inside. Single tube can contain up to 8 water...
stackexchange_codegolf
This is a Cops and Robbers challenge. For the Robbers' thread, go here. The Cops have three tasks. 1) Pick a sequence from the OEIS. 2) Pick a language (this is suggested to be a golflang, but doesn't have to be) that, when given input n, outputs A(n) (where A(n) is the sequence chosen) using all usual code-golf rule...
stackexchange_codegolf
Given a volume level V in the range 1-10. Your program should draw the following ASCII art. When V=1: \ | / When V=2: \ \ | | | / | / When V=3: \ \ | \ | | | | | / | | / | / And etc. Trailing spaces are allowed. This is a code-golf challenge so the shortest solution wins.
stackexchange_codegolf
This question is inspired by this answer. Coincidentally, I used to use Ethiopian Multiplication when I was a kid, but had never known the name of the method until recently. Ethiopian multiplication is a method of multiplying integers using only addition, doubling, and halving. Method: Take two numbers to be multiplie...
stackexchange_codegolf
Background Slowsort is an in-place, stable sorting algorithm that has worse-than-polynomial time complexity. The pseudocode for Slowsort looks like this: procedure slowsort(A[], i, j) // Sort array range A[i ... j] in-place. if i ≥ j then return m := floor( (i+j)/2 ) slowsort(A, i, m) ...
stackexchange_codegolf
Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a list of words passed as input. For example, if [carrot, potato] was the input, the optimal way to break the string up would be [potato][carrot]. If the list...
stackexchange_codegolf
Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program...
stackexchange_codegolf
Given a grid of directions and a start and end position, determine the minimum number of substitutions in the direction grid that needs to be made to complete the path between the two points. The grid is doubly-cylindrical. This is clearer given an example. Example Let's take the following grid as an example: >>>>v >>>...
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
Leaderboard 154 Calculator 144 Taxman 138 Statistician 137 Solver 137 RandoAggroLawyer 136 Gambler 134 Turncoat 119 Lawyer 119 BloodyMurder 113 Bandit 79 Challenger 74 Mask 64 Random An archive of the latest match, including the log and all output files, is available. Calculator, by Brilli...
stackexchange_codegolf
Develop a program to check if a given word is part of a language defined by the following rules: The language has a set of rules. The empty string is considered a valid word in the language. Two words from the language can be concatenated to create a new word in the language. If X is a word in the language, then "A" +...
stackexchange_codegolf
Fairy Chess is a sort of generalized chess that allows unconventional pieces. The eight queens puzzle is a classic problem where you have to put 8 queens on a chess board such that no two queens threaten each other. This challenge is sort of a generalized combination of the two. Challenge Given a list of fairy chess pi...
stackexchange_codegolf
Background Conway criterion is a method to test if a given polygon can tile (i.e. cover without overlapping) an infinite plane. It states that a polygon can tile the plane if the following conditions are met: The given polygon does not have any holes in it. It is possible to choose six consecutive1 points \$A,B,C,D,E,...
stackexchange_codegolf
Challenge Given a size s, print a cube net of that size made of hash symbols (#) and spaces (). Examples: 1: # # # # # # 2: # # # # # # # # # # # # # # # # # # # # # # # # 3: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #...
stackexchange_codegolf
Related. Given a printable ASCII string, split it into a list of non-empty strings with a new sub-string beginning every time a character, which has not previously been seen in the same case, occurs. Examples "mississippi" → ["m","i","ssissi","ppi"] "P P & C G" → ["P"," P ","& ","C ","G"] "AAA" → ["AAA"] "Adam" → ["...
stackexchange_codegolf
Given a date, output the X and Y position of the current day of the date on a digital calendar. The digital calendar is sort of the calendar that gets shown when you click on your computers clock (at least on windows), and it looks something like this: If we assume that the given date is 25.09.2017, the result would b...
stackexchange_codegolf
Given a rectangular board of cells with some number of holes in it, determine whether it is possible to complete a "holey knight's tour" (That is, a path that visits every non-hole cell exactly once using only chess knight moves, not returning to the starting cell) that starts on the top-left cell. For the sake of comp...
stackexchange_codegolf
I use "sentence" here loosely to mean "any sequence of words separated by spaces" and "words" to mean "sequences of alphanumeric (hexatrigesimal) characters unseparated by spaces". Conversion is from base-36 (0123456789abcdefg...) or (0123456789ABCDEFG...) Conversion to base-16 (0123456789abcdef) or (0123456789ABCDEF)...
stackexchange_codegolf
Meta discussion: Is "(The other day) I met a bear" a duplicate? Your challenge is to output this text: The other day, The other day, I met a bear, I met a bear, A great big bear, A great big bear, Oh way out there. Oh way out there. The other day, I met a bear, A great big bear, Oh way out there. He looked at me, H...
stackexchange_codegolf
At time of writing, my reputation is \$16,256\$. As I noted in chat, Oh cool my rep is the concatenation of two powers of 2: 16,256 Or even the concatenation of a power of 2 and its square, which is much more interesting which then spawned a CMC about checking if a number has this property. Given an integer \$n > 0\...
stackexchange_codegolf
In Bgil Midol's question, the score of a sequence of slice is defined as sumof|startslices|∗2+sumof|endslices|∗2+sumof|stepslices|∗3 Such scoring method makes multiple slices possibly take less score, e.g. [::25] 75 [::5][::5] 30 Given the length of a string, an upper bound of number of slices1, and the one slice i...
stackexchange_codegolf
You probably know the game mastermind: The player tries to guess a code of 4 slots, with 8 possible colors - no duplicates this time. Let's call those colors A through H, so possible solutions could be ABCD or BCHD. Each time you place a guess, the game master will respond with two information: how many slots you got r...
stackexchange_codegolf
Assume we want to shift an array like it is done in the 2048 game: if we have two equal consecutive elements in array, merge them into twice the value element. Shift must return a new array, where every pair of consecutive equal elements is replaced with their sum, and pairs should not intersect. Shifting is performed...
stackexchange_codegolf
This happy individual is known in folklore as the Easter Bunny. Colours It is created using 4 colours: Light pink Dark pink White Black (I'm happy for these colours to be approximated in your answer. It does not need to be this precise shade) Shapes It is constructed of these shapes: Two tall ellipses in light pink...
stackexchange_codegolf
If you cannot see this post, you can use this image Your task is to create a markdown parser that outputs Unicode. It should support , , , and ̲̲̲̲̲̲̲̲̲. Every alphabetical character should be converted into Math Sans. This includes the characters before an underline character. Underlines: Add a ̲ character (code point...
stackexchange_codegolf
Write a program that outputs Hell0 W0rld!. It must match this output exactly, including capitalization, zeroes instead of o's, exactly one space, etc. Trailing new lines are allowed. Lowest score wins. Scoring is based on the sum of the values of each character in the language's code page - otherwise Unicode values ...
stackexchange_codegolf
Closely related: How high can you count? Challenge In your programming language of choice, write as many different identity programs/functions as possible, under the following constraints: Each program should be a function or full program that is one of the following: A function that takes a single positive integer ...
stackexchange_codegolf
Challenge Your goal is to write a function that puts quotes around a sequence of capital letters in a string. So some examples (everything on the left (before function) and right (after function) are STRINGS): Hello the name's John Cena -> "H"ello the name's "J"ohn "C"ena I got BIG OLD truck -> "I" got "BIG" "OLD" truc...
stackexchange_codegolf
The Koch snowflake (also known as the Koch star and Koch island) is a mathematical curve and one of the earliest fractal curves to have been described. It is based on the Koch curve, which appeared in a 1904 paper titled "On a continuous curve without tangents, constructible from elementary geometry" (original French t...
stackexchange_codegolf
In the game Tetris, there are 7 types of bricks or Tetriminoes, which are mathematically known as tetrominoes because they are all made with 4 square segments: The have the names I, J, L, O, S, T, and Z, that correspond to their approximate shapes. Counting 90° rotations, there are 19 unique shapes in total: I I I I ...
stackexchange_codegolf
Your task Given a string of lowercase letters, output the "alphabet checksum" of that string, as a letter. Example Let's say we have the string "helloworld". With a = 0, b = 1, c = 2 ... z = 25, we can replace all of the letters with numbers: h e l l o w o r l d 7 4 11 11 14 22 14 17 11 3 Now, we can sum th...
stackexchange_codegolf
You are a project manager. One day, one of your programmers went insane (not your fault) and took all the expressions in the codebase and added random brackets to them, before quitting on the spot, ranting about your incompetence (also not your fault). This would be an easy fix, however, for some reason you aren't usin...
stackexchange_codegolf
Given infinite different integers, order them into a sequence \$a_1, a_2, a_3, ...\$ such that \$a_i>a_{i+1}\$ iff \$i\$ is even(or odd, as long as it's constant for all possible inputs and all \$i\$). In other word, make the sequence go alternately up and down (or down first, as long as it's constant). Examples: ℤ => ...
stackexchange_codegolf
CHALLENGE Given a set of grouped letters, arrange them onto the board so that they cover the area entirely. Board Representation (a.k.a. the SHIP DECK) The board is a 6x6 grid. There will always be 36 total squares. Columns are marked A-F. Rows are marked 1-6. Example: A B C D E F +---+---+---+---+---...
stackexchange_codegolf
The sequence A109648 starts with the following numbers 53, 51, 44, 32, 53, 49, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 51, 44, 32, 52, 57, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 50, 44, 32, 53, 50, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 49, 44, 32, 53, 48, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 51, 4...
stackexchange_codegolf
Task Read in a possibly infinite text stream or file, outputting its contents until the word hello has been output, abiding to the following rules. Once hello has been output, your code should quit immediately. It should not wait for a newline for example. Your code should output as it goes. That is it shouldn't read ...
stackexchange_codegolf
This is a rock paper scissors competition. Algorithms will face each other in 100 rounds of rock paper scissors. Except that the algorithms will also be able to read the source code of each other! Leaderboard 1. Chaos Bot (by Aiden4) - 27 Points, 168 bytes 2. Anti-99%-of-posts (by Lyxal) - 24 Points, 489 bytes 3. Psued...
stackexchange_codegolf
For this challenge, a linked list looks like this: [1, 2, 4, 0, 6, 1, 3, 1] You'll notice there's no data; each item in the list is just a reference to the index of the next one. Your task is to write a program or function which will follow a linked list like this forever, outputting each item as it is encountered. Fo...
stackexchange_codegolf
Given a string of printable ASCII text (including newlines and spaces) that contains at least one character that is neither a newline nor a space, output a truthy value if the string is rectangular, and a falsey value otherwise. Additionally, the source code for your solution must be rectangular. A string is rectangula...
stackexchange_codegolf
Let \$A\$ be a square matrix that is at least \$2 \times 2\$ where each element is an integer. \$A^2 = A \times A\$ will then have the same dimensions as \$A\$, and will have integer elements. For example, let $$A = \left[ \begin{matrix} -3 & 2 \\ 0 & -1 \end{matrix} \right]$$ Therefore, $$\begin{align} A^2 & = \left...
stackexchange_codegolf
3D-modeling software mainly uses UV Mapping to map textures onto a 3D object. The valid values for both U and V are usually located in an inclusive [0..1] range. Challenge You bought a new 3D-modeling software which is super-easy to use. However there is one issue with it: it adds or subtracts a random integer number f...
stackexchange_codegolf
I came across SVGCaptcha, and immediately knew it was a bad idea. I would like you to show just how bad an idea this is by extracting the validation code from the SVG images that code produces. An example image looks like this: Here is the source of the example image: <?xml version="1.0" encoding="utf-8"?><!DOCTYPE s...
stackexchange_codegolf
Background As far as we can tell from trying everything (besides cheating with ZWSPs), you can't type `\ in Stack Exchange chat. However, you can type \` by doing `\\``. So, if you want to tell someone in chat how to type backslash-backtick, you'd need to type out `\`\\`\`` to format `\\`` into a codeblock. Challenge Y...
stackexchange_codegolf
Given a palindrome generated according to this challenge, depalindromize it. Test cases abcdedcba -> abcde johncenanecnhoj -> johncena ppapapp -> ppap codegolflogedoc -> codegolf As this is about depalindromizing, your code cannot be a palindrome. Remember, this is code-golf, so the code with the fewest bytes wins.
stackexchange_codegolf