Questions tagged [grid]

For challenges involving a grid.

Filter by
Sorted by
Tagged with
29 votes
5 answers
2k views

Can I Clear The Grid?

I recently found this game and have been enjoying it. Basically, there is a grid of colored tiles and you act by clicking on empty spaces. When you click an empty space, the first tile (if any) in ...
hyper-neutrino's user avatar
  • 42.2k
26 votes
9 answers
3k views

Is it a Valid Crossword Grid?

In crossword terminology, the grid is the region into which the crossword answers are inserted, consisting of white and black squares. The crossword answers, called entries, are inserted into ...
97.100.97.109's user avatar
29 votes
10 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 ...
caird coinheringaahin g's user avatar
8 votes
4 answers
378 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 ...
Parcly Taxel's user avatar
  • 3,737
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 ...
Stewie Griffin's user avatar
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 ...
Kevin Cruijssen's user avatar
6 votes
2 answers
374 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 ...
double-beep's user avatar
5 votes
3 answers
163 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!" ...
Bubbler's user avatar
  • 75.7k
9 votes
8 answers
676 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 ...
Bubbler's user avatar
  • 75.7k
10 votes
6 answers
741 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 ...
Bubbler's user avatar
  • 75.7k
15 votes
7 answers
917 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 ...
Bubbler's user avatar
  • 75.7k
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 ...
JvdV's user avatar
  • 3,683
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 ...
Bubbler's user avatar
  • 75.7k
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 ...
Bubbler's user avatar
  • 75.7k
5 votes
2 answers
215 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 ...
Hugo Pfoertner's user avatar
22 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 ...
leo848's user avatar
  • 637
20 votes
7 answers
3k 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 ...
Peter Kagey's user avatar
  • 8,669
51 votes
11 answers
11k 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 ...
ihavenoidea's user avatar
  • 1,219
11 votes
1 answer
544 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 ...
Aiden Chow's user avatar
  • 13.1k
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 ...
Bjop's user avatar
  • 435
12 votes
2 answers
760 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 ...
Kevin Cruijssen's user avatar
24 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 ...
Bjop's user avatar
  • 435
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: ...
thejonymyster's user avatar
5 votes
0 answers
246 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 ...
Command Master's user avatar
27 votes
19 answers
3k 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 &...
Aiden Chow's user avatar
  • 13.1k
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 ...
emanresu A's user avatar
  • 37.2k
8 votes
5 answers
771 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 ...
Ginger's user avatar
  • 5,450
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 ...
Aiden Chow's user avatar
  • 13.1k
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 ...
Kevin Cruijssen's user avatar
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 ...
Kevin Cruijssen's user avatar
12 votes
3 answers
294 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 ...
Kevin Cruijssen's user avatar
10 votes
3 answers
335 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 ...
Peter Kagey's user avatar
  • 8,669
12 votes
8 answers
845 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-...
Kevin Cruijssen's user avatar
10 votes
1 answer
337 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 ...
Hans-Peter Stricker's user avatar
20 votes
1 answer
529 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 ...
Aiden Chow's user avatar
  • 13.1k
18 votes
6 answers
1k 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 ...
DialFrost's user avatar
  • 5,069
8 votes
1 answer
217 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 ...
cheems's user avatar
  • 619
9 votes
4 answers
264 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 ...
EphraimRuttenberg's user avatar
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 ...
DialFrost's user avatar
  • 5,069
15 votes
4 answers
339 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:...
emanresu A's user avatar
  • 37.2k
10 votes
2 answers
880 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 ...
chnmasta05's user avatar
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 (...
double-beep's user avatar
23 votes
6 answers
3k 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 ...
Theo's user avatar
  • 509
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'...
lyxal's user avatar
  • 32.9k
8 votes
6 answers
395 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 ...
Bubbler's user avatar
  • 75.7k
13 votes
15 answers
556 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 ...
Bubbler's user avatar
  • 75.7k
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: ...
emanresu A's user avatar
  • 37.2k
10 votes
11 answers
486 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, ...
lyxal's user avatar
  • 32.9k
25 votes
7 answers
880 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 ...
pajonk's user avatar
  • 15.9k
17 votes
12 answers
573 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). ...
Bubbler's user avatar
  • 75.7k

1
2 3 4 5
8