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.

18
votes
9answers
1k views

Partitioning the grid into triangles

Goal The goal of this challenge is to produce a function of n which computes the number of ways to partition the n X 1 grid ...
10
votes
1answer
175 views

Tatamibari solver

Background Tatamibari is a logic puzzle designed by Nikoli. A Tatamibari puzzle is played on a rectangular grid with three different kinds of symbols in it: +, <...
4
votes
2answers
208 views

Nightmare Puzzlang translator

Background Puzzlang is a derivative of Brainfuck, where the symbol X executes a BF command based on three characters on top of it, and anything else does nothing. ...
25
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 ...
12
votes
6answers
646 views

Get me out of here

Challenge Given a grid size, obstacles' positions, player position and target position your task is to find a path for the player to get to the target and avoid the obstacles at the same time (if ...
4
votes
0answers
308 views

Textbattles KoTH [closed]

Textbattles Textbattles is is strategy game about, well, text. It consists of a 10x10 grid, where each player has a position on the grid. When it is a player's turn, they can decide whether to move a ...
17
votes
3answers
441 views

Dead Frog Walking

Introduction Jonny wants to play Frogger. However, he's not very good. In fact, he will only try to move forward, and only after the platforms have moved. Find out if Jonny's frog manages to reach ...
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, ...
16
votes
10answers
2k views

Assign Airliner Seats

Inspired by last week's APL lesson. Given an uppercase 2D seat map and a 1D list of customers, return the seat map and the customer list but modified as follows (to indicate occupied seats and seated ...
11
votes
3answers
330 views

Word Search on a Torus [duplicate]

The Challenge Given a list of words and a grid of letters, your job is to determine which of the given words can be found on the grid in all 8 directions (forward, backward, up, down, and the 4 ...
14
votes
10answers
903 views

Area enclosed by perimeter loop

Find the area of a region of unit cells given its perimeter loop as a sequence of 90-degree turns. For example, take the three-cell region XX X whose perimeter ...
9
votes
5answers
360 views

Four Spiraling Axes

Take the numbers 0, 1, 2, 3, 4, ... and arrange them in a clockwise spiral, starting downward, writing each digit in its own separate square. Then, given one of ...
21
votes
1answer
408 views

Roguelike pathfinding

Roguelike pathfinding Your task will be, given a two-dimensional array of the elements described below, which represents a dungeon, to output or return a single number representing the amount of gold ...
24
votes
3answers
699 views

Ice Golf Challenge

The goal of this challenge is to write a program or function that returns the least amount of strikes needed to complete a given course. Input The layout of the course can be passed in any suitable ...
11
votes
3answers
564 views

RoboZZle interpreter

Your task is to write a RoboZZle interpreter. If you're not familiar with the game, please watch the video at robozzle.com or read my description below. A robot lives on a rectangular grid of squares ...
21
votes
10answers
1k views

Finding Lonely Primes

Lonely primes (as I call them) are primes, where given a number grid with width w ≥ 3, are primes which do not have any other primes adjacent to them orthogonally ...
10
votes
2answers
449 views

Biggest square in a grid [closed]

Challenge Given a grid like this, ...
26
votes
1answer
377 views

Jolly gerrymandering

Background The United States has a unique love of gerrymandering––the deliberate manipulation of an electoral district to predict certain voting results. Just recently there was a gerrymandering case ...
15
votes
7answers
591 views

Is my kids' alphabet mat properly grouped by colors?

My kids have an alphabet mat to play with, something like this: After months with the tiles of the mat randomly placed, I got tired and placed all the tiles of the mat grouped by sections according ...
24
votes
3answers
347 views

Implement simplified kerning

Introduction Kerning means adjusting the spacing between the letters of a text. As an example, consider the word Top written with the following three glyphs: <...
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 ...
7
votes
2answers
217 views

Balanced and Centre-Free Sets of Points

Taking in Input Define a function f as follows: IF x < 0: f(x) = -√|x| ELSE: f(x) = √x In your programs/functions,...
2
votes
0answers
106 views

Bucket Brigade! [closed]

Inspired by this, this and this. So, now that the evil farmer has set your field on fire, you naturally want to put it out. You have a bunch of friends who all have buckets, and you want a program ...
7
votes
1answer
370 views

Can I burn the farmers too?

Inspired by this and this which was inspired by the first question. I've set my farmers' fields on fire, but unfortunately they saw me do it! If I don't deal with this situation they could report me ...
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 ...
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, ...
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 ...
19
votes
3answers
295 views

Rectangular difference

In this challenge, you are given two overlapping rectangles, and you need to calculate the rectangles created by removing one from the other. For example, if you remove the red rectangle from the ...
15
votes
4answers
390 views

Knight-fill a grid

A knight fill is a flood fill using the connectivity of the knight chess piece. Specifically: 1 1 1 1 0 1 1 1 1 (0 is the initial point, 1s show the ...
10
votes
2answers
287 views

Plant trees on a golf course!

This challenge is inspired by this app. This is a much easier version of this challenge. This challenge is code-golf, while the other one is fastest-code. You'll be given a square input grid, of ...
20
votes
4answers
580 views

Plant trees in a park - As fast as you can!

This challenge is inspired by this app. The test cases are borrowed from that app. This is a fastest-code challenge, where the objective is to solve the largest test cases in the least amount of time....
10
votes
4answers
630 views

Game of Life and Fatigue

Stewie's Game of Life and Fatigue is quite similar to the more famous Conway's Game of Life. The universe of the Stewie's Game of Life and Fatigue (GoLF) is an infinite two-dimensional orthogonal ...
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 ...
17
votes
13answers
2k views

Place a glider!

This: is a Glider. In Conway's Game of Life, the glider is a famous pattern that rapidly traverses across the board. For today's challenge, we are going to draw an ASCII art Game of Life Board, and ...
52
votes
45answers
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 ...
7
votes
0answers
304 views

Don't break the bridges!

Introduction: You are a worker, who is in charge of managing a set of bridges, connecting a square grid of "nodes": ...
12
votes
3answers
298 views

Was this bite mine?

Yesterday, I left my sandwich on the table. When I got up today, there was a bite in it... Was it mine? I can't remember... Problem: Take a representation of the sandwich and my bite pattern and ...
11
votes
17answers
2k views

Check if a matrix is a Toeplitz matrix

You will be given a two-dimensional array and a number and you are asked to find whether the given matrix is Toeplitz or not. Input Format: You will be given a function which will take ...
12
votes
5answers
473 views

May the fourth be with flu

Since tomorrow is the 4th of May, here's a little Star Wars themed post to prepare you mentally to all the bad jokes coming tomorrow. BACKSTORY During a session of the galactic senate all the ...
25
votes
9answers
1k views

Number Lockers!

Given a positive integer < 100 (from 1 to 99, including 1 and 99), output that many lockers. A locker is defined as the following: ...
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 ...
16
votes
5answers
513 views

Do a BackFlip for ais523!

This challenge is a prize for ais523 for winning the "Rookie of the Year" category in "Best of PPCG 2016". Congratulations! BackFlip is an esoteric programming language made by user ais523, who has ...
18
votes
2answers
251 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
473 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
576 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! ...