SnIPPETsX
SnIPPETsX

SnIPPETsX › 1-omino (Shyam_Krishnan_Thea)

1-omino (Shyam_Krishnan_Thea)

TypeScript · updated Dec 3, 2026 · 103 lines

main.ts

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



// [] [] []
// [] [] []
// [] [] []

public NOmino {

  layout: string[][]

  constructor(n: number) {
    for (let i = 0; i < n; i++) {
      const row = []
      for (let j = 0; j < n; j++ ) {
        row.push(['O'])
      }
      layout.push(row)
    }
  }

  public buildNOmino(): string[][] {
    const n = layout.length
    const count = 1

    const stack = []

    this.layout[0][0] = 'X'
    stack.push([0, 0])

    const 

    while(stack.lenght > 0 && count < n) {
      const popped = stack.pop()
      const isValid = true
      
      const direction = getRandomDirection()

      


      if (direction === 1) {
        // x point - 1, y
        const nextPiece = [popped[0] - 1][popped[0][0]]
        stack.push(nextPiece)
        count++
      } else if (direction === 2)

      }
      

    }

    return
  }

  private getRandomDirection(): number {
    // 1 => up
    // 2 => down
    // 3 => left
    // 4 => right
    
    return Math.random(1, 4)
  }

  private isValidWithinLayout(x: number, y: number): boolean {
    // returns whether point is within layout
  }


    
  }

  
}

Run this TypeScript snippet

Open this snippet on SnIPPETsX to run the TypeScript 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.