instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Given a non-empty string containing only printable ASCII (codepoints 0x20 to 0x7E), write the shortest program or function that map the key to its value. Inside the string the key will always have a value and vice-versa.
How the key is made:
Start with an opening parenthesis (
Contains letters and/or numbers [a-zA-Z0-... | stackexchange_codegolf |
In this challenge, you receive a string as input containing a string of X's, Y's and Z's eg. "XYZZ". X, Y and Z represent a particular character. This pattern is then compared with a second string input. If the pattern exists as a substring in the second input, return True, otherwise, return False. Once a pattern is fo... | stackexchange_codegolf |
Information
Create a diagonal line given its length (let’s call the variable, say, \$n\$ where \$n > 0\$)
The diagonal line starts from the top left and goes to the bottom right.
You must use the ASCII character \ for the line.
The input number can be given from STDIN or if your program doesn’t support that, use a har... | stackexchange_codegolf |
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 |
Bounties
No. 1 (awarded)
I'll throw in 50 rep for the first valid answer
No. 2 (awarded)
I'll throw in another 100 rep for the shortest valid answer.
No. 3 (open for submissions)
I'll throw in 200 rep for the first one with a significant shorter valid answer.
Significant being at most 45% of currently shortest a... | stackexchange_codegolf |
Inspired by a polyglot on the Stack Overflow 404 page:
Goal
Your goal is simple, to create a polyglot that outputs the number 404, and then terminate, in as many languages as possible.
Restrictions
Here's the twist, there's a restriction to make it harder:
You have to write N programs and pick N languages in a particu... | stackexchange_codegolf |
Introduction
As ToonAlfrink says: "Me thinks there aren't enough easy questions on here that beginners can attempt!". So the task is very simple. Given a string, output a truthy or falsy value whether the name is official or not.
A name is "official" if it is a single title-case word, that is:
If the first letter is c... | stackexchange_codegolf |
Given a list of positive integers, partition the list into two sublists such that the absolute value of the difference of the sums over the two sublists is minimal.
The output of the program should be the (non-negative) difference of these sums.
Examples:
[1,2,3] -> 0 # [1,2], [3]
[2,3,5,7,11] -> 0 # [2,5,7], ... | stackexchange_codegolf |
What is the shortest regular expression equivilant to the following?
ENERO|GENER|GENNAIO|IANUARI|IANUARII|IONAWR|JAANUARIL|JANAIRU|JANAR|JANNEWARIS|JANUAR|JANUARI|JANUARIE|JANUARO|JANUARY|JANUWALE|JANVIER|JANVYE|JENUWARI
The shortest regex, in bytes, wins.
If you are worried about what flavor of regex we are using, th... | stackexchange_codegolf |
In this form of the game Tic-Tac-Chec, the goal is to move chess pieces to get four-in-a-row. Your goal here is to figure out if a position has a winning move.
Rules
The rules are similar, but not identical, to those of Tic-Tac-Chec.
The board is 4 by 4 squares. Each player has a rook, bishop, knight, and queen. On you... | stackexchange_codegolf |
Not exactly sure if it belongs in this site, but I always have trouble thinking of all the certain edge cases in any kind of competitive programming or puzzles.
For example, take this kind of problem
Find the size of the smallest list of squares that add up to n
f(16)-> 1 (16)
f(17)-> 2 (16+1)
One intuitive approach ... | stackexchange_codegolf |
Given an atomic number in the inclusive range [1,118], write the shortest program/function that outputs one of {2,8,18} if the element with that atomic number follows the duplet, octet, or 18-electron rule, respectively.
Notes
The Octet/Duplet/18-electron rule is a rule of thumb that describes how many electrons is ne... | 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 |
Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed to create a compressed string.
For example, given the string "the fox" and the encoder characters " abcdefghijklmnopqrstu... | stackexchange_codegolf |
Have you been shooting gallery? We are recently.
In our shooting gallery cans and aluminum cans from under various drinks hang and stand. More precisely, they hung and stood.
From our shots, banks dangled from side to side on a rope, were torn off, rang, crumpled. This is not for you to shoot from your fingers.
Each ... | stackexchange_codegolf |
Task
Implement a kind of "some users are typing" system, which can be found in Discord and some other chat clients.
If 1 user (say, Bubbler) is typing, output Bubbler is typing...
If 2 users (say, Bubbler and user) are typing, output Bubbler and user are typing...
If 3 or more users are typing (say, Bubbler, randomuse... | 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 |
Background
Character classes are a standard way to indicate a set of characters to match in regular expressions. For example, the class [ab] matches a or b, [a-z] matches any lower case letter, and [^a] matches everything but a. For the purpose of this question, classes can contain:
a sequence of characters to match, ... | stackexchange_codegolf |
You are given two regexes and your task is to determine if the strings matched by the first regex are a subset of the strings matched by the second regex.
For this we are going to use a limited mathematical definition of a regex. A regex is defined recursively as one of:
ε - This matches only the string ""
0 - This ma... | 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 |
Given two real numbers (postive or negative) in the limits of float pointing number data types, i.e., (\$-3.4e38\$ to \$3.4e38\$) not inclusive, you should output the max of the two reversed numbers.
TEST CASES
Example
Input:
135
210
Output:
531
\$531\$ is \$135\$ reversed, which is greater than \$012\$, i.e., \$210... | stackexchange_codegolf |
For today's task, we have two programs, P and Q, both in the same language. Each of them receives a single-character input.
If P receives character K, P says how many times K appeared in Q. (You can use any output format for P or Q; they need not be the same, the only requirement is that your format can represent any n... | stackexchange_codegolf |
(Based on this closed challenge, related)
Given an integer n > 1, draw a grid composed of the characters: "-" "+" and "|". However, since I want the grid to look nice, the horizontal component should be 2 wide.
Trailing spaces for each line are not required.
Examples:
n = 2
|
--+--
|
n = 3
| |
--+--+--
| ... | stackexchange_codegolf |
Challenge
The goal of this challenge is to make a function that takes an input string, a start keyword and a end keyword. The output extracted result is from (but excluded) the given start keyword to (but excluded) end keyword. The output sub-string follows the rules as below.
In all cases, the leading/trailing spaces... | stackexchange_codegolf |
In a chatroom with a few people, a topic came up between me and them about how many possible strings a regex could match.
Your task is to build a program that can answer that question.
Your program will accept, as input, any regular expression as defined in this document as an "extended regular expression", such as:
^[... | stackexchange_codegolf |
You find yourself on a chessboard, as one does. You can see the exit but it is awfully far away and you would rather not walk all the way. Luckily some locals have offered you a ride. A Knight, a Rook, a Bishop and a King are all willing to take you to your destination, but seeing how this is a chessboard they must e... | stackexchange_codegolf |
Everybody loves golfing code. Code is written in English (eh...). Therefore, everybody loves golfing English!
Your task is to write a program or function that takes a string as input, and then returns or prints the golfed version. There will be no newlines or tabs in the input.
This is how you golf a string. The order... | stackexchange_codegolf |
Though challenges involving magic squares abound on this site, none I can find so far ask the golfer to print / output all normal magic squares of a certain size. To be clear, a normal magic square of order \$n\$ is:
An \$n\times n\$ array of numbers.
Each positive integer up to and including \$n^2\$ appears in exactl... | stackexchange_codegolf |
The crazy mathematician owns a wide collection of numbers, and therefore the space he has left is quite limited. To save some, he must fold his integers, but unfortunately he is really lazy. Your task, if you wish to help him, is to create a function / program that folds a given positive integer for our number maniac.
... | stackexchange_codegolf |
Code-Bowling Quine Challenge
You must bowl a quine following the rules of code bowling and quines but the source code must be in the shape of a rectangle (details specified below)
Quine
Quines returned must be returned via the ways defined in the standard I/O rules.
Rules
Code-Bowling Rules
Character : Byte Ratio I... | stackexchange_codegolf |
I often forget what I wanted to say when the teacher calls on me to speak. Can you make me a tool to solve this?
Requirements:
The program must loop as follows:
First, take in input
If the input is empty, print the last stored question.
Otherwise, store the input as a question.
Notes:
The input will never be empt... | stackexchange_codegolf |
Average color of an image
Scientists have been able to determine the average color of the universe but in how many bytes can we find the average color on an image?
Your task
Your input will be a single image which you will need to find the average of the colors in the image and output a hex color-string (#??????). The ... | stackexchange_codegolf |
Given two different positions on a chess board and the type of piece, output the minimum number of moves it will take for that piece to go from one position to another.
Rules
The given piece can be King,Queen,Rook,Knight and Bishop. (This input can be taken as any 5 unique characters)
The 2 positions can be taken in an... | stackexchange_codegolf |
A casino uses the following deck of cards. (* is one of the card suits D, S, C or H.)
_________ _________ _________ _________ _________
| | | | | | | | | |
| | | | | * | | * * | | * * |
| | | * | | | | ... | stackexchange_codegolf |
To normalize a vector is to scale it to a length of 1 (a unit vector), whilst keeping the direction consistent.
For example, if we wanted to normalize a vector with 3 components, u, we would first find its length:
|u| = sqrt(ux2 + uy2 + uz2)
...and then scale each component by this value to get a length 1 vector.
û ... | stackexchange_codegolf |
Introduction:
(Source: Wikipedia)
When we look at a rainbow it will always have the colors from top to bottom:
Red; orange; yellow; green; blue; indigo; violet
If we look at these individual rings, the red ring is of course bigger than the violet ring.
In addition, it's also possible to have two or even three rainbow ... | 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 |
Challenge
Generate \$n-1\$ consecutive composite numbers using this prime gap formula
$$n!+2,n!+3,...,n!+n$$
Input
An integer \$n\$ such that \$3 \leq n \leq 50 \$.
Output
Sequence of \$n-1\$ consecutive composite numbers.
Example
Input
3
Output
8
9
Rules
Output should be in integer format.
Test Cases
For \$n > 20\... | stackexchange_codegolf |
Seeing that the current language for Learn You a Lang for Great Good is Piet, and that we don't seem to have a tips page for Piet yet, I decided to make one.
Piet is a stack-based esoteric programming language in which the programs are meant to resemble abstract drawings.
What are some general tips for golfing in Piet?... | stackexchange_codegolf |
Description
a typeracer is an apps where user could type and evaluate their typing speed and accuracy.
Criteria
User could type "A quick brown fox jumps over the lazy dog."
A visual indicator of each wrong character typed.
A visual indicator of what characters to type.
A visual indicator of what has been typed
A visua... | stackexchange_codegolf |
Introduction
On March 24th, 2015 @isaacg golfed his Pyth answer from 44 to 42 bytes. Since a crossed out 44 (44) looks a lot like a regular 44, @Optimizer made the following comment:
striked out 44 is still normal 44 :(
After that, on October 21st, 2015, @Doorknob♦ golfed his Ruby answer from 44 to 40 (and later 38) ... | stackexchange_codegolf |
Given a string representing a series of aircraft marshalling hand signals, write a function or program to calculate the final position of an aircraft following these signals.
N.B.: Co-ordinates in this challenge are represented as a pair of Cartesian co-ordinates, plus a compass direction heading: (x, y, h) where x is ... | 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 |
CAPTCHA Modified by Evil Mathematician
I accidentally incurred the wrath of an eccentric passive-aggressive mathematician. As part of his demented idea of payback, he modified the CAPTCHA system on my favorite website. Up until now, it would just ask a moderately challenging math question, like 3+2^4, and I would simpl... | stackexchange_codegolf |
This challenge will be based on an R language trivia: every release is named and it's a reference to Peanuts comic strips (see here and here).
Task
Given a release name, output its number.
For reference, use the below list:
Great Pumpkin 2.14.0
December Snowflakes 2.14.1
Gift-Getting Season 2.14.... | stackexchange_codegolf |
The Challenge
Everybody loves genetics, right? In this challenge, you will be given the genotypes of two parents. You must find each possible genotype of a child produced by the parents. You must account for dominant and recessive alleles as well as incomplete dominance and codominance.
An example input for the parents... | stackexchange_codegolf |
Task
There is a set of numbers x, such that x^2 divides 7^x-1.
Your task is to find these numbers. Given an input of n, the code will print the nth number that follows this rule.
Examples 1-index
In Out
3 3
9 24
31 1140
The relevant sequence can be found here.
Rules
Shortest answer will be the winner*
Standa... | stackexchange_codegolf |
Problem Statement:
You will receive a substring of a palindromic string. You must return the index of the substring which marks the point of reflection of the original string. You are only provided the substring, which is not necessarily a palindrome because it is not necessarily centered about the middle of the origin... | stackexchange_codegolf |
You are given a string of unknown length that contains a varied amount of (, {, [ and their respective closing parentheses (in this context all referred to as brackets).
With one exception, all the brackets are all balanced, meaning an opening one has a corresponding closing one somewhere afterwards in the string.
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 |
Lenguage is a brainfuck dialect that is notorious for breaking source restriction challenges. That is because Lenguage cares only about the length of it's source and not the contents.
First, the length of the program is calculated. Then, said length is converted to binary and left-padded by zeroes to a multiple of 3. ... | stackexchange_codegolf |
In this challenge you will write code to take a list of positive integers and output all maximal linear sublists.
A sublist is is a list which can be created by deleting values from the the input list. Sublists have more structure than just lists. They in a way "remember" which values are deleted.
Similarly we say tha... | stackexchange_codegolf |
Introduction
This challenge is similar to Project Euler problems. I came up with it because I was playing a deceivingly simple board game and couldn't come up with an efficient solution to answer a simple question about its mechanics.
Quarto is a fun variant of 4 in a row. It is played on a 4 by 4 board with 16 unique ... | stackexchange_codegolf |
Given two arrays of non-negative integers \$A = [A_1,A_2,\ldots,A_n]\$ and \$R = [R_1,R_2,\ldots,R_n]\$ which are equal in length, return an array which has the element \$A_1\$ repeated \$R_1\$ times, then element \$A_2\$ repeated \$R_2\$ times, all the way up to \$A_n\$.
Standard loopholes are forbidden. As this is co... | stackexchange_codegolf |
Intro
Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value.
Sandbox
Rules
Take the number \$n\$, and get it in words from this dictionary. You may take this dictionary in any way you prefer. (a list, read from link, command line arg, STDIN, va... | stackexchange_codegolf |
Introduction
This is one is pretty straightforward. We will be drawing a snake in ascii. This was inspired by that old snake game where you have to collect the fruit and you continuously grow.
Definition
Given a positive integer N that represents the snake's length, draw a snake so that it has a body of n plus a head a... | stackexchange_codegolf |
An H tree is a fractal tree structure that starts with a line. In each iteration, T branches are added to all endpoints. In this challenge, you have to create an ASCII representation of every second H tree level.
The first level simply contains three hyphen-minus characters:
---
The next levels are constructed recursi... | stackexchange_codegolf |
Challenge
Write a program or function that given a string, returns a valid Brainfuck program that when compiled and executed as Brainfuck, returns that string..
Assume all inputs are encoded as ASCII.
Assume the outputted BF program will execute in an environment with an infinite tape.
Assume the pointer starts at c... | stackexchange_codegolf |
Given a grid which contains these signs: 0..9, x, =, write the fastest code that outputs the longest string of connected (horizontally, vertically, and diagonally adjacent), distinct cells which is a mathematically valid expression formed on this grammar:
E := T '=' T
T := F 'x' T | F
F -> {0..9}+
More formally, a so... | stackexchange_codegolf |
Rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you wish to accept it, is to write a program/function that outputs/returns its input/argument¹. The tricky part is that if I transpose your source code², the output/result must be transposed too.
You may choose which kind of 2D data your so... | stackexchange_codegolf |
https://en.wikipedia.org/wiki/Losing_chess
This is basically Chess Tournament, but for antichess ;)
Antichess is one of the many chess variants that have been invented. The goal is to lose all your pieces (this may seem a little odd, but it's called antichess for a reason).
The rules
The rules of antichess are very si... | stackexchange_codegolf |
Introduction
For a given rational number r, find a pair of integers p,q so that p/q=r and the number of less used bits in p and q are minimized (details below).
Challenge
A positive rational number r can be expressed as the ratio of two positive integers, r=p/q. The representation is not unique. For each of these repre... | stackexchange_codegolf |
This is the Cops' thread. Robbers' thread is here.
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.) A... | stackexchange_codegolf |
I'm trying to read 4 ints in C in a golfing challenge and I'm bothered by the length of the code that I need to solve it:
scanf("%d%d%d%d",&w,&x,&y,&z)
that's 29 chars, which is huge considering that my total code size is 101 chars. I can rid of the first int since I don't really need it, so I get this code:
scanf("%*... | stackexchange_codegolf |
Negadecimal, also known as base -10, is a non-standard positional numeral system.
Take the number \$1337_{10}\$. In decimal, this has the value one thousand three hundred thirty seven, and can be expanded to:
$$1\cdot10^3+3\cdot10^2+3\cdot10^1+7\cdot10^0$$
$$(1000)+(300)+(30)+(7)$$
In negadecimal, instead of \$10^n\$, ... | stackexchange_codegolf |
Challenge:
Given an integer \$n\$, guaranteed to be \$\geq2\$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ by \$n\$; the second \$\frac{n}{2}\$ by \$\frac{n}{2}\$; the third \$\frac{n}{4}\$ by \$\frac{n}{4}\$; etc.; until the fi... | stackexchange_codegolf |
Specifically, Conway's PRIMEGAME.
This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers:
A B C D E F G H I J K L M N
17 78 19 23 29 77 95 77 1 11 13 15 15 55
-- -- -- -- -- -- -- -- -- -- -- -- -- --
91 85 51 38... | stackexchange_codegolf |
Challenge
Given a colour raster image* with the same width and height, output the image transformed under Arnold's cat map. (*details see below)
Definition
Given the size of the image N we assume that the coordinates of a pixel are given as numbers between 0 and N-1.
Arnold's cat map is then defined as follows:
A pixe... | stackexchange_codegolf |
Introduction:
I think most people will know how darts work. But since some might not, here are the rules of playing Darts in a nutshell:
Amount of players: 2
Starting points: 501
Goal: Get your points to 0 first
Darts per player: 3
Available numbers on the board: 1 through 20, and Bulls-eye
Here is the layout of a Da... | stackexchange_codegolf |
Inspired by this and the following chat:
Your task is to output the following:
_ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/
Extra leading or trailing whitespace is allowed, as long as it does not change the appearance of the cube. As usual, returning the above or a list of strings ... | stackexchange_codegolf |
I have a follow-up question here from my previous question on Math SE. I am lazy enough to explain the content again, so I have used a paraphraser to explain it below:
I was considering arbitrary series, springing up as a top priority, when I considered one potential series in my mind. It is as per the following:
The ... | stackexchange_codegolf |
Related OEIS sequence: A008867
Truncated triangular number
A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of os:
o
o o
o o o
o o o o
o o o o o
o o o o o o
Let's define a "truncation:" cutting triangles of the same s... | stackexchange_codegolf |
Challenge:
In the programming language of your choice, accept an integer as input in base 10, and output it in the negadecimal notation, which is also known as base -10
Example algorithm:
This is an algorithm taken from Wikipedia to convert base 10 to any negative base in VB.NET:
Function toNegativeBase(Number As Inte... | stackexchange_codegolf |
Sales taxes in the United States are complicated, to say the least. Generally, there's a state sales tax (there are a handful of states that do not collect a state sales tax), but there could also be a county sales tax, a school district sales tax, a municipal (city) sales tax, or a metropolitan area sales tax. There c... | stackexchange_codegolf |
Codegolf challenge - mapping values in a multidimensional array
[
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
This 2D array is sick of being so false, and wants to find the truth about life, once and for all. Your task is to write a map function to act as a highway to all the values in this array.
An example implementatio... | stackexchange_codegolf |
The magic music box (MMB)
This explains the motivation for the challenge, feel free to ignore.
The magic music box is a word game played by a group of people, where one is the owner of the magic music box and the other people are trying to put words inside the magic music box.
Rules for the game with humans: the game g... | stackexchange_codegolf |
Let's introduce a simplified variant of the well known Spider Solitaire.
From Wikipedia:
The main purpose of the game is to remove all cards from the table, assembling them in the tableau before removing them. Initially, 54 cards are dealt to the tableau in ten piles, face down except for the top cards. The tableau pi... | stackexchange_codegolf |
Here is Minkowski's question mark function:
It is a strictly increasing and continuous function from the reals to themselves that, among other unusual properties, maps rational numbers to dyadic rationals (those with a power-of-two denominator). Specifically, suppose the continued fraction representation of a rational... | stackexchange_codegolf |
I've got some Java pseudocode that uses whitespace instead of curly braces, and I want you to convert it.
I/O
Your program should take an input file along with a number designating how many spaces are used to indent a block. Here's an example:
$ convert.lang input.p 4
// Convert using 4 spaces as the block delimiter
$... | stackexchange_codegolf |
Challenge
Find an expression, at most 100 bytes long, with the longest type signature.
Rules
Any statically typed language with type inference is allowed
The type must be non-ambiguous, but otherwise may include types without defined instances. For example Num [a] and Eq [a] are allowed, even without a defined instanc... | stackexchange_codegolf |
The goal is to make a two frame animation with ASCII art of a hammer smacking a table.
Trailing white-space is allowed and the frames need to repeat continuously. The program should iterate over both frames with a time of 0.5 seconds between frames.
Lowest byte count wins for each language!
Sample:
Animation Frames:
Fr... | stackexchange_codegolf |
Inspired by this listing from the Commodore 64 User's Guide:
10 PRINT "{CLR/HOME}"
20 POKE 53280,7 : POKE 53281,13
30 X = 1 : Y = 1
40 DX = 1 : DY = 1
50 POKE 1024 + X + 40 * Y, 81
60 FOR T = 1 TO 10 : NEXT
70 POKE 1024 + X + 40 * Y, 32
80 X = X + DX
90 IF X <= 0 OR X >= 39 THEN DX = -DX
100 Y = Y + DY
110 IF Y <= 0 OR... | stackexchange_codegolf |
Challenge
Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines.
You have to write a program that takes a number as input. It will print out a factory of 10 workers 10 times. Every time, each worker has a 1/input chance of being 'fired' and replaced by a machine... | stackexchange_codegolf |
A troll has captured you and is forcing you to write malware (defined as a program that damages the computer that runs it). The troll can read and understand code, but is not so good at spotting bugs.
Your goal is to write a program that:
Looks like malware; i.e., a beginning programmer reading the code will be convin... | stackexchange_codegolf |
There's a little-known secret in Banjo-Kazooie that you can interleave the three Cheato codes on the Treasure Trove Cove Sandcastle floor and it will still recognize all of them. So you could, for instance, enter BLUREEGOLDDFFEEGEAATHTHEEGSRSRS, activating BLUEEGGS, REDFEATHERS, and GOLDFEATHERS all at once.
Challenge
... | stackexchange_codegolf |
This task is simple: Write a program or function that outputs the list of all musical notes (using English note names) from A♭ to G♯.
All notes without a name consisting of a single letter (i.e. black notes on a musical keyboard) should have their name printed twice, once as the sharp of a note, once as the flat of one... | stackexchange_codegolf |
This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you accept it, is to write a program/function that outputs/returns its input/args. But again, The tricky part is that if I rot-13 your source code, the output must be returned rot-19.
Your co... | stackexchange_codegolf |
From Codidact with permission.
Description
APL trains are a series of functions, that get applied to an argument in this way:
(f g) x = f g x here f and g are prefix functions
(f g h) x = (f x) g (h x) here f and h are prefix functions, while g is an infix function
(a b c d e f) x = (a (b c (d e f))) x = a (b x) c (d x... | stackexchange_codegolf |
This is a simple encryption method that uses PI digits to encode a message, the method is simple:
The key is just a positive integer that indicates where the window starts then:
Given a string to encrypt, containing only lowercase letters, no spaces, you take its length, then you find the Nth digit of PI and then proce... | stackexchange_codegolf |
The TAK function is defined as follows for integers \$x\$, \$y\$, \$z\$:
$$
t(x, y, z) = \begin{cases}
y, & \text{if $x \le y$} \\
t(t(x-1,y,z), t(y-1,z,x), t(z-1,x,y)), & \text{otherwise}
\end{cases}
$$
Since it can be proved that it always terminates and evaluates to the simple function below,
$$
t(x, y, z) = \begin{... | stackexchange_codegolf |
Is there any javascript-like language? Something that can be interpreted by browsers?
| stackexchange_codegolf |
Challenge
To quote Wikipedia:
An octave-repeating scale can be represented as a circular arrangement
of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing C major scale is C–D–E–F–G–A–B–[C], with the bracket indicating that the last note is an octave higher than the first no... | stackexchange_codegolf |
Everyone knows that the news is boring. Really boring. Unless if it's about Politicians and their scandals. That is fun! But alas, Politicians can commit only so many scandals. So, I am employing you to make the news more interesting.
Objective Given an HTML snippet, perform all the substitutions found here, that is, i... | stackexchange_codegolf |
Background
Adler-32 is a 32-bit checksum invented by Mark Adler in 1995 which is part of the widely used zlib library (also developed by Adler). Adler-32 is not as reliable as a 32-bit cyclic redundancy check, but – at least in software – it is much faster and easier to implement.
Definition
Let B = [b1, ⋯, bn] be a b... | stackexchange_codegolf |
When one performs a search query using Google, one of the first things you see is an approximation of how many results were found. Today, you'll be simulating this in as few bytes as possible.
Input
A short string of length at most 10 with characters from a-z.
Output
The approx count that Google reports for the number ... | stackexchange_codegolf |
Here's one for all you wordsmiths out there! Write a program or function which takes a list of words and produces a list of all possible concatenative decompositions for each word. For example:
(Note: This is only a small sampling for illustrative purposes. Actual output is far more voluminous.)
afterglow = after + glo... | 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 |
Write a program that takes a brainfuck program and compiles it to executable machine code. You can target x86, x86_64, jvm (java bytecode) or armv6, and use one of the following executable formats: ELF, a.out, class file, exe, com. The executable should work in Linux or Windows (or Java on either).
Neither your program... | stackexchange_codegolf |
Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest.
Pitches will be given in scientific pitch notation, consisting of a tone name followed by an octave number. Here, the tone name will be a single letter A–G, possibly followed ... | stackexchange_codegolf |
Overview
As most of y'all who visit chat know, I am Russian by ethnicity[citation not needed]. Recently, I switched from a keyboard that maps the letters 1-to-1 (mnemonic) to Windows' default mnemonic keyboard. Here are the letter mappings:
"`" -> "ъ"
"q" -> "я"
"w" -> "ш"
"e" -> "е"
"r" -> "р"
"t" -> "т"
"u" -> "у"
"i... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.