Skip to content

Instantly share code, notes, and snippets.

@tebeka
Created October 12, 2021 08:57
Show Gist options
  • Save tebeka/569142edea1fd08bdd9ea944ba7c840e to your computer and use it in GitHub Desktop.
Save tebeka/569142edea1fd08bdd9ea944ba7c840e to your computer and use it in GitHub Desktop.
from enum import IntEnum
class Bounds(IntEnum):
MAX_X = 100
MAX_Y = 100
def advance(point: tuple):
"""Advance point on step up to (MAX_X, MAX_Y)"""
match point:
case (Bounds.MAX_X, Bounds.MAX_Y):
return (Bounds.MAX_X, Bounds.MAX_Y)
case (x, Bounds.MAX_Y):
return (x + 1, Bounds.MAX_Y)
case (Bounds.MAX_X, y):
return (Bounds.MAX_X, y+1)
case (x, y):
return (x+1, y+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment