# Questions tagged [grid]

For challenges involving a grid.

225 questions
254 views

### Island Golf #2: The Eccentric Hermits

This is the second in a series of Island Golf challenges. Previous challenge Two hermits have arrived on a desert island. Since they came seeking solitude, they wish to live as far away from each ...
1k views

### ><> Out of Water

The beloved fish who swims through the code of ><> (an esoteric programming language) has been taken out of its natural environment. This change has rendered it incapable of moving around in the ...
1k views

### Return neighbors index in an 3x3 grid

Alright, my second attempt at a code golf, let's see how this goes. Pretend you have an array of 9 values. Now imagine that array in a 3x3 grid. You need to return neighbors that number has as ...
2k views

### How Many Holes?

Challenge Given a graphical input of a shape, determine how many holes there are in it. Not Duplicate This question was marked as a possible duplicate of Count Islands. I believe this challenge is ...
2k views

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 ...
477 views

### How great is your land?

In this challenge, you'll calculate how great your land is. Write a program or function that calculates the size of your land, given a wall you have built. You're given a non-empty input string ...
577 views

### Grids can be curvy. How long is yours?

Consider depicting a simple, open, two-dimensional curve on a W wide by H high grid of text where X represents part of the curve and ...
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! ...
318 views

### Do the figures fit?

Challenge Make the shortest program to determine if the figures in the input will fit into the space in the input. Requirements The input will be in the format of this example: Input: ...
1k views

### Counting unit squares circle passes through

Write a program or function that given an integer radius r returns the number of unit squares the circle with radius r centered at the origin passes through. If the circle passes exactly through a ...
607 views

### The beautiful pattern drawer (Little cubes included)

The beautiful pattern drawer Good morning PPCG ! The other day, when I was trying to help someone on Stack Overflow, a part of his problem gave me an idea for this challenge. First of all, check ...
535 views

### Split a grid into a grid

Introduction There is a small village with nothing but a few houses and empty fields. The local bureaucrats want to divide the village into lots so that each lot contains exactly one house, and the ...
381 views

### Find the inside of a Loop

Task Given a ASCII diagram of a loop e.g. ...
449 views

### Match coordinates with their values

Given 3 input items, a list of coordinate pairs, a 2D string, and a single-character string, output whether the character at each coordinate of the 2D string is equal to the single character. You can ...
531 views

### Solve an Ice Maze

Ice mazes have been one of my favorite staples of Pokémon games since their debut in Pokémon Gold and Silver. Your task will be to make a program that solves these types of problems. Ice mazes ...
701 views

### Generate an ascii-art non-intersecting path

Given 2 integer inputs representing the size of the field, x and y, output a path through the field. Example output for ...
2k views

### Find all the coordinates on a path

Given a 2D string as input, either as a string with newlines or a list of lines, output the coordinates (x, y) of all the hashes (...
412 views

### Line up the Diagonals of a Grid of Text

Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use ...
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 ...
218 views

### Bouncey-edged XY box with a marker at Z

Long time lurker first time poster here. Write a program which takes 3 inputs: X, Y and Z. X = across (columns) Y = down (rows) Z = Location Marker The program should then print a visual grid X ...
3k views

### Grid ASCII art code golf

Challenge Create the shortest program that meets the requirements Requirements The code must generate a 5x5 grid of 0s, like so: 00000 00000 00000 00000 00000 ...
336 views

### Group these cells!

This challenge is based on the game Layerz. Given, on stdin or as a function argument, a 2D rectangular array of cells where each cell contains either a blank (you may choose to use 0s instead of ...
886 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. ...
429 views

### Taxicab in San Francisco

You are a taxicab driver in San Francisco. As is typical of taxicab drivers, you are navigating a grid where the only valid directions you can move are the left, right, up, and down. However, San ...
967 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, ...
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 *) ...
396 views

### Display a Connect Four game

Connect Four is a game where two players take turns to drop disks into columns of a vertically mounted grid, and attempt to connect four disks orthogonally or diagonally. When a column is chosen, the ...
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 ...
346 views

### Checkers: King Me?

Challenge: Given a checkerboard, output the smallest amount of moves it would take (assuming black does not move at all) to king a red piece, if possible. Rules: Red's side will always be on the ...
1k views

### Solve Grid-Tangram

The Tangram is a dissection puzzle made from seven shapes: Five differently sized triangles, a parallelogram and a square. Given a shape, the goal is recreating the shape using all the pieces and ...
832 views

### A cube of text ݀

Last time you made a square of text, but now, can you make a cube of text? The Challenge Given a string, output the string in the form of a cube. You can assume the string will always have 2 chars ...
399 views

### Find every digit from the largest column

Here's a relatively simple challenge for you: Given a list of positive integers: Line them up in a grid, and sum each column. For example, if the input was ...
854 views

### Highlight the Bounding Box, Part II: Hexagonal Grid

You're given a hexagonal grid of the characters . and #, like this: ...
1k views

### Highlight the Bounding Box, Part I: Cartesian Grid

You're given a rectangular grid of the characters . and #, like this: ...
2k views

### Figure Out the Android Lock Pattern

Lets say you saw your friend enter his or her password into their Android phone. You don't remember how they made the pattern but you remember what the pattern looks like. Being the concerned friend ...
3k views

### Is this square symmetrical?

Write a program or function that takes in a 4×4 text grid consisting of exactly 4 A's, 4 B's, 4 ...
1k views

### Code golf ABC's: The ASCII Box Challenge

Given two positive integers, 'a' and 'b', output an ascii-art "box" that is a characters wide and b characters tall. For example, with '4' and '6': ...
484 views

### Minimal Word Search

Last week, we worked to create the shortest 1-D string using the top 10,000 words in the English language. Now, lets try the same challenge in 2D! What you need to do is to take all of the above ...
533 views

### I've been alphabet hunting for a while

Y'know, we've had a lot of "alphabet" challenges recently. (one two three four five.) While I love a good challenge, and those challenges were very fun, I think it's time for a change of pace. We need ...
251 views

### Gauss to Eisenstein

Given a Gaussian integer A+B*i where A,B are integers and i = exp(2*pi*i/4) is the imaginary ...
2k views

### A square of text

The Challenge Given a string, output the text in the shape of a square. You can assume that the text will always fit in a square, and that it will never be an empty string. You can also assume it ...
264 views

### Count blocks in a 2D grid

Challenge description Let's define an W x H grid as a two-dimensional array of length H ...
234 views

### Move platforms!

The Challenge Given either a string (may have newlines), or a two dimensional array, and a positive integer n, output the position of the platforms ...
1k views

### Integers, Assemble!

Your task is to assemble the integers from 1 to N (given as input) into a rectangle of width ...
622 views

Write a program or function that takes in a nonempty single-line string of printable ascii characters excluding space: ...
1k views

### Flood-fill a 2D grid

Challenge description Let's call a two-dimentional, rectangular array (meaning its every subarray has the same length), a grid. Every unit of a grid is either an empty space or a border. In a grid of ...
392 views

### A Hundred Squares!

Back to basics... As a teacher at the local primary (grade?) school, you need a way to teach your class their times tables. At your disposal, you have hundred squares and a load of red pens. You need ...
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 ...