Questions tagged [grid]
For challenges involving a grid.
378
questions
27
votes
8
answers
3k
views
Implement grambulation
Consider the following spiral of positive integers:
We now define grambulation as a binary operation \$\lozenge : \mathbb N \times \mathbb N \to \mathbb N\$, using this grid. Some example inputs and ...
8
votes
4
answers
335
views
Simultaneously solve N-queens and no-3-in-line
An intriguing MathsSE question asked if there were large N-queens solutions where no three queens lie on a line. That question's body included the unique 4×4 solution up to symmetries
...
13
votes
16
answers
3k
views
Create a bingo card generator
Bingo
Bingo is a numbers game where players match randomly drawn numbers to the numbers on their cards. Each bingo card is a square grid with 25 spaces, and the columns of the grid are labeled with ...
13
votes
8
answers
1k
views
Toggle some bits and get an actual square
Inspired by the title of the Toggle some bits and get a square challenge.
In that challenge you output how many bits should be toggled, in order for the base-10 representation of the binary to become ...
6
votes
2
answers
338
views
Is this position a pure mirror mate?
Task
A pure mirror checkmate is a checkmate position, where the mated king is surrounded by 8 empty squares which are attacked or guarded by the winning side exactly once. You will be given a valid ...
5
votes
3
answers
159
views
CGAC2022 Day 15: Chimney cleaning, Part 2
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
While other Elves are busy carrying air blowers, Fen comes and shouts, "I've got a spell for this job!"
...
9
votes
8
answers
674
views
CGAC2022 Day 14: Chimney cleaning
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
As we all know, Santa comes down the chimney to deliver presents to good kids. But chimneys are normally full of ...
10
votes
6
answers
735
views
CGAC2022 Day 13: Santa's gift and the laser lock, Part 2
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
You successfully route the laser into the sensor, but nothing happens.
"What?" Frustrated, you flip the ...
15
votes
7
answers
916
views
CGAC2022 Day 12: Santa's gift and the laser lock
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
There's a good news and a bad news.
Good news: you got a Christmas present from Santa. (Already?! Christmas is two ...
16
votes
6
answers
1k
views
Santa's Shortest Path Problem
Santa's Shortest Path Problem
Trying to be as time-efficient as possible Santa needs to plan his trips carefully. Given a 5X5 grid representing a map of villages it is your task to be Santa's flight ...
11
votes
14
answers
2k
views
CGAC2022 Day 5: Preparing an advent calendar
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
It's time to prepare an advent calendar, but I've only got a large sheet of rectangular paper, randomly colored red ...
15
votes
7
answers
1k
views
CGAC2022 Day 2: Self-trapping Elf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
An Elf is hopping on a chessboard which extends infinitely in all four directions. They move like a generalized ...
5
votes
2
answers
208
views
Transform a lattice polygon to minimum diameter by shearing
Given is a grid polygon by the list of its integer vertex coordinates arranged along the perimeter, in the form
\$(x_1,y_1), (x_2,y_2), \cdots , (x_n,y_n)\$ with \$n \ge 3\$.
The polygon is completed ...
21
votes
10
answers
1k
views
Traverse a rectangle's antidiagonals
There exists a bijection between the natural and rational numbers that works (approximately) like this:
You create a 1-indexed 2-dimensional grid.
In every field of this grid with position ...
20
votes
7
answers
2k
views
The smallest area of a convex grid polygon
I got an email from Hugo Pfoertner, an Editor-in-Chief at the On-Line Encyclopedia of Integer Sequences, with a terrific idea for a fastest-code challenge, which will also help verify or expand the ...
51
votes
11
answers
10k
views
When will the DVD logo hit the corner?
One of my favorite memes is the bouncing DVD logo. Yet silly but extremely satisfying, a DVD logo keeps bouncing on a screen and if you ever happened to watch this screensaver, you were most likely ...
10
votes
1
answer
389
views
Optimally pop all the bubbles
In a given 2d grid of positive integers (representing different types of "bubbles"), there are one of two actions that you can do each "step". You can either:
Pop an island (a ...
9
votes
3
answers
1k
views
The smallest number of steps for a chess piece to reach a position
I have previously posted a challenge, smallest number of steps for a knight in chess.
Now I would like to go a step further by adding the possibility to choose your piece.
If you place a piece on any ...
12
votes
2
answers
753
views
Solving an easy Sudoku in increasing digit order
Introduction:
I'm old-fashioned and still read a physical newspaper in the morning while eating my breakfast. Although I don't like Sudoku that much, I do solve the Light-complexity ones, which are ...
23
votes
15
answers
3k
views
smallest number of steps for a knight in chess
If you place a knight on any square of a chessboard, what is the smallest amount of steps to reach every position?
Rules
It is an 8 by 8 board.
The knight starts at an arbitrary position, taken as ...
24
votes
8
answers
2k
views
Seeing the queen's lasers
In chess, the queen piece can move arbitrarily far in each cardinal and intercardinal direction. What does this mean? Well, I'll show you with an ASCII drawing:
...
5
votes
0
answers
233
views
Find the best character arrangement
You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your ...
27
votes
16
answers
2k
views
Create Bernard from Desmos
Background
In the online graphing calculator Desmos, there is a certain shape that appears in the lower left portion of the graph in many high detail graphs, which the Desmos community has dubbed &...
18
votes
13
answers
2k
views
Straighten my corners... diagonally
We can arrange the positive integers like this:
1_| 2 | 5 | 10
4___3_| 6 | 11
9___8___7_| 12
16 15 14 13
That is, in L-shaped brackets expanding down and right ...
8
votes
5
answers
765
views
Will this makina program halt?
makina is a cell-based esolang composed of automata which move around a grid. These automata follow paths of instructions that direct their movement. Your task is to, given a makina program using only ...
17
votes
1
answer
4k
views
Simplified Piet Interpreter
Background
Piet is an esoteric stack-based programming language in which programs are images meant to resemble abstract paintings.
To keep the challenge from being unnecessarily complex, you will not ...
14
votes
19
answers
1k
views
Words with Easy Letters in a Word Search
Introduction:
Apparently I keep coming up with word search related challenges lately. :)
When I do the word search in the Dutch news paper, some words are very easy to find because they contain ...
10
votes
8
answers
2k
views
How many times do I break my own rule?
Introduction:
In my recent Strikethrough the Word Search List challenge I mentioned the following:
When I do the word-search puzzles, I (almost) always go over the words in order, and strike them ...
12
votes
3
answers
291
views
Line Islands in a Word Search
My third word search related challenge in a row. :)
Challenge:
Brief explanation of what a word search is:
In a word search you'll be given a grid of letters and a list of words. The idea is to cross ...
10
votes
3
answers
331
views
Coordinates for a Heronian tetrahedron
Did you know that Heronian Tetrahedra Are Lattice Tetrahedra? A Heronian tetrahedron is a tetrahedron where
the length of each edge is an integer,
the area of each face is an integer, and
the volume ...
12
votes
8
answers
836
views
Spinning Word Search
Introduction:
Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-...
10
votes
1
answer
328
views
Counting overlapping objects
Consider a NxN pixel grid with up to M objects drawn on it, either squares or diamonds:
square
diamond
The objects may overlap, so recognition is hard. The task is to give the minimal possible ...
20
votes
1
answer
517
views
Can I wall glitch to there?
Background
In a 2d game that I play, each screen is a 2d grid of tiles with walls and walkable tiles, with the player only able to travel on walkable tiles, and being stopped by walls. When the player ...
17
votes
6
answers
950
views
Retaining Water
Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an 10 by 10 grid of integers, with ...
8
votes
1
answer
216
views
Is this a Hamiltonian cycle?
There is a 3x3 square block made of 1x1 square blocks, with coins in each 1x1 block, starting from top left block you want to collect all the coins and return to top left block again, if possible ...
9
votes
4
answers
260
views
Score a Scrabble Play
Background
In Scrabble, players take turns placing tiles on a grid so that each contiguous set of (more than one) tiles in every row and column makes a word. In one play, tiles can be placed anywhere ...
13
votes
13
answers
2k
views
Mat Printing Matrix
A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a ...
15
votes
4
answers
336
views
Sides of a polygon
Given an ASCII-art shape made of the characters /\|_, your challenge is to return the number of sides it has.
A side is a straight line of one of those, for example:...
10
votes
2
answers
865
views
Can I shorten this Python code for simulating a car driving around
I am trying to write a solution to the following problem using as few characters as possible (to meme my friend and introduce him to golfing). Can any improvements be done to my code?
So the problem ...
18
votes
11
answers
1k
views
Identify a "reverse checkers" position
Task
A reverse checkers position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (...
23
votes
6
answers
2k
views
Play the Fruit Box Game
Play the Fruit Box Game
Intro
Fruit Box is a game consisting of a 10x17 grid of numbers, each between 1 and 9, where the goal is to clear as many numbers as possible in a two-minute time window. In ...
9
votes
6
answers
338
views
AoCG2021 Day 25: Stitching maps together
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 20, Part 1. (This day is a dreaded one for many of you, I know :P)
Obligatory final "but you'...
8
votes
6
answers
394
views
AoCG2021 Day 23: Finding the best seat
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 11, Part 2.
You enter the waiting area for a ferry, and you see a bunch of people sitting at a ...
13
votes
15
answers
554
views
AoCG2021 Day 21: Blinking through the forest [duplicate]
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 3.
On the way to vacation, you're traveling through a forest on an airplane. For some biological ...
24
votes
17
answers
2k
views
Is the room lit up?
Imagine you have a grid where some squares are walls, some are empty, and some are lights that shine for arbitrary distances in the four cardinal directions until they meet walls:
...
10
votes
11
answers
484
views
AoCG2021 Day 18: Stripping Strips
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2018 Day 3.
But you're not Bubbler, you're Lyxal! yeah, I know.
After a long period of chaos, ...
25
votes
7
answers
871
views
Stitch a hitomezashi pattern
Challenge
Given two binary vectors (containing two consistent values of your choice) of length \$n\$ and \$m\$, output a corresponding ascii-art hitomezashi stitching pattern.
You are to fill the ...
17
votes
12
answers
571
views
AoCG2021 Day 15: Leapfrog Santa
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost).
...
12
votes
9
answers
1k
views
AoCG2021 Day 13: Defrag in action!
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 14.
To recap: The disk is a rectangular grid with \$r\$ rows and \$c\$ columns. Each ...
15
votes
21
answers
1k
views
AoCG2021 Day 12: Oct's Fool
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 11.
Obligatory why me and not Bubbler link
After having rescued a child process lost ...