instruction
stringlengths
34
53.1k
The game of Sevens is played as follows: n players sit in a circle, and start counting up from 1, passing to the left (or from player A to player B). When a number p that has a 7 in it OR is divisible by 7 is reached, then the player who spoke the number p-1, after the next player says p, must say p+1 and the order of ...
Sometimes when writing brainfuck code, you feel the need to make it longer than needed to encourage debugging. You could do it by just plopping a >< in there, but what fun is that? You'll need something longer and less NOPey to confuse anybody reading your code. Quick introduction to Brainfuck Brainfuck is an esoteric...
The Dal Segno and Da Capo are two very commonly used musical terms. They mean "from the sign" () and "from the beginning" respectively. There is also the idea of the coda (), which is the very end of a piece of music. It's what's played after the "main section" of the piece. A D.S. al coda (Dal Segno al coda), for exam...
Write a programs that reads the file Smart.txt & outputs the order from Most Smart to Least smart. --Smart.txt Sam John John Michael Taylor Sam In the above text file the person on the left is smarter than the person on the right. So we have to finally print the output as follows: Taylor Sam John Michael There can be...
I like the concept of 0815, except the interpreter on the creator's website returns an Error 404. So I decided to ask you all to help! The Basics 0815 is based around three (3) registers and a queue. The registers are named X, Y, and Z, with X being write-only, Z being read-only, and Y being a "helper" register that ca...
https://en.wikipedia.org/wiki/Connect_Four Does anyone remember the 2 player game connect 4? For those who don't it was a 6x7 board that stands vertical on a surface. The goal of connect 4 is to, well connect 4! The connection is counted if it is horizontal, diagonal, or vertical. You place your pieces on the board by ...
The Rules Each submission must be a full program. The program must take input as two comma-separated dates in the form YYYY-MM-DD, and print the number of days that has passed since the second date to STDOUT as if today was the first date (if the second date would be in the future, output a negative number) plus an o...
This little piggy went to market, this little piggy wrote some code... Ah wait, we're not talking about that bacon, we're talking about Sir Francis Bacon! Specifically, the cipher Bacon devised in the late 1500s, as a method of hiding a message within another message, a method of steganography. The cipher works by conc...
Innovation is a card game where players battle through the ages, from prehistory to modern times, in an attempt to earn achievements faster than their opponents. Each card in Innovation is unique, and provides a player with a number of icons. If we treat each card as a 2x3 grid, then three of the four slots on the left...
Background A fractal sequence is an integer sequences where you can remove the first occurrence of every integer and end up with the same sequence as before. A very simple such sequence is called Kimberling's paraphrases. You start with the positive natural numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, ... Then you riffle in so...
Let's get back to basics! Your code, a complete program or function, must convert the official Unicode name of a printable Basic Latin character into the corresponding character. For example, for the input LOW LINE your code must output _. You only need to take a single character name as input. You cannot use any pre...
(Literally: "Does this follow/realize the gismu-form?") Premise The language Lojban is a constructed language, meaning in part that all of its words have been created rather than allowed to develop naturally. The semantic base of Lojban are its gismu, or root words, which were synthesized by combining roots from widely...
This question was inspired by this HNQ. About the series This question is now part of a series about the AGM method. This first post in the series will be about actually calculating the AGM. You may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is ...
The challenge below requires you to be familiar with formal parser theory. If you don't know what the question is asking because you don't know what the terms mean, context-free grammars and first/follow sets are covered in a lot of university courses. I can recommend this Stanford course, in particular handouts 08 and...
The Catalan numbers (OEIS) are a sequence of natural numbers often appearing in combinatorics. The nth Catalan number is the number of Dyck words (balanced strings of parenthesis or brackets such as [[][]]; formally defined as a string using two characters a and b such that any substring starting from the beginning has...
sheesh, is this really the 4th? For all you oldcomers, the core challenge is the same, but we are using Java instead of a custom language. Here are the past three CodeBot challenges, in case you are interested. The goal of CodeBots is to make your bot as viral as possible. Each bot carries a Flag, and you need to ma...
I've enjoyed reading this site; this is my first question. Edits are welcome. Given positive integers \$n\$ and \$m\$, compute all ordered partitions of \$m\$ into exactly \$n\$ positive integer parts, and print them delimited by commas and newlines. Any order is fine, but each partition must appear exactly once. For e...
First question here, don't yell at me if this is a duplicate or a bad challenge. Introduction I thought of this challenge myself, and it seems to be a good basic puzzle for beginner code-golfers. It also might help me decide which code-golfing language to learn. Challenge Given an array of integers that are less than o...
Before anyone says anything, similar and similar. But this is not a dupe. Some positive integers can be written as the sum of at least two consecutive positive integers. For example, 9=2+3+4=4+5. Write a function that takes a positive integer as its input and prints as its output the longest sequence of increasing con...
Write a function or program that takes as its input a string and prints a truthy value if the string is a pangram (a sequence of letters containing at least one of each letter in the English alphabet) and a falsey value otherwise. Case of letters should be ignored; If the string is abcdefghijklmnopqrstuvwXYZ, then the ...
Your task is simple: given two integers \$a\$ and \$b\$, output \$\Pi[a,b]\$; that is, the product of the range between \$a\$ and \$b\$. You may take \$a\$ and \$b\$ in any reasonable format, whether that be arguments to a function, a list input, STDIN, et cetera. You may output in any reasonable format, such as a retu...
A Quat is a combination of a quine and the popular esolang cat program. Challenge The challenge is to write a standard cat program. Whatever the user inputs, the program will echo the input to stdout. However, when the length of the input is greater than 0 and a multiple of 4, the program should output its own source c...
I don't like strings with more than three vowels in a row. Can you write a program that removes all the vowels I don't want from words? You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest altern...
Inspired by this question by @CᴏɴᴏʀO'Bʀɪᴇɴ. Taken from the question: Your task is simple: given two integers a and b, output ∏[a,b]; that is, the product of the range between a and b. You may take a and b in any reasonable format, whether that be arguments to a function, a list input, STDIN, et cetera. You may ...
Heavily inspired by Programming a Pristine World. Also closely related to this challenge. Let's define a pristine prime as a number which is itself prime, but will no longer be prime if you remove any contiguous substring of N base 10 digits, where 0 < N < digits in number. For example, 409 is a pristine prime because...
About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post. Although I have a bunch of i...
Don't you hate it when you want to copy-paste a list of numbers (vector, array ...), from one program to another, but the format you have the numbers on doesn't match the format you need it on? For instance, in MATLAB you may have a space separated list like this: [1 2 3 4 5] (you can also have it comma separated, ...
Background The convex hull of a finite number of points is the smallest convex polygon that contains all of the points, either as vertices or on the interior. For more information, see this question on PGM which defines it very well. Input N+1 2-D coordinates (N >= 3) passed through STDIN (with other usual golf inputs ...
The task is very simple, when given an input, output one of the following spirals: Input = 1 gives a spiral with the letter A beginning in the top left corner: A B C D E F T U V W X G S 5 6 7 Y H R 4 9 8 Z I Q 3 2 1 0 J P O N M L K Input = 2 gives a spiral with the letter A beginning in the top right corner: P Q R S T...
Disclaimer: while I have been on this site for entertainment purposes for a little while now, this is my first question, so please forgive any minor errors. Background When assigning us homework, my teacher is really annoying and writes out all the problems we have to do individually. As such, it takes me forever to co...
This is a king of the hill challenge for Dots and Boxes (aka Pen the Pig). The game is simple, on your turn just draw a line on an empty fence. Every time you complete a square you get a point. Also, since we are playing by championship rules, if you complete at least one square on your turn you get an extra turn. This...
The challenge this time is to find the nth Fibohexaprime. The definition of a Fibohexaprime is as following: We first observe a list with Fibonacci numbers: N | Fibonacci number 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | 8 7 | 13 8 | 21 9 | 34 10 | 55 11 | 89 12 | 144 13 | 233 14 | 377 15 | 610 16 | 987 ...
Background Very skilled card handlers are capable of a technique whereby they cut a deck perfectly in half, then perfectly interleave the cards. If they start with a sorted deck and perform this technique flawlessly 52 times in a row, the deck will be restored to sorted order. Your challenge is to take a deck of cards ...
Rolling the Dice So, I was rolling dice a while ago and thought of a challenge. Given the cube with a net taken from input and a list of moves, find the square on the bottom at the end. I will use this image for the examples here. Input You take in a string with a list of moves. The string contains only the capital A...
Inspiration from Puzzling.SE. Suppose we have an m × n grid such that each element is a base 10 digit. We can read the numbers from such a grid so that we fix a starting element, go to one of the eight nearest coordinates and maintain that direction for zero to five steps. This allows you to read a one to five digit nu...
Given a non-negative integer input, write a program that converts the number to hexadecimal and returns a truthy value if the hexadecimal form of the number contains only the characters A through F and a falsey value otherwise. Test cases 10 ==> True (A in hexadecimal) 100 ==> False (64 in hexadecimal) 161 ==> False...
Introduction The task is simple. When given a number, output the most logical rectangle. To explain what a logical rectangle is, I provided some examples: Input: 24. All possible rectangles have the form A x B, (A and B are both positive integers). So, all possible rectangles for 24 are: 1 x 24 2 x 12 4 x 6 From this...
Given a string input, write a program that prints a truthy value to STDOUT or equivalent if the input is a valid UUID, without using regexes. A valid UUID is 32 hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four h...
Inspired by Alex's glorious Learn you an R for great good, we are going to humbly recreate Alex's "one true R program" -- but with a twist. Alex-style Addition works like this -- it has a 90% chance of simply returning the sum of the two numbers given and a 10% chance of recursively Alex-adding the first number and the...
Here is a list of some common ligatures in Unicode (the ones I could create with my Compose key on Debian): Orig Ascii Lig ae [ae] æ AE [AE] Æ oe [oe] œ OE [OE] Œ ij [ij] ij IJ [IJ] IJ ff [ff] ff fi [fi] fi fl [fl] fl ffi [ffi] ffi ffl [ffl] ffl You have two options in this ...
After you wake in a dark room, you see a rectangular grid of lights with corresponding switches. You decide to use a coordinate system with the bottom left light representing (1,1) and the coordinates increasing as you go up (y direction) and to the right (x direction). The grids are identical in that flipping the swi...
Given a string you must move each letter (starting from the first letter) by its position in the alphabet. If you reach the end of the string you must wrap around. Non-letters don't need to be moved. Example: Dog D is the fourth letter in the alphabet so we move it four spots to the right. After wrapping around, that c...
Create a program that solves a mathematical expression using the elements from alternating sides of the expression. The way it’s done is, instead of reading from left to right, you read the first character, then the last, then the second, then the second to last etc. This will give you a new expression that you must ev...
The Background Folks were talking prime factorization in chat and we found ourselves talking about repunits. Repunits are a subset of the numbers known as repdigits, which are numbers consisting of only repeating digits, like 222 or 4444444444444444, but repunits consist only of 1. The first couple repunits are therefo...
Why was 6 afraid of 7? Because 7 8 9! Given a string apply the following transformations: If there is a 6 next to a 7 remove the 6 (6 is afraid of 7) If the sequence "789" appears remove the 8 and the 9 (7 ate 9) (If I'm not mistaken it doesn't matter what order you do the transformations in) Keep applying these tran...
Defenestration is the act of throwing someone or something out of a window. —Wikipedia Input The input will consist of two parts: A floor plan and a person inside the house/building. v><^ represents a person, pointing in the direction signified by the arrow. The input will contain exactly one person. - and | repres...
Goal You're playing a computerised chess game. The display is in black and white only and the pixels are chunky. White pixels use a lot power compared to black pixels and you're concerned about your carbon footprint. Given a square and a piece in chess notation, return the number of white pixels displayed in the squa...
Your input will be a integer between 1970 and 2090 (inclusive), representing a year. Your program should output the next year on which New Years Day falls on the same day of the week as the input year. Test Cases: Below are the sample inputs and outputs 2001 => 2007 2047 => 2058 2014 => 2020 1970 => 1976 1971 => 1982 1...
Stack Exchange automagically detects serial voting (when one user either upvotes or downvotes many of another user's posts) and reverses it. In this challenge, you will implement a very, very simple "serial vote" detector. Input The input is a string representing a list of votes. Every group of two characters represent...
Challenge: write a single script file foo.cmd which can be invoked from the vanilla Windows cmd.exe prompt (not PowerShell, not in administrator mode), to execute arbitrary Windows-specific code... > .\foo.cmd Hello Windows! ...but also be invoked unaltered from a typical POSIX-compliant (Linux/OSX) shell prompt (ba...
Input Two dates, each comprising of a month (Dec or Jan) and a day (01-31). These will be given as 4 integers (12 01 01 01, for example), in any reasonable format you choose (leading zeroes, no leading zeroes, list, individual inputs, list of lists, etc.). The first date is supposed to represent today's date. Output I...
In Dungeons & Dragons, almost everything is decided by rolling a die. Typically, if the roll is greater than or equal to a specified value, your attempt at doing whatever you wanted to do succeeds, and fails otherwise. Most commonly, a 20-sided die (aka d20) is used to roll. Other times, the skill challenge system is u...
Introduction If you're not familiar with Hexagony, it's an esoteric language created by Martin Büttner. The thing is that this language accepts multiple forms for the program. The following programs are all equivalent: abcdefg and a b c d e f g So basically, the code has been rolled up into a regular hexagon. But n...
Apply an indefinite integral to a given string. The only rules you will be using are defined as such: ∫cx^(n)dx = (c/(n+1))x^(n+1) + C, n ≠ -1 c, C, and n are all constants. Specifications: You must be able to integrate polynomials with any of the possible features: A coefficient, possibly a fraction in the format ...
Center The Text! In this challenge you will be centering various lines. Examples Foo barbaz Foo barbaz Hello World Hello World Programming Puzzles & Code Golf Programming Puzzles & Code Golf Specifications Each input line will always have at least one non-whitespace character, you may assume the on...
Let's play Russian Roulette! Normally, this would be a race to write the shortest MOD 6 program, but that's not very realistic, as the chance of winning decreases with each click. Here are the rules: Emulate a real six-shooter: A single bullet is placed into one of the six chambers, and the barrel is spun once, onl...
The cofactor matrix is the transpose of the Adjugate Matrix. The elements of this matrix are the cofactors of the original matrix. The cofactor (i.e. the element of the cofactor matrix at row i and column j) is the determinant of the submatrix formed by deleting the ith row and jth column from the original matrix, mul...
Your task is to program a robot so that it reaches the hole in the ground on each of the maps within reasonable time. If the robot reaches the hole, it falls down into it and thus victory is assured, even if the program never stops running. Since the robot has to be programmed by manually punching in ones and zeroes, y...
In this code golf, you will have to determine the direction of the shortest shot that hits exactly n cushions before falling into a pocket. The billiard table is a 6 pocket pool table with the following characteristics: Dimensions are variable (a x b) No friction : the ball will roll forever until it falls into a pock...
Duolingo, the language learning app, has a lot of things going for it, but there is one major issue that drives me crazy. It tells me how many days in a row I've used the app with a message like You're on a 7 day streak! Setting aside hyphenation and whether the number should be spelled out, this works fine for most nu...
The nth Motzkin Number is the number of paths from (0, 0) to (n, 0) where each step is of the form (1, -1), (1, 0) or (1, 1), and the path never goes below y = 0. Here's an illustration of these paths for n = 1, 2, 3, 4, from the above link: The desired sequence is OEIS A001006. OEIS has some other characterizations o...
Your task is to output a single number; the number of ISO weeks that a given date range intersects. To quote Wikipedia: An average year is exactly 52.1775 weeks long, but this is not about the average. Input consists of two space-separated ISO dates: 0047-12-24 2013-06-01 The end date is never before the start date. W...
Drawing the Sierpinski triangle has been done to death. There's other interesting things we can do with it though. If we squint hard enough at the triangle, we can view upside-down triangles as nodes of a fractal graph. Let's find our way around that graph! First, let's assign a number to each node. The largest upside-...
Introduction In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on. You can see that the first appearence of 15 starts at the 20th decimal: Position 00000000011111111112222222222333333333344444444445555555555666...
This is inspired by one of Downgoat's questions in Sandbox, where I suggested that he include April 31 as Pi day for people who use day/month format, only for him to inform me that there is no April 31! Given a date string in month/day format that might be invalid, output the correct date using rollover. (First rollove...
In this challenge you will be converting a mixed number to an improper fraction. Because improper fractions use fewer numbers, your code will need to be as short as possible. Examples 4 1/2 9/2 12 2/4 50/4 0 0/2 0/2 11 23/44 507/44 Specification You may assume the denominator of the input will never be 0. The inpu...
In this challenge posed by xnor, we were asked to implement XOR multiplication. In this challenge the goal is to find the first n XOR primes. XOR primes are very similar to regular primes as you can see by the following definitions: Definition of Prime Number: A positive number greater than 1 which cannot be formed thr...
If you like this, consider participating in: The Official Dyalog APL 2016 Year Game The monthly Dyalog APL 2017 Code Golf Challenge Make 12 snippets/expressions, in the same language, that result in the numbers 0 through 10, and 42 respectively, but without writing any literal numeric, string, or character data. Bui...
Because there are not enough simple code-golf challenges: Create an optionally unnamed program or function that, given (by any means) an integer 1 ≤ N ≤ 10000, outputs your language's True value with a pseudo-random probability of 1/N, False otherwise. Please note that the requirement for naming has been removed. Feel ...
Let's map some strings to 2d space, fractal style. Your task is to compute a Hilbert curve and lay a string along it. Task The task is to take the single-line input string, and lay it out along a Hilbert curve big enough to contain it, but no bigger. Try to make the byte count as low as possible; this is code-golf aft...
Santa's Decision: In this challenge, you will help Santa Claus decide whether somebody on their list has been naughty or nice, and subsequently get coal or toys. But unfortunately, Santa is unorganised, in some of his entries, the naughty, nice and name fields are in the wrong order. Input Input will come in the follo...
Challenge You just bought a brand new chair! Problem is, you have no idea how to control it so you'll need to write a program to do it for you. You can only sit in the unadjusted chair for so long. So your code will need to be as short as possible. Examples 5,3,2,2,1 O | | | _ | | |_|_ | | O 3,5,2,3,5 O | _...
What general tips do you have for golfing in Prolog? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Prolog (e.g. one letter variables is not specific to Prolog to reduce the size of programs). Please indicate in your tips if it is specific to an imple...
Yes, how much, not how many... As we all know, a large present is far better than a small one. Therefore, the value of the presents should always be measured in total volume, not number of presents, weight, or even combined price. As it's frowned upon to compare the amount of presents one gets, you don't want a long s...
Background Due to some unfortunate accident during coding you are now teleported and stranded on an alien planet. You really hope that the locals will be helpful and point to the general direction of how to get home, but before trying to talk to them you want to decipher their language. Fortunately it looks like the al...
A Caesar shift is probably something we're all familiar with. (You might be even doing it as a homework task. If so, please don't copy these answers, your teacher almost certainly doesn't want anything like the answers here.) Just in case you aren't, a Caesar shift is a very simple form of cipher. It takes a string to...
"Counter" is a language I've created for the purpose of this question. Rules Commands are read from left to right from the first character. Each command may be executed as it is read, or you may execute all commands together at the end. In case of an error, all commands up till the error must be executed. A program is...
Draw a program or function that will write to STDOUT n times (each for one step) a string that contains a dot . at the location of the walker. The program also needs to write a line every s seconds (or wait s seconds after each line). A random walk is a mathematical formalization of a path that consists of a succession...
You will be given two pieces of input: a string in run-length encoded format defining the running track, and a capital letter representing the lane to start from. For example, the string "3a4A6b5B" expands to "aaaAAAAbbbbbbBBBBB". You then use the expanded string to create a track, as such: A) aaaAAAA B) bbbbbbBBBBB ...
2013 has the prime factorization 3*11*61. 2014 has the prime factorization 2*19*53. An interesting property regarding these factorizations is that there exist distinct primes in the factorizations of 2013 and 2014 that sum to the same number: 11+61=19+53=72. Write a program or function that takes as its input two posit...
Write an interpreter for 2B I like David Catt's esoteric language 2B, having memory stored in a tape where each cell is a seperate tape of bytes (the 'subtape'). Write an interpreter for it! Language Specification Official specification can be found here. In this specification, " means a number in the range 0-9 (0 is i...
In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation: The large numbers are all the digits that appear in the current date in their usual order, and the small numbers are 1-based indices of the occurrences of that digit. So the above example represents 2013-02-27. ...
In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation: The large numbers are all the digits that appear in the current date in their usual order, and the small numbers are 1-based indices of the occurrences of that digit. So the above example represents 2013-02-27. ...
In this challenge, you will receive an input, convert it to hexadecimal, make a couple changes, and output the result. Because they are only 16 characters in hexadecimal, your code will need to be as short as possible. Examples Examples are separated by a blank line. First line is input, second line shows the steps, t...
Task Given input N, generate and output an NxN grid where each row, column and the two diagonals contain the numbers 1 to N (or 0 to N−1 if that's easier). Input The input is a positive integer N. It represents the number of columns and rows in the grid. For this problem, you can assume N will be a reasonable size, 4 ≤...
Introduction Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, naughty, very naughty or very very naughty. To determine how nice or naughty someone is, Santa had developed an algorithm: Nice (division, math): First of all, we obtain a number fro...
The Cheela (from the book Dragon's Egg by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they naturally use a base-12 numbering system. Among the Cheela, care of the hatchlings and education of the young are tasks carrie...
Here in California, we're in a drought so we need to know how much water we have left so we can conserve as much water as possible. Because water is limited supply, your code will need to be as short as possible. Examples | | | | |~~~| |___| Output: 0.5 |~~~~~| | | | | |_____| Output: 1 | | |__| Outpu...
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...
A double precision representation of a decimal can only guarantee an accuracy of 15 decimal places, thus pi is approximated as: 3.141592653589793 You can see that the digit 3 is in positions 1, 10, 16, the digit 1 is in positions 2, 4 etc. Challenge Your task is to create a program or function that creates a random d...
Everyone knows that cats go meow, but what many don't realise is that caaaats go meeeeoooow. In fact, the length of the vowel sounds that the cat makes are dependant on the length of the vowel with which you address it. In the same way, cows go moo, but coooows go moooooooo Challenge You are to write a program that tak...
Description Write a function f(m, G) that accepts as its arguments a mapping m, and a set/list of distinct, non-negative integers G. m should map pairs of integers in G to new integers in G. (G, m) is guaranteed to form a finite abelian group, but any element of G may be the identity. There is an important theorem that...
Obviously, code golfing is all about making the most of the least code. Who really cares what the actual output is? While we have had a challenge for highest input-to-output ratio, this is a call for most finite and deterministic output with given code lengths. Ironically, this challenge is then not code-golf. Rules: ...
For once, I was doing some real work, updating old code, and bumped into an expression that is equivalent to what would be written as πx + ex in good old-fashioned math. I thought it would be possible to write it shorter than it was written in the language I work with (APL), and therefore present this very simple chall...
Inspired by this wonderful (based on the number of views and votes) challenge, which, in my humble opinion, has way too few answers. Given (by any means) a list of strings, return (by any means) a set of letters that, when removed from the given strings, leaves the total length of (what remains of) the strings as small...
A simple code golf challenge similar to an already existing, but more complex one: Wait for user to press enter. Wait for user to press enter again. Print the elapsed time between the 1. and 2. Wait an equal amount of time Print the actual elapsed time of 4. Order of 3. and 4. is not important. Notice that the second...
The task here is to read from a Golly .rle or plaintext file (your choice) whose filename is provided (on STDIN or as a command line argument) and identify and count the common patterns in the grid encoded therein. Alternatively, you may choose to have the contents of the file provided directly over STDIN instead. Your...
Objective Write a full program that outputs (to STDOUT or closest alternative) an arbitrary string of text, no more than 64 characters long. Simple enough, right? Well, here's the catch: You may not use any characters that were present in the previous answer's output. That's right, none of them. Thus, you are trying to...
An linear discrete convolution is an operation that turns two vectors of numbers into a third vector of numbers by multiplying elements inside-out. Formally, for two vectors a and b with elements 0 to n - 1, the discrete linear convolution of a and b can be computed with this loop: for i = 0 to 2*n - 2 c[i] = 0; ...
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...