New answers tagged

4

Post Sandbox challenges when they're ready to be posted, not based on score or time The reason score/time are recommended (e.g. wait a week, have a positive score etc.) is because these are usually good ways of measuring if your challenge idea will do well. For example, a negatively scored Sandbox post is unlikely to do well posted on main, and a challenge ...


1

Is this a hamiltonian cycle? path-findinggrid There is a 3x3 square block made of 1x1 square blocks, with coins in each 1x1 block, starting from top left block you want to collect all the coins and return to top left block again, if possible provide instructions to achieve this. Rules From block \$(x,y)\$ in one step you can move right(R) to \$(x,y+1)\$ ,...


0

Slice the source code cops-and-robbers Cops Understanding slicing Remember, slices are zero-indexed. Take this slice: [2:]. If the list is [1, 2, 3, 4, 5], the result is [3, 4, 5] because the slice basiclly means "get all elements with a index greater than 2." Let's try [1:3]. If there is a end slice, the end slice is not included. (excluded) ...


0

Cutoff at top Not sure if this is a my computer problem or not... but it's cutoff at the top and I can't see those buttons. My screen is 1920x1080.


-2

Nth Eights Challenge Inputs: There are 2 inputs: The amount of eights to be used in the calculation, and the number to solve for. What to solve: The program needs to insert operators in between each eight, so when the newly created equation is calculated, the answer is the number that was trying to be solved for. When the equation is calculated, there is no ...


1

Count count count.. code-golf Posted


0

Truncatable Primes A left-truncatable prime is a prime number and when the first digit is removed continuously, the result is always prime. A right-truncatable prime is a prime number and when the last digit is removed continuously, the result is always prime. If the integer is only a left-truncatable prime, return left If the integer is only a right-...


1

Ragged list addition Let's define the operator \$+\$ as follows, using wrapping list indexing: \$ a+b=\begin{cases} a+b,\space\text{if }a\text{ and }b\text{ are integers (regular integer addition)}\\ [a+b[0], a+b[1], ...,a+b[len(b)-1]],\text{if }a\text{ is an integer and }b\text{ is a list}\\ [a[0]+b,a[1]+b,...,a[len(a)-1]+b],\text{if }b\text{ is a list and }...


1

Trap the persistent hero in a maze Last time a challenger tried to thwart your evil magical deeds, they got trapped in a maze that you created to be as small as possible, giving up only a few steps from the exit. Now there is another hero on the way. If it ain't broke, why fix it, so you ask the magic ball about the moves the hero will make in the maze. ...


4

Minimum number of changed tiles to permit knight passage code-golf path-finding Summary Given a chess knight K that is only allowed to step on permitted tiles X, output the minimum number of . tiles that must be changed to an X tile in order to permit a passage to the destination D. Specification The chessboard is guaranteed to be larger than 3x3. The ...


0

Ragged Matrix A ragged matrix, is a matrix that has a different number of elements in each row. Your challenge is to write a program in any favorable language to find the indices of all occurrences of target in the ragged matrix. Input: A list of ragged lists (can be empty) of positive integers and a target range e.g. 56-26. The target range, given 2 ...


-1

Sum two lists Task Your task is to Print If there is a list and a number, evaluate [a1 + b, a2 + b ... aN + b] But there is both lists, evaluate (the length of a is 2 and b is 5)[a1 + b1, a2 + b2, a1 + b3, a2 + b4, a1 + b5] You must Flatten to array with depth 2. Every input has even elements Test cases [0, 0] => [0] [[0], 1] => 1 [[[1]], 2, 3, 4] =>...


0

Alternate indexing Task (To do.) Test Cases [[1, 2, 3], [4, 5, 6]] => [[1, 4], [[1, 2, 3], [4, 5, 6], [3, 2, 1], [6, 5, 4]] [[1, 1, 1]] => [[1, 1, 1], [1, 1, 1]] [[]] => [[]]


0

Count the ways to transform (3) Your input is an infinite matrix (2d array) of nonneagtive integers where a finite area of the matrix contains nonzero integers. For example: \begin{matrix} \ddots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \cdot^{\cdot^\cdot} \\ \cdots & 0 & 0 & 0 & 0 & 0 & 0 &...


0

Alphabet Polygon Intro Given a number of sides \$a\$ and a side length \$b\$, generate an \$a\$-sided polygon with side length \$b\$. The fill value will be the alphabet going clockwise. If there are not enough letters, wrap around. Test cases 3 4 A H B I C G F E D 4 4 ABCD L E K F JIHG ```


1

Climbing the Bookshelf code-golf Introduction You're making a robot that can navigate a set of books of varying heights. It can climb books and jump off books, but if the distance is too big it breaks. To firgure out the ideal design, you're writing a simulator. Your program will take as input a list of numbers, representing the heights of the books in the ...


1

Count the ways to transform (2) Your input is a matrix (2d array) of positive integers. For example: \begin{matrix} 1 & 1 & 4 & 7\\ 1 & 3 & 5 & 6\\ 2 & 1 & 4 & 5 \\ \end{matrix} A semi-continuous transformation of this matrix is a rearranging of elements that preserves immediate neighbors. For example, we can swap the \$2\$...


2

Pretty print my arrays I like to pretty print multidimensional arrays, like this: [ [ [1, 2, 3], [4, 5, 6] ], [ [7, 8, 9], [6, 4, 2] ] ] But it's a pain to do by hand and it'd be nice to have a program that does this for me. Your challenge is to create a program that does this for me, taking a multidimensional array containing only numbers and ...


4

Score a Scrabble Play


1

Play chess (KOTH) Your task is to write a chess engine that will compete with other submissions in a chess tournament. Well, almost. Since writing a full engine can be a bit tedious, you only need to write the evaluation function. An evaluation function takes a chessboard as input and returns how "favorable" the position is. If white is winning, ...


0

Approximate Euler's Number Euler's number (e) is one of the most well-known mathematical constants, with a simple way to approximate it. All you have to do is repeatedly generate a random number between 0 and 1, and add it to an accumulator. Record how many times you have to do this for the accumulator to exceed 1. If you do this over and over again, the ...


0

Deterministic oozes code-golf Related This challenge is similar to the above linked challenge except the task is to output the next state of the input. Input Input can be taken as: A list of characters of states of cells A string A list of code points of characters Task Output the next generation of the input. These conversions happen if there is food . or ...


-2

Convert decimal to unary in fewest regex codes code-challengeregular-expression Your task is to Convert decimal to undary in fewest regex codes Every regex code is substitution mode. The regex code counts the regex code, without test string and Substitution code A example ^2, |11 ^3, |111 ^4, |1111 ... \|, <empty> This scores infinity, But don't try ...


-3

Who Loses The number guessing game? You are playing a number guessing game. You know everyone's guesses, and who won, and want to figure out who was in last place. Task Your task is to take a dictionary of guesses as input, along with the name of the winner. You should then return the name of the player whose guess was the farthest from the winner's, or if ...


2

Von Neumann Probe Battle (king-of-the-hill) This is just an idea for now, placing it here as a draft and to collect feedback. Basically, your goal would be to design a set of machines, including factories and spacecraft, which start on earth and spread outward into the universe. You'd be able to design these machines. Not just their code, but the parts that ...


3

Only one from each set


2

Trap the hero in a maze


-2

TDG - Test Driven Golf popularity-contest Our company requires unit testing before code can be deployed to production. Unfortunately, my code is written in esoteric programming languages, none of which have test runners. Please help me get to production! Challenge Write a test runner for a programming language (here after called Language X) that takes ...


1

Navigate the city The government of your country has just completed a city designed to accommodate a few hundred thousand people. It has all sorts of facilities including roads, restaurants, malls, houses, etc. You have been invited to test the road system, but you are completely unfamiliar with it, so you need a GPS. Your challenge is to make one. ...


1

Biggest katlani noun dictionary in 400 bytes Post


2

Move to Right and left


3

Shanghai ascii game sticks code-golfascii-artpath-finding Posted


2

Animate finding the middle (hypercube edition) 1d version Given a multidimensional array of integers where all dimensions are the same length, animate finding the centre of it. Simply output the array, then remove the first and last items of every array within it and output it, until the length of each dimension is less than 3 and can't have the first and ...


6

Sort every dimension


2

Regex ordinals Inspired by this xkcd comic, your job is to write an extremely meta regex. Specifically, the depth of a regex is an ordinal defined as follows: regex golf has depth 0. meta-x has depth 1 greater than the depth of x. The depth of <regex> is the supremum of the depths of everything <regex> matches. Of course, it's possible for a ...


0

Euler Irregular Primes Your challenge is to find all Euler Irregular Primes (A prime p is Euler-irregular if it divides an Euler number E(2n) with 0<2n<p−1) under n. Scoring Your goal is to use the least amount of bytes.


5

Inject arbitrary code into a compiler cops-and-robbers In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, transpiler, or compiler. Cops Cops should ...


0

Move the next greater number, with fewest fails to take everything Your task is to move the next greater number, with fewest fails to take everything A fail counts if a step is the lower number (not counting equal) The starting point is the top left corner Example: 1234 Can do like this >>> Because moves to right, the next number is greater than ...


1

Cell Evolution Your lab needed to simulate how a particular cell evolves over time in a 2D grid space. A sample 2D grid space below shows a single cell at the centre of the grid. 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 The cell evolution follows these rules: '0' indicates no live cell A positive number indicates a live cell. The number indicates ...


3

Is this continuous terrain? Part II


0

Help Bob split his apples Bob has a lot of apples, and he wants to split his apples with his friends evenly. (Including Bob.) However, every \$k\$th friend already has a lot of apples and does not need apples. Bob, however, is kind so he gives each \$k\$th friend the number of apples the friend already gives floor divided by three. Given the input format ...


2

Prime Number Fibonacci In this challenge, you will make a program that calculates the Fibonacci sequence with a twist. Instead of it starting with 0 and 1, it starts with the nth prime number determined by input by the user. The second number is the nth+1 prime number. The sequence should also stop after nth number iterations. Walkthrough: Get a number from ...


3

Recursive palindromes


2

Crack the Caesar cipher


2

Count combinations by relative quantity ranking Let's define a function F which takes a positive integer m and a list of nonnegative integers, and returns the counts of each positive to m. For example: F(4,[0,3,2,2,2,0,2,2,2,3,4,4,3,1,1,4,4,4,4]) returns [2,6,3,6] because 1 appears 2 times, 2 appears 6 times, 3 appears 3 times, and 4 appears 6 times. What if ...


1

From code to golf (Cops and Robbers)


4

Remove odd indices and double the even indices


2

Mat Printing Matrix


2

Compress and decompress


3

Will the tower balance? You are given as input a tower made of bars of unit height, and your task is to decide if the tower is stable. Here is an ascii art drawing of a tower: # #### # #### ##### For extra clarity here is the same tower but with the different bars in different characters: A BBBB C DDDD EEEEE The bars are rigid, but they are not connected ...


Top 50 recent answers are included