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.

19
votes
2answers
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 ...
20
votes
5answers
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 ...
12
votes
13answers
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 ...
17
votes
8answers
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 ...
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 ...
24
votes
5answers
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 ...
13
votes
3answers
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 ...
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! ...
8
votes
2answers
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: ...
24
votes
11answers
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 ...
18
votes
8answers
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 ...
22
votes
4answers
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 ...
14
votes
2answers
381 views

Find the inside of a Loop

Task Given a ASCII diagram of a loop e.g. ...
11
votes
12answers
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 ...
19
votes
2answers
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 ...
18
votes
5answers
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 ...
21
votes
20answers
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 (...
15
votes
11answers
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 ...
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 ...
11
votes
4answers
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 ...
19
votes
24answers
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 ...
13
votes
1answer
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 ...
30
votes
12answers
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. ...
14
votes
1answer
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 ...
35
votes
8answers
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, ...
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 *) ...
7
votes
8answers
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 ...
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 ...
14
votes
1answer
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 ...
22
votes
1answer
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 ...
17
votes
6answers
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 ...
14
votes
10answers
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 ...
24
votes
8answers
854 views

Highlight the Bounding Box, Part II: Hexagonal Grid

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

Highlight the Bounding Box, Part I: Cartesian Grid

You're given a rectangular grid of the characters . and #, like this: ...
25
votes
1answer
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 ...
22
votes
10answers
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 ...
14
votes
9answers
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': ...
18
votes
4answers
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 ...
18
votes
4answers
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 ...
11
votes
2answers
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 ...
25
votes
51answers
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 ...
7
votes
1answer
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 ...
9
votes
1answer
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 ...
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 ...
17
votes
3answers
622 views

Lead Your Turtle by a String

Write a program or function that takes in a nonempty single-line string of printable ascii characters excluding space: ...
9
votes
5answers
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 ...
10
votes
3answers
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 ...
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 ...
7
votes
2answers
436 views

Generate ASCII TetraVex

TetraVex is a tile-based edge-matching game that was originally coded by Scott Ferguson for the Microsoft Entertainment Pack 3 back in 1990. The game consists of a grid upon which square tiles are ...
12
votes
1answer
405 views

How many squares are there?

This challenge is inspired by a picture that often roams on Facebook that looks like this. Except our base square will look more like this: ...