-
-
Save Yardanico/dcaccd73e02f0f8340816d4feebea36e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unicode | |
type | |
Axis = enum | |
horizontal, vertical | |
Direction = enum | |
left, right, up, down | |
BonusKind = enum | |
word, letter | |
Bonus = ref object of RootObj | |
kind: BonusKind | |
multiplier: int | |
Square = ref object of RootObj | |
data: Rune | |
x: int | |
y: int | |
bonus: Bonus | |
left: Square | |
right: Square | |
up: Square | |
down: Square | |
Plot = ref object of RootObj | |
## square segment that can be turn into real words | |
## like ?el?o. This can be turn into hello | |
## a plot can be 2 to 20 characters long | |
data: array[20, Square] | |
axis: Axis | |
candidates: seq[string] | |
checked: bool | |
Word = ref object of RootObj | |
axis: Axis | |
data: array[20, Square] | |
Board = ref object of RootObj | |
width: int | |
height: int | |
squares: seq[seq[Square]] | |
let board = Board(width: 7, height: 5) | |
board.squares = newSeq[seq[Square]](board.width) | |
for x in 0 ..< board.width: | |
board.squares[x] = newSeq[Square](board.height) | |
for y in 0 ..< board.height: | |
board.squares[x][y] = Square(x: x, y: y) | |
echo board.repr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment