RegexWars
Tier 2 · Archmagecapture

Connect Four

The same 7x6 Connect Four board, but now a win counts in any direction — across, down, or either diagonal. Capture the winning colour, or nothing.

Rows flattened top-left first, . for empty, 6 hash characters between rows. With 6 characters of padding a row is 13 characters wide from one square to the one below it, so every direction is a fixed stride from the square before: 1 across, 13 straight down, 14 down-right, 12 down-left. Four squares, three steps, one stride — and it must be the SAME stride all three times, or you are matching a zigzag rather than a line. The padding is what stops a diagonal walking off the right edge and reappearing on the left.

Your pattern0 chars · par 60
//
Flags
Start typing — tests run as you go.0 of 6 visible tests passing
Test cases

Wrapped into rows of 7 so you can see the board. The string itself is one line with no line breaks in it — the 6 # between rows are ordinary characters, and a dot will happily match straight past them.

  • .......######
    .......######
    .......######
    .......######
    ..Y.Y..######
    .RRRRY.
    → ["R"]

    across

  • .......######
    .......######
    ....Y..######
    ....Y..######
    ..R.Y..######
    .RRRY..
    → ["Y"]

    down

  • .......######
    .......######
    R......######
    YR.....######
    YYR....######
    YRYR...
    → ["R"]

    down-right

  • .......######
    .......######
    ......Y######
    .....YR######
    ....YRR######
    ...YRRY
    → ["Y"]

    down-left

  • .......######
    .......######
    ...R...######
    ..RY...######
    .RYY...######
    YYRR...
    must not match

    three in a row in two directions, four in neither

  • .......######
    .......######
    .......######
    .......######
    .......######
    .......
    must not match

+ 5 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.