Open jkomoros opened 6 years ago
type gameState struct {
Spaces boardgame.MutableBoard `size:"64" stack:"Tokens,2"`
}
Do we need a separate Board and MutableBoard? And theoretically the thing you get back from them is literally a GrowableStack.
And how does a given component know which spot it's in? Conceptually each stack grows a Board reference, if it's part of a board, and also a BoardIndex. So a component can figure out which stack it's in, which then allows it to figure out what space index it's in.
Also note: given a ref to a component (and a State) it's actually not possible to (efficiently) determine which Stack it's in currently. That implies some kind of state-wide index that is updated.
Should boards be resizable, like Stacks are? Obviously the stacks to be removed would have to be empty.
Conceptually they are like a SizedStack of GrowableStacks, except that having them literally be that is unnecessary.
type Board struct {
spaces []Stack
}
func NewBoard(size int, deck *Deck) *Board {
}
func (b *Board) Spaces() []Stack {
return b.spaces
}
func (b *Board) SpaceAt(index int) Stack {
//TODO
}
patchtree-helper expand
on the test hierarchy fails. ERror in #607?boardgame
!). Is it more like Region? Currently in branch "board"
Wait, if we have board, what's the way to stamp out the templates for the tokens? Monroe does it in a kind of weird way, where each component has its own stack. I guess the answer is fixing #604
Noted while exploring #550, and in this exploration: https://github.com/jkomoros/boardgame/wiki/Representing-spaces
To represent Spaces, which may have 1 to n items in them properly, you need a GrowableStack for each logical space. Things like having a separate SizedStack for each Player are an illusion, because that only works to the extent each user has a single component that could be placed.
For a board with 5 spaces, you could image encoding 5 growable stacks manually:
But that's extremely annoying.
Basically a Board is a property type that is exactly equivalent to a fixed array of GrowableStacks.
The growable stacks might have a maxlen on all of them at the same time, (e.g. if only one player may be in each one, or if only up to two tokens may be in a single space). But if you want something more complicated than that (e.g. only one token of a given color in a board space at a time, then you have to encode that in Move.Legal() logic).