Questions tagged [generation]

a challenge to build objects (e.g. code, representation of real world objects) according to pre-defined rules and/or input (also often randomised).

Filter by
Sorted by
Tagged with
13 votes
11 answers
2k views

Generate an emoticon

Your task is to generate an emoticon of three characters, the first character being one eye, the second the mouth, and the third another eye. Each eye is a random one of these characters: ...
Peter's user avatar
  • 987
5 votes
7 answers
834 views

Typo resistant pin codes [closed]

Background I was working on a system where for convenience (not security) people could use four digit codes to identify themselves. I figured this is something that may actually be useful in many real ...
Dennis Jaheruddin's user avatar
11 votes
3 answers
360 views

Help me count the Omer

During the 49 days between Passover and Pentecost, Jewish liturgy provides four numerical problems that I've here phrased as code golf problems. Input/Arguments These four, in any order, and by any ...
Adám's user avatar
  • 30.1k
29 votes
10 answers
2k views

Help Stack Exchange transpose tables

Stack Exchange doesn't know how to transpose tables. Let's help. Given a markdown table, transpose it. Input assumptions: There will be at least two rows (including header) and two columns Either all ...
Adám's user avatar
  • 30.1k
18 votes
20 answers
4k views

Generate Gmail Dot-Aliases

Background You may be aware that periods in between letters in gmail addresses are ignored. Email sent to [email protected], [email protected], and [email protected] all end up in the same ...
Conor James Thomas Warford Hen's user avatar
16 votes
7 answers
2k views

Borderless table

In this challenge you are going to place letters from the alphabet in a Cartesian plane and output the result as a text. Your input will consist in a list of list with 3 parameters: X coordinate Y ...
Luis felipe De jesus Munoz's user avatar
6 votes
5 answers
434 views

Generate the k-ary necklaces of length n

The set of necklaces is the set of strings, where two strings are considered to be the same necklace if you can rotate one into the other. Your program will take nonnegative integers ...
Christopher King's user avatar
6 votes
1 answer
486 views

Stereographic projection of polyhedra

You will create a program that generates the stereographic projection of polyhedra. In particular, to keep things simple, we'll only focus on n-chamfered dodecahedron. Given a natural number ...
Christopher King's user avatar
7 votes
3 answers
455 views

Generate random LTL Formulae [closed]

An LTL Formula l is defined by the following grammar (where <x> describes the non-terminal symbol x): ...
Sacchan's user avatar
  • 701
16 votes
4 answers
1k views

Lorem Ipsum Generator [closed]

Lorem Ipsum is placeholder text used when preparing layout without wanted to have content already filled. One of its key features over using some arbitrary text is that it is nonsense. It isn't even ...
Frames Catherine White's user avatar
16 votes
11 answers
1k views

Generate a US License Plate

Given one of the following as input: AK,AR,AS,AZ,CA,CT,DC,FL,GA,IL,IN,IA,KS,KY,LA,MD,MI,MN,MS,NV,NH,NJ,NM,NY,NC,ND,MP,OH,OK,OR,PA,PR,RI,SC,TN,TX,UT,VT,VA,WA,WI (...
Stephen's user avatar
  • 13.8k
30 votes
19 answers
3k views

N-dimensional identity "matrix"

Given a positive integer n, output the N-dimensional identity "matrix", which is the N^N ...
Leaky Nun's user avatar
  • 49.7k
22 votes
35 answers
1k views

All the k-mers/n-grams

Intro We have had histograms and counting, but not listing all of them. Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic ...
Adám's user avatar
  • 30.1k
13 votes
19 answers
1k views

Simple CSV/DSV importer

Slightly more than an inverse of this. In: Multi-line DSV data and a single delimiter character. The DSV may be taken as a file, a filename, line-break separated string, list of strings, etc. ...
Adám's user avatar
  • 30.1k
68 votes
61 answers
7k views

N-dimensional N^N array filled with N

In: Enough memory and a positive integer N Out: N-dimensional N^N array filled with N, where N^N means N terms of N-by-N-by-N-by... Examples: 1: [1] ...
Adám's user avatar
  • 30.1k
16 votes
2 answers
488 views

Ways of specifying random generation in challenges

Note: As per consensus on Meta, challenge-writing questions are on topic here. In light of this "thing to avoid when writing challenges", I started to think about challenges involving random ...
Zgarb's user avatar
  • 42.6k
17 votes
21 answers
1k views

Generate a 6 character string from a 15 character alphabet

In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one ...
James Webster's user avatar
4 votes
6 answers
323 views

Convert header levels to numbers

Introduction Nodes in tree structures (e.g. headings in a long document, law paragraphs, etc.) are often created by assigning a specific header level (h1, h2, etc.) to each item, but outputted with ...
Adám's user avatar
  • 30.1k
5 votes
5 answers
297 views

Sample win/loss data generator based on certain criteria

Lets say we have this existing data: Total - 10 Won - 7 Lost - 3 Longest Winning Streak - 5 Longest Losing Streak - 2 Now you need to write a function which ...
Farhan Anam's user avatar
25 votes
8 answers
3k views

Fill the rows, columns, and diagonals of an NxN grid with 1 through N

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 ...
hargasinski's user avatar
73 votes
84 answers
6k views

No strings (or numbers) attached

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 ...
Adám's user avatar
  • 30.1k
13 votes
3 answers
471 views

Generate a Monotonic Function

Overview In this challenge, your task is to randomly generate a monotonic mathematical function between two sets. Input Your inputs are two positive integers s ...
Zgarb's user avatar
  • 42.6k
14 votes
6 answers
1k views

Generate a Rectangle from a Specification

Introduction This challenge is inspired by Grime, my 2D pattern matching language. Basically, you are given a "grammar" that describes two-dimensional grids of characters, and your job is to generate ...
Zgarb's user avatar
  • 42.6k
21 votes
8 answers
2k views

Rubik's Cube Scrambles

Your task is to create a random sequence of moves, which can be used to scramble a Rubik's Cube. Such a scramble is made up of exactly 25 moves. Each move consist of of the letters ...
Jakube's user avatar
  • 21.9k
2 votes
1 answer
492 views

String generator based on a wildcard [duplicate]

Your task, if you accept it, is to make a string generator that generates strings based on a wildcard. You can make a function or a full program that receives 1 argument and sends to the standard ...
Ismael Miguel's user avatar
7 votes
1 answer
888 views

Generate Loopy puzzles

Loopy is a puzzle game from the collection of Simon Tatham. The previous link contains a javascript implementation of a Loopy puzzle generator. I suggest everybody who wants to attempt this challenge ...
FUZxxl's user avatar
  • 10.1k
17 votes
24 answers
6k views

Generate me some appropriate license plates!

The scenario: You are a software designer working for a gov't-run company that designs license plates for cars and other vehicles. You've been asked to develop software that generates license plates. ...
DatEpicCoderGuyWhoPrograms's user avatar
8 votes
10 answers
1k views

Generate four type-4 GUIDs for me

The type 4 GUID is described by Wikipedia, quoth: Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the version number (4 bits) as well as two reserved bits. All ...
billpg's user avatar
  • 2,055
19 votes
2 answers
3k views

Mastermind strategy

I could only find code-golf challenges for Mastermind, so here's a code-challenge version that I would have liked to take on myself. An optimal strategy for the normal Mastermind game, MM(4,6), was ...
MrBackend's user avatar
  • 406
0 votes
3 answers
278 views

Create a Question Asker! [closed]

Writing questions for programming puzzles is tiring and takes many minutes to do. This is where you come in. Your job is to write a program that randomly generates plausible-sounding (but not ...
qwr's user avatar
  • 12.1k
53 votes
33 answers
11k views

Avoid the evil integers! [closed]

You are developing some code to generate ID numbers. Policy requires that no ID numbers include the digit sequence 666. Create a function (or your language's equivalent) which takes a positive ...
billpg's user avatar
  • 2,055
6 votes
6 answers
5k views

Generate random PESEL number

From Wikipedia: PESEL is the national identification number used in Poland since 1979. It always has 11 digits, identifies just one person and cannot be changed to another one. It has ...
syntagma's user avatar
  • 161
20 votes
57 answers
7k views

Random ticket code generator

A lottery company wants to generate a random lottery ticket number of length 10 characters. Write a code in any language to create such a number in which every digit comes only once for example ...
Ankush's user avatar
  • 379
15 votes
20 answers
1k views

Histogram generation

Write the shortest program that generates a histogram (a graphical representation of the distribution of data). Rules: Must generate a histogram based on the character length of the words (...
syb0rg's user avatar
  • 1,090
6 votes
12 answers
784 views

Make a colorful table

For this challenge, you must accept input as a comma-separated list (columns) of a run (rows) of the first letters of any of the colors red, ...
Doorknob's user avatar
  • 71.4k
8 votes
9 answers
517 views

Generate information cards with titles

You must take input in the form of title|line1|line2|(...)|line[n] And output an information card. It's hard to explain how to make the card, so here's a quick ...
Doorknob's user avatar
  • 71.4k
17 votes
20 answers
2k views

Generate a grid of sums

Generate a 7 by 7 grid, filled with random numbers. However, in cells with an odd row and column number (starting at 0), you must use the sum of the surrounding cells. Here's a small example with a 3 ...
Doorknob's user avatar
  • 71.4k
11 votes
10 answers
2k views

Generate a right triangle

In this challenge, you must take two numbers (separated by a space) as input and output an ASCII right triangle, made up of xs. The first number will be the width ...
Doorknob's user avatar
  • 71.4k
19 votes
35 answers
6k views

Generate a pronounceable word

The challenge is simple: generate a word. Specifications: Word must be pronounceable. This is defined as "alternating between a consonant and a vowel." A consonant is one of the following letters: ...
Doorknob's user avatar
  • 71.4k
19 votes
2 answers
1k views

Compile Regexes

In this task you have to write a program that reads a regular expression and generates another program that outputs whether an input string is accepted by that regular expression. The output must be a ...
FUZxxl's user avatar
  • 10.1k
8 votes
6 answers
2k views

Generate ASCII wilderness map [closed]

Generate an ASCII wilderness map. Example output: ...
Tapio's user avatar
  • 231
6 votes
1 answer
1k views

Lorem Ipsum Random Code Generation [closed]

An IDE developer has hired you to write a program that generates (by printing to stdout) n lines of randomly generated code. They will use your program to create sample code for use in marketing their ...
Alex L's user avatar
  • 193
12 votes
3 answers
1k views

Create a multi-level 5x5x5 Labyrinth with only one solution

The aim of this challenge is to create the shortest code (in characters) that successfully do the following: Specifications: Must create a 5x5x5 labyrinth with ...
ajax333221's user avatar
  • 3,634
21 votes
15 answers
10k views

Generate a random program in your favorite language [closed]

We all heard of testing compilers using randomly generated inputs. Your task is to write a program to generate a valid program (including no undefined behavior) in your favorite language. The ...
Alexandru's user avatar
  • 6,136
8 votes
7 answers
1k views

Find all number pairs that sum to 121212 [closed]

This problem is quite easy to do by brute force. In fact, it'll be reasonably fast to brute force as well. But where's the fun in that? The Problem Produce a list of all unique 5 digit number ...
ircmaxell's user avatar
  • 919