Questions tagged [pattern-matching]

For challenges about matching a particular pattern or patterns.

Filter by
Sorted by
Tagged with
4 votes
2 answers
195 views

Ragged list pattern matching, Part 2

This is a sequel to Ragged list pattern matching. In this challenge, the wildcard may match a sequence of items of any length instead of just a single item. Given a pattern and a ragged list of ...
alephalpha's user avatar
  • 45.6k
12 votes
2 answers
282 views

Classify a surface from its fundamental polygon

This question is an extension of Who's that Polygon? to arbitrary numbers of sides. A fundamental polygon for a surface is an polygon with a prescribed pairing for all its \$2n\$ sides, each ...
Parcly Taxel's user avatar
  • 3,707
9 votes
5 answers
427 views

Next Time Of Given Pattern

Introduction: Some times using a 24-hour clock are formatted in a nice pattern. For these patterns, we'll have four different categories: ...
Kevin Cruijssen's user avatar
4 votes
3 answers
1k views

Python: can I shorten this code further for checking substrings

So the golf question was like this: You are given a number T and then a total of T number of 17-character strings. For each of ...
chnmasta05's user avatar
15 votes
14 answers
1k views

Ragged list pattern matching

Given a pattern and a ragged list of positive integers, your task is to decide whether the pattern matches the ragged list. The pattern is also represented by a ragged list. But in addition to ...
alephalpha's user avatar
  • 45.6k
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 ...
Hans-Peter Stricker's user avatar
8 votes
1 answer
197 views

Is this continuous terrain? Part II

Caves and Cliffs edition Part 1, Very related You're given a piece of ASCII art representing a piece of land, like so: ...
emanresu A's user avatar
  • 34.4k
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:...
emanresu A's user avatar
  • 34.4k
17 votes
7 answers
2k views

But, Is It Art?

But Is It Art? is an esolang created by ais523, where one step is break the program into orthogonally connected "tiles": A BBBB A B B AA CC A CC Each ...
caird coinheringaahin g's user avatar
8 votes
3 answers
408 views

Patterns in Permutations

This fastest-code challenge is based partly on this MSE question and exists to extend some OEIS sequences, and create others. If I extend or create sequences based on this challenge, I'll link to this ...
Peter Kagey's user avatar
  • 8,649
18 votes
7 answers
1k views

Matching ABACABA-type patterns

(This challenge is related to the challenge "Generate the Abacaba sequence.") Zimin words (also called "sesquipowers") are an important idea in the subject of "combinatorics ...
Peter Kagey's user avatar
  • 8,649
22 votes
6 answers
2k views

The matrix has U

Given a matrix of size at least 3×3 formed by positive integers, determine if it contains at least one "U" pattern, defined as ...
Luis Mendo's user avatar
  • 104k
-1 votes
1 answer
146 views

Symbol Search Deleter [rephrased] [closed]

Your challenge is to parse nonsensical text and output a "congruous phrase" - which I shall define here to be text with any contiguous characters in between, and including, a given set of like symbols ...
john321's user avatar
  • 21
15 votes
25 answers
4k views

Making Sandwiches

Introduction Bob runs a deli. His deli serves sandwiches to its customers. However, it is a bit unusual. At Bob's deli, instead of telling Bob what they want, customers show Bob an ASCII art drawing ...
sugarfi's user avatar
  • 2,195
19 votes
4 answers
1k views

Pentomino 6x10 solution normalizer

As you most probably now, there are 2339 solutions to pentomino puzzle in a 6x10 grid. There are different labeling schemes for the 12 pentominoes, two of them are shown on the image below: Image ...
Galen Ivanov's user avatar
37 votes
29 answers
12k views

Java is to JavaScript as Car is to Carpet

Title stolen inspired by Greg Hewgill's answer to What's the difference between JavaScript and Java? Introduction Java and JavaScript are commonly used languages among programmers, and are currently ...
Stevoisiak's user avatar
373 votes
1 answer
117k views

Regex that only matches itself

There are some pretty cool challenges out there involving regex (Self-matching regex, Regex validating regex) This may well be impossible, but is there a regex that will ONLY match itself? NOTE, ...
Dylan Madisetti's user avatar