SnIPPETsX
SnIPPETsX

SnIPPETsX › can you see this

can you see this

Python · updated Dec 3, 2026 · 79 lines

main.py

# can you see this

# 1-omino
#
# []
#
# 2-omino
#
# [] []
#
# 3-omino
#
# [] [] []
#
# []
# [] []
#
# 4-omino (non-exhaustive)
#
# [] []
# [] []
#
# [] [] []
#    []
#
# 5-omino (non-exhaustive)
#
# [] []
# [] [] []
#
#    []
# [] [] []
#    []

# object representation
# outputs list of n tuples

def generate(n):
  x = 0
  y = 0
  answer = []
  seen = set()

  while n > 0:
    seed = Random.randint(1, 4)

    size = len(answer)
    newPosSeed = Random.randint(1, size)
    x, y = answer[newPosSeed-1]

    #left 
    if seed == 1:
      while True:
        x -= 1
        if (x,y) not in seen:
          answer.append((x,y))
          seen.add((x,y))
          break
    #right
    elif seed == 2:
      x += 1
      answer.append((x,y))
      seen.add((x,y))
    #up
    elif seed == 3:
      y += 1
      answer.append((x,y))
      seen.add((x,y))
    #down
    elif seed == 4:
      y -= 1
      answer.append((x,y))
      seen.add((x,y))
      
    n--

  return answer

    

Run this Python snippet

Open this snippet on SnIPPETsX to run the Python code in your browser, edit it together with others in real time, or fork it into your own copy. No install or account is needed.