SSpiralJuniper
Product

Product features · Clockwise grid spirals

01

Visit every coordinate of a rectangular grid in a clockwise spiral starting at the top left.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Clockwise grid spirals

● ● ●SpiralJuniper●
A concrete starting point · Clockwise grid spirals ×
def spiral(rows, columns):
    if any(type(v) is not int or not 0 <= v <= 100
           for v in (rows, columns)):
        raise ValueError("dimension.range")
    top, bottom, left, right = 0, rows - 1, 0, columns - 1
    result = []
    while top <= bottom and left <= right:
        result.extend((top, c) for c in range(left, right + 1))
        top += 1
        result.extend((r, right) for r in range(top, bottom + 1))
        right -= 1
        if top <= bottom:
            result.extend((bottom, c) for c in range(right, left - 1, -1))
            bottom -= 1
        if left <= right:
            result.extend((r, left) for r in range(bottom, top - 1, -1))
            left += 1
    return result
✳Visit every coordinate of a rectangular grid in a clockwise spiral starting at the top left.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗