Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [grid]

For challenges involving a grid.

130
votes
22answers
10k views

Red vs. Blue - Pixel Team Battlebots

This contest is officially over. The Blue Team won! I autoran two sets of 50 battles and amazingly, Blue won all 100 of them. Looking at the stats, it is clear that the cooperative entries of ...
103
votes
31answers
10k views

Formic Functions - Ant Queen of the Hill Contest

Watch live | Active answers | Add new answer | Chat room | Source code | Leaderboard New tournaments whenever needed. New players and new updates very welcome. Not actual game footage. Each player ...
57
votes
48answers
12k views

Display the Hacker Logo

You may have heard of the "Hacker Logo", also called the "Hacker Emblem". It looks like this: This is a pattern from a mathematical simulation called the Game of Life. The glider is the simplest Life ...
57
votes
56answers
6k views

Print N Squared

Write a program or function that takes in a non-negative integer N from stdin or as a function argument. It must print or return a string of a hollow ASCII-art square whose sides are each made with N ...
57
votes
9answers
8k views

Is my prison secure?

Your challenge is given an input of a prison layout to work out whether any of the prisoners can escape. Input Input may be in any reasonable format such as a string, array, array of arrays etc. The ...
54
votes
17answers
4k views

Fill in the Minesweeper clues

Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Each tile is either a mine (represented by *) ...
48
votes
6answers
4k views

Language Design: 2-D Pattern Matching

This is Fortnightly Challenge #6. Theme: Language Design There's a chatroom for this challenge. Come and join us if you want to discuss ideas! And now for something completely different... This ...
47
votes
2answers
3k views

Shortest universal maze exit string

A maze on an N by N grid of square cells is defined by specifying whether each edge is a wall or not a wall. All outer edges are walls. One cell is defined as the start, and one cell is defined as the ...
46
votes
8answers
3k views

N-movers: How much of the infinite board can I reach?

Single moves The board is an infinite 2 dimensional square grid, like a limitless chess board. A piece with value N (an N-mover) can move to any square that is a distance of exactly the square root ...
44
votes
6answers
2k views

There's an ant on my Rubik's Cube

A standard, solved, 3×3×3 Rubik's Cube has 6 differently colored faces, where each face is a 3×3 grid of squares of one color. The white face is opposite the yellow, the red opposite ...
43
votes
6answers
2k views

Island Golf #1: Circumnavigation

This is the first in a series of Island Golf challenges. Next challenge Given an island in ASCII-art, output an optimal path to circumnavigate it. Input Your input will be a rectangular grid ...
42
votes
1answer
7k views

Rearranging Words

You should write a program which receives two strings as input and outputs a sequence of movements which rearrange the first string into the second. You should use as few moves as you can. Both ...
42
votes
8answers
2k views

Dennis, Doorknob, Martin Büttner, Chris Jester-Young - Pizzeria!

Programming Puzzles & Code Golf is about to get a new moderator, Dennis! This challenge is a tribute to him and our other active (or recently active) moderators: Doorknob, Martin Büttner, and ...
41
votes
5answers
3k views

Block Building Bot Flocks!

The contest is over! Intro This is an interactive king-of-the-hill contest where the controller is fully contained in a Stack Snippet at the bottom of the question. The controller automatically ...
40
votes
8answers
6k views

40 Numbers in 9 Bytes

There are 40 ways a directed Hamiltonian path can be arranged on a 3×3 grid: This graphic (thanks Sp3000!) shows only the 20 undirected paths. Traverse each colored line in both directions for ...
38
votes
8answers
2k views

Can I Slide Apart The Puzzle?

Write a program or function that takes in a rectangular grid of text where every cell is either an A or a B. All the ...
37
votes
19answers
3k views

Chebyshev Rotation

Consider a regular grid, where each cell has integer coordinates. We can group the cells into (square-shaped) "rings" where the cells in each ring have the same Chebyshev distance (or chessboard ...
37
votes
5answers
3k views

Will I make it out in time?

Inspired by this. Background The evil farmer has decided to burn your wheat field down in order to drive up the prices. To ensure total destruction, he has also soaked your field in gasoline. Even ...
36
votes
1answer
1k views

“Fill the Grid” Problem

A challenge with simple rules but non-trivial algorithms. :-) Task Take input in the form of space-separated integers: N A B S Where N is the side length of a ...
35
votes
6answers
3k views

Where is that snake going?

Write a function (using as few bytes as possible) that takes a bi-dimensional array of any number of columns and rows in which: 0 represents empty block, ...
35
votes
4answers
3k views

Infinite Labyrinths

Background You are the apprentice of a powerful wizard, and your master is currently developing a spell for creating an inter-dimensional labyrinth to trap his enemies in. He wants you to program his ...
35
votes
8answers
977 views

Fizz Buzz for Turtles

Problem Description Imagine you're a turtle on a grid. You're given two numbers f and b, and you're facing east. You perform a march across the grid, counting each of the cells you encounter, ...
33
votes
18answers
5k views

A Numpad's Knight Numbers

For the non-zero digits on a standard numpad 789 456 123 consider placing a chess knight at any digit and moving it around with any number of normal L-shaped ...
33
votes
10answers
2k views

Verify a Minesweeper board

Your goal is to check whether a completed Minesweeper board is valid. This means that each number is a correct count of mines in cells adjacent to it, including diagonals. The board does not wrap ...
33
votes
6answers
1k views

Grid Based Digital Logic (Duodyadic Tiles)

Duodyadic tiles are kinds of square function blocks that take two inputs, one from their top side and one from their left side, and have two outputs, one on their right side and one on their bottom ...
33
votes
5answers
2k views

Gravity simulator

Statement You are given a still of a series of balls falling in a 2D grid. This grid is surrounded by immutable and unbreakable walls so all the action in contained within them. Your task is to ...
32
votes
6answers
2k views

Tic-tac-toe with only crosses

Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row ...
32
votes
5answers
2k views

Chain reaction of bombs

Introduction: Before the task, here is what every element does on the map: Plain land (X): This does nothing. Destroyed land (...
31
votes
4answers
3k views

Invert a Minesweeper Board

Minesweeper is a popular computer game that you have probably wasted time playing where you try to reveal the cells that are mines in a rectangular grid based on hints of how many neighboring mines ...
31
votes
5answers
1k views

Recognize a vine

Background I have a bunch of old and grainy black-and-white images. Some of them depict vines climbing on a wall, others don't – your task is to classify them for me. Input and output Your ...
30
votes
14answers
7k views

Kill it With Fire

Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro. I am an evil farmer, and to drive up the price of wheat in my area, ...
30
votes
9answers
2k views

Uniquely separated pixels

For an N by N image, find a set of pixels such that no separation distance is present more than once. That is, if two pixels are separated by a distance d, then they are the only two pixels that are ...
30
votes
12answers
892 views

Walk the words!

It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words! Walking words Walking words are words which will respond to certain characters. ...
30
votes
3answers
1k views

A Turtle Finds a Portal

The turtle wants to move along the grid to get to his food. He wants to know how many moves it will take for him to get there. As well since he is slow he has teleporters set up around his domain ...
30
votes
5answers
1k views

Integers, Assemble!

Your task is to assemble the integers from 1 to N (given as input) into a rectangle of width ...
29
votes
11answers
3k views

How many towers can you see?

This question is based on the number-placement puzzle Towers (also known as Skyscrapers), which you can play online. Your goal is to take a solution to the puzzle and determine the clues -- the ...
29
votes
24answers
1k views

Very Simple Grid Marks

Write a program or function that takes in three positive integers, W, H, and N. Print or return a W×H grid of .'s where every Nth ...
29
votes
6answers
2k views

Can I sweep the mines?

Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One ...
29
votes
3answers
1k views

Stuffing primes in a box

Your task is write a program or function that can fill a given rectangle with prime numbers. The width and height of the ...
29
votes
8answers
3k views

Are you in the biggest room?

Introduction You have recently accepted a job offer at a Pretty Good Software Company. You're pretty content with the size of your office, but do you have the biggest office? Its kinda hard to tell ...
28
votes
15answers
2k views

Illustrate the square of a binomial

Given (by any means) two different natural numbers (of any reasonable size), output (by any means) the square of their sum as in the examples below: Given 4 and 3, output: ...
28
votes
6answers
1k views

Team of The Hill!

This challenge was inspired by @HelkaHomba's excellent challenge Red vs. Blue - Pixel Team Battlebots. That challenge was probably the best one I've seen on this site. Ever. My challenge is still a ...
27
votes
9answers
2k views

ASCII rhombic grid

Write the shortest code measured by byte count to generate an ASCII grid composed of rhombi, given the following parameters: m - number of complete rhombi in one row n - number of rows s - side of ...
27
votes
3answers
655 views

Clean the muddy quartata-fish

This challenge is in honor of the Rookie of the Year category winners of Best of PPCG 2015: muddyfish (for I'm not the language you're looking for!) and quartata (for Implement a Truth-Machine). ...
27
votes
4answers
675 views

Find my word(s)!

The idea of this challenge is to find all the words from a dictionary on a grid of letters. Your input should come from stdin or function arg and will come in the following format: ...
27
votes
3answers
479 views

Filling Arbitrary Ice Cube Trays

Suppose this grid of spaces and X's represents the cross section of some strangely shaped empty ice cube trays: ...
26
votes
25answers
4k views

Output a Sudoku board

Today's challenge is simple: Without taking any input, output any valid sudoku board. In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like: The objective ...
26
votes
8answers
2k 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 ...
26
votes
5answers
710 views

The Traveling O

The world is a five by five array of cells. It wraps on all sides. It can be visualized like... XXXXX XXXXX XXOXX XXXXX XXXXX You are an O. You love to travel the world, and you do so according to ...
26
votes
3answers
2k views

Game of Life arrowslits

Background This challenge is in honor of apsillers, who won the Not as simple as it looks category in Best of PPCG 2016 with their challenge Can my 4-note music box play that song? Congratulations! ...