Questions tagged [grid]

For challenges involving a grid.

Filter by
Sorted by
Tagged with
11
votes
1answer
167 views

Connecting the Dots: Counting n²-gons in the n×n Grid

The recent volume of MAA's Mathematics Magazine had an article "Connecting the Dots: Maximal Polygons on a Square Grid" by Sam Chow, Ayla Gafni, and Paul Gafni about making (very convex) \$n^...
8
votes
1answer
209 views

The number of tilings of a grid

Setup: A block is any rectangular array of squares, specified by its dimensions \$(w,h)\$. A grid is any finite ordered list of blocks. For example, \$\lambda = ((3,2),(3,1),(1,2))\$ defines a grid. ...
12
votes
4answers
457 views

The Game of Cat And Mice | With Matrices

Challenge This coding challenge is to figure out how many rounds the cat can live. In a \$4\times4\$ matrix, there are a number of mice and exactly 1 cat. Example: $$ \begin{array} {|r|r|}\hline 🐭 &...
22
votes
5answers
1k views

Can this pattern be made with dominoes?

Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining ...
8
votes
2answers
218 views

Highest single-turn score in Match Land

Background Match Land is a mobile game that falls into the Match-3 genre (think Bejeweled or Candy Crush Saga series): swap two orthogonally adjacent pieces to make a 3-in-a-row or longer. However, ...
7
votes
3answers
624 views

Simulate walking with collisions

In this challenge, the task is to write a program or function which simulates a number of people walking. Input will be some representation of the people's positions on a 2d grid, and one of four ...
20
votes
5answers
761 views

The Caged Circles

This problem will have you analyzing circles drawn on the grid, with the gridlines drawn at integer values of \$x\$ and \$y\$. Let \$\varepsilon\$ be a very small number (think, \$\varepsilon = 0.0001\...
13
votes
11answers
1k views

Golfing Advent of Code 2020, Day 3

I thought it'd be interesting to turn AoC day 3 puzzle into a Golfing Challenge, so here it is. Task Find the number of # you'd encounter in an 11x11 grid (...
16
votes
6answers
633 views

KoTH: Political Simulator

It's election time, and your job is to beat your competitor in a head-on rivalry! You are both trying to win over a city of 256 people in a 16x16 grid. Right now, the city hasn't been divided into ...
14
votes
1answer
258 views

Polygons in a cube

Inspired in part by this Mathologer video on gorgeous visual "shrink" proofs, and my general interest in the topic, this challenge will have you count regular polygons with integer ...
15
votes
12answers
1k views

Rectangles in rectangles

This code-golf challenge will give you two positive integers n and k as inputs and have you count the number of rectangles with ...
23
votes
2answers
888 views

Extend the most recent “nice” OEIS sequence: stepping stone puzzle on a grid

Today Neil Sloane of the OEIS sent out an email asking for a confirmation of the current terms, and computation of some larger terms of the latest OEIS sequence A337663 with the keyword "nice&...
14
votes
15answers
689 views

Conway's Game of Points!

Rest in peace, John Horton Conway There are a ton of different Game of Life interpreters out there! A ton! Currently for you, getting an interpreter is just a dozen types and a couple of clicks away. ...
32
votes
9answers
2k views

Dice Paths on a Grid

You place a standard die at the origin of a 2D grid that stretches infinitely in every direction. You place the die such that the 1 is facing upwards, the 2 is facing in the negative y direction, and ...
15
votes
6answers
558 views

Maximal saturated domino covering of a rectangle

Inspired by this OEIS entry. Background A saturated domino covering is a placement of dominoes over an area such that the dominoes are completely inside the area, the dominoes entirely cover the ...
19
votes
2answers
1k views

Wait, which tetromino was that?

Background Tetris is a single-player game played on a rectangular grid with tetromino pieces. When you fill one or more lines with tetrominoes, the filled lines are removed, and all blocks above them ...
38
votes
9answers
1k views

Recognise a Digit from a Positional Encoding

Starting an the origin on an infinite grid, you follow a predetermined path going up (U), down (D), left (...
33
votes
8answers
2k views

Connect the Three Kingdoms

You are a medieval overlord tasked with designing a road network between three kingdoms placed on a \$9 \times 9\$ grid. A sample placement of kingdoms might look like this: Non-commercial use of ...
17
votes
6answers
401 views

Secret “>” Stacking Challenge: grading

Background Tetris Grand Master 3 has a hidden grading system based on the shape of the stack at the end of the game, which is called Secret ">" Stacking Challenge. It consists of entirely ...
14
votes
7answers
1k views

Can I exit the maze with this many bombs?

Inspired by this Puzzling challenge, and easier version of my previous challenge. Challenge A 2D rectangular grid is given, where each cell is either an empty space or a wall. You start at the top ...
10
votes
2answers
228 views

Minimal cost path in wall-breaking maze

Inspired by this Puzzling challenge. Challenge Given a 2D rectangular grid where each cell is either an empty space or a wall, find the path (or one of the paths) from the top left cell to the bottom ...
8
votes
3answers
288 views

Domino Recurrence Generator

Challenge We once had a challenge to count domino tilings of m by n grid, and we all know that, for any fixed number of rows, the number of domino tilings by columns forms a linear recurrence. Then ...
7
votes
1answer
300 views

Shift Tac Toe - Code Golf Challenge

Shift Tac Toe Shift Tac Toe is a game that combines Tic Tac Toe and Connect 4 together. In this game, you start with a 3 by 3 board, and each row is connected to a slider that you can move left and ...
17
votes
5answers
1k views

Where will the gem-picking robot end up?

Related puzzle: Pathfinder (available on Puzzle Picnic) Background A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The ...
1
vote
1answer
296 views

Crazy Blazin' DOM Injection

Introduction This problem is a challenge that has to do with DOM manipulation at scale and overcoming some issues that may be inherent in dealing with the DOM. This challenge is interesting because ...
8
votes
0answers
154 views

Cover positions with snakes of same 'colour'

Imagine a grid where the origin square \$(0,0)\$ is at the top left of the screen, and positive \$x\$ is rightwards whereas positive \$y\$ is downwards. Coloured squares are at various positions on ...
9
votes
11answers
784 views

Counting King's Hamiltonian Paths through 3-by-N grid

Background A Hamiltonian path is a path on a graph that steps through its vertices exactly once. On a grid, this means stepping through every cell exactly once. On a square grid, a Chess King can move ...
11
votes
5answers
526 views

Verify Tents and Trees solution

Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no ...
23
votes
3answers
1k views

Baba is golf, flag is win

If you haven't played the game Baba is You, I think you really should. Whether you’ve played it or not, have a go at implementing it as a code golf. The idea behind this challenge is to have a bit ...
18
votes
2answers
1k views

Is this a valid Shakashaka solution?

Background Shakashaka is a puzzle on a grid, whose objective is to place some half-squares (right triangles) on the empty cells so that all the remaining contiguous regions form rectangles, either ...
13
votes
3answers
553 views

Can this polyomino tile the toroidal grid?

Inspired by certain puzzles on Flow Free: Warps. Background We all know that L-triominos can't tile the 3x3 board, and P-pentominos can't tile the 5x5 board. But the situation changes if we allow the ...
15
votes
4answers
325 views

Validate Blokus Board

Blokus is a board game in which players take turns placing pieces on a \$ n \times n \$ square grid. In this version of the game, there will be just one person playing. The person is given \$ 21 \$ ...
4
votes
3answers
455 views

Magic Square, Magic Code

A magic square is an \$ n \times n \$ square grid, such that the sum of the integers on each row and column are equal. Note that the definition which will be used in this challenge is different than ...
21
votes
6answers
585 views

Find the longest snake on a grid

Background A snake is a path over the cells of a square grid, such that it doesn't touch itself on a side of a unit square. Touching at a corner is allowed. An example snake: ...
25
votes
7answers
905 views

Analyze the flow

On a toroidal square grid (you can wrap around) where each cell indicates one direction (^ > ...
9
votes
5answers
460 views

Is this a cube?

This challenge is a riff on Dion's challenge "Is this a rectangle?". The goal of this challenge is to write a program to decide whether or not some collection of tuples of integers represents a ...
33
votes
16answers
3k views

Square snowflake

Produce this square snowflake. ...
11
votes
3answers
477 views

Triangles in a tetrahedron

The goal of this challenge is to extend the OEIS sequence A334581. Number of ways to choose \$3\$ points that form an equilateral triangle from the \$\binom{n+2}{3}\$ points in a regular tetrahedral ...
10
votes
4answers
342 views

Holey Knight's Tour

Given a rectangular board of cells with some number of holes in it, determine whether it is possible to complete a "holey knight's tour" (That is, a path that visits every non-hole cell exactly once ...
14
votes
4answers
354 views

Escape the Candlelit Maze

You find yourself in a strange place. A frighteningly dark maze, lit only by dim candles resting in the occasional hallway. Numerous paths lie only in impassable darkness, foreboding and-- ...Hm? What?...
10
votes
6answers
408 views

Reachability measure in Conway's Soldiers

Background Conway's Soldiers is a version of peg solitaire played on an infinite checkerboard. The board is initially full of pegs below an infinite horizontal line, and empty above it. Following the ...
8
votes
1answer
426 views

Infinite Snake game

Infinite Snake is just like the video game Snake, except for that the snake is infinitely long, there are no items to eat, and the Snake needs to move in a repeating ...
19
votes
2answers
338 views

Exactly N in a line

Given a number N from 2 to 8, place any nonzero number of queens on a grid of any size so that every queen has exactly N queens (counting itself) in each of its row, column, and each diagonal. This ...
21
votes
7answers
1k views

No-Three-In-A-Line

Note: this problem was inspired by the Unsolved Mathematical Problems for K-12 youtube video, which also features other interesting puzzles. From the wikipedia article: The no-three-in-line ...
13
votes
6answers
919 views

Counting Queen's paths on a rectangular chessboard

Task Given two positive integers \$m,n\$, imagine a chessboard of size \$m \times n\$. A chess queen is on the upper-left corner. In how many ways can it reach the lower-right corner, by moving only ...
8
votes
7answers
592 views

Produce an image based on an elementary cellular automata ruleset

What is elementary cellular automata? Since I'm not sure I'll be able to explain this so that somebody who has never heard of this is able to understand, I'm giving an explanation from https://...
24
votes
9answers
858 views

Maintain diagonal symmetry when placing N items on a square grid

Write a program that takes in two non-negative integers S and N in that order. S represents the side length of a square grid of . characters. N represents the ...
25
votes
20answers
2k views

How many balloons do I need in each corner?

You have a square board with a bunch of items laid out on it in one of a \$3 \times 3\$ grid of cells and you want to lift it up using balloons, but you can only attach balloons to the corners of the ...
21
votes
13answers
1k views

Walk home one step at a time

You're at integer coordinates \$(x,y)\$ facing one of North, South, East, or West. Your goal is to walk home to \$(0,0)\$. At each step, you may do one of: Walk one step in the current facing ...
8
votes
0answers
338 views

Morpion solitaire

Morpion solitaire This is a game that I remember having learnt from my grandparents in my childhood. Initially I didn't know the name. G B has found it to be Join Five (or less ambiguously - Morpion ...

1
2 3 4 5 6