Stack Exchange Network

Stack Exchange network consists of 174 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.

12
votes
2answers
254 views

Rotation-safe Latin squares

A Latin square is a square that has no repeated symbols in either the X or Y columns. For example: ABCD DABC CDAB BCDA is one such square. Notice how every ...
8
votes
3answers
376 views

One-to-one correspondence between pairs of integers and the positive integers

It is well-known that there are one-to-one correspondences between pairs of integers and the positive integers. Your task is to write code defining such a correspondence (by defining a pair of ...
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 ...
19
votes
1answer
680 views

Seeking Leapers

I recently got a really weird irregular chess board. It's squares are all over the place and not even all connected. At least they're still laid out on a regular grid. I want to adapt the chess rules ...
19
votes
6answers
1k views

Stable Game of Life

Challenge: Given a matrix (or 2d array) of 0s and 1s, output the number of steps it takes for Conway's game of life to reach a stable state, or -1 if it never reaches one. A stable state is a state ...
24
votes
8answers
913 views

KOTH: Everybody loves tokens

In this game two players compete to eat the most points worth of tokens, but there's a twist! Eating multiple tokens in a row of the same color gives an ever-growing bonus, but watch out, or your ...
21
votes
9answers
2k views

Rectangle Detection

Write a program or function that takes in a multiline string of 0's and 1's. No other characters will be in the string and the ...
27
votes
3answers
651 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). ...
18
votes
3answers
226 views

Highest score on the field

Introduction Let a field be a rectangle filled with only the characters - and [0-9]. An example of a field is: ...
17
votes
5answers
389 views

Go to opposite corner of rectangle in all directions - Harder

This is essentially the same thing as this question, except harder. You are again to write a program that gets from the lower-left corner of a rectangle to the upper-right corner. However, this time ...
13
votes
13answers
714 views

Optimal solution to go to opposite corner of a rectangle

Your job is to write a program that finds the optimal number of moves it takes to get from the lower-left corner of a rectangle to the upper-right corner directly opposite. Your program will accept ...
14
votes
5answers
221 views

Identify arborally satisfied point sets

An arborally satisfied point set is a 2D set of points such that, for any axis-aligned rectangle that can be formed using two points in the set as opposite corners, that rectangle contains or touches ...
10
votes
2answers
509 views

Tic-tac-toe with only crosses as quick as possible

As per Luke's request and Peter Taylor's addition to this challenge. Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only ...
8
votes
2answers
248 views

Count rectangle intersections

The Challenge Given an arbitrary amount of rectangles, output the total count of intersections of those when drawn in a 2D plane. An intersection here is defined as a point ...
15
votes
5answers
360 views

How far from the exterior?

Take a 2D region of space divided into axis aligned unit square elements with their centers aligned at integer intervals. An edge is said to be internal if it is shared by two elements, otherwise it ...
11
votes
3answers
351 views

Trilaterate your position

Introduction Imagine you are on a two dimensional cartesian plane and want to determine your position on it. You know 3 points on that plane and your distance to each of them. While it is always ...
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 ...
12
votes
2answers
295 views

Word Search Helper

I've been doing word searches recently, and I thought it would be so much easier if all of the words read left-to-right. But rewriting all the lines takes a lot of effort! So I'm enlisting code ...
17
votes
2answers
585 views

Cities: Sightlines

I'm at position (0, 0) of an infinite two-dimensional city, which is perfectly divided into blocks centered at each lattice point, some of which contain buildings. A building at a certain point (x, y) ...
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 ...
9
votes
1answer
143 views

Diagram of a leaper [duplicate]

Given an input of a pair of nonnegative integers describing a leaper in chess, output a diagram of the squares to which the leaper can move. From Wikipedia's description: An (m,n)-leaper is a ...
22
votes
3answers
880 views

Follow the dots

The Challenge Given a rectangular grid of characters A B C D E F G H I J K L M N O P Q R S T and a grid with the same dimensions of dots and spaces . . . . . . . . . . . Output ...
8
votes
2answers
272 views

Find the Words on the Grid!

Write a program or function that extracts a word from a wordsearch using its start and end coordinates. The Input Your program or function should accept three parameters: the start coordinate, the ...
18
votes
2answers
386 views

Find the haystack in the needles

In a twist on finding a needle in a haystack, you need to find the largest contiguous haystack containing exactly one needle. Note that you cannot connect cells on diagonals, only left/right/up/down. ...
18
votes
2answers
621 views

Chain words crossword-style

The challenge Given a list of words ["Programming", "Puzzles", "Code", "Golf"] output the words crossword-style: P r o g r a m m i n g u z ...
18
votes
1answer
215 views

Transpose a word cloud

Background I wanted to make a pretty word cloud, like this: these are words floating I computed the (x,y)-...
21
votes
3answers
503 views

Follow incomplete directions

A friend of yours has given you directions to the best restaurant in town. It's a series of left and right turns. Unfortunately, they forgot to mention for how long you need to go straight ahead ...
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 ...
21
votes
4answers
784 views

Count Mills in Nine Men's Morris

Introduction Nine Mens's Morris (also called Mills) is a board game for two players which is played on the following board (image taken from the linked Wikipedia-page): Each player has 9 men, ...
14
votes
2answers
877 views

Grocery Store Micromanagement

You are an employee at the hip new grocery store Half Foods, and it's the day before Thanksgiving Christmas Easter. Since the store will be packed with customers rushing to get their foodstuffs, the ...
15
votes
3answers
457 views

Where does the spaceship go?

Based on an idea suggested by Zgarb. A spaceship is moving around a regular 3D grid. The cells of the grid are indexed with integers in a right-handed coordinate system, xyz. The spaceship starts at ...
14
votes
1answer
147 views

The powerful connection

Introduction There is a plantation defined by one big square-board like this one: The numbers inside each small square represents its area's value/cash/... The farmer needs help to find the N ...
10
votes
1answer
263 views

The autopilot mode

A helicopter starting at the top left corner is descending (in a 2D space, for the purpose of this question) towards the ground. It has an autopilot mode and a manual mode. The autopilot mode behaves ...
32
votes
6answers
1k 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 ...
8
votes
6answers
1k views

A 4x4 Challenge

There exists a brain game called Enumerate (which I made, based on Takuzu). Your challenge is to play this game. Task Solve a game of 4x4 Enumerate/Takuzu. Receive a starting grid via STDIN or ...
16
votes
1answer
314 views

Can I live here?

In the game Terraria, one of the game mechanics involves building houses so that an NPC can move in. There is a strict set of rules for what counts as a valid house or not. Here is the list of rules: ...
19
votes
21answers
2k views

Produce an XOR table

Introduction XOR is a digital logic gate that implements an exclusive or. Most of the times, this is shown as ^. The four possible outcomes in binary: ...
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 (...
27
votes
4answers
671 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: ...
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 ...
17
votes
4answers
356 views

Flip the switches

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 ...
4
votes
0answers
204 views

Finding the smallest grid of squares [closed]

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 ...
24
votes
8answers
702 views

The alphanumeric spiral

The task is very simple, when given an input, output one of the following spirals: Input = 1 gives a spiral with the letter A ...
10
votes
2answers
330 views

Crack the safe!

Inspired by https://puzzling.stackexchange.com/questions/24334/to-catch-a-thief You are given an n by n (...
24
votes
5answers
824 views

Parse a two-dimensional syntax

Background Alice and Bob are creating a golfing language to win every single PPCG challenge. Alice wants to make a two-dimensional language, like ><>, but Bob prefers a prefix-infix syntax like in ...
21
votes
3answers
592 views

How varied is my obstacle course?

Background I have constructed a simple obstacle course by placing boxes in a rectangular room. Now I want to count the number of essentially different ways in which it can be solved. I need you to ...
13
votes
2answers
478 views

Does the fishy road have an end?

I love ><>, ><> is life! 2D langages are amazing! In this challenge, you will have to say if a "fishy" road has an end, while code-golfing. Definition A fishy road is constructed with tiles, ...
10
votes
0answers
344 views

How should I tile my kitchen?

I recently ordered some new and colorful tiles to replace my boring old white tiling for my kitchen. However, when the tiles arrived, they were all in a weird shape! Therefore, I need a program to ...
14
votes
25answers
2k views

Number of pieces on a checkers board

Introduction A normal checkers board contains 8 x 8 = 64 squares: You can see that in total, there are 12 white pieces. Black and white always have the same amount of pieces. If there are any more ...
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 ...