Game Board Clone returns Container?

Versions:
"@zimjs/game": "^2.8.91",
"zimjs": "^17.3.3"

Probably not the best idea for me to Clone a board, but was expecting a Clone of the Game Board to be returned a not a Container.

Example:

private test() {
    const board = new Board();
    const clonedBoard = board.clone();
    zogg(board);
    zogr(clonedBoard);
  }

image

1 Like

Yes - just took a look - it does not have its own clone method. I think we could probably add one, not sure how often one would do that? What do you think? It basically would take the same parameters passed to it and create a new Board with them - so not much work - a couple lines. We do most components that way.

Maybe not required for me.

My scenario is I want to have a zoomed in 'identical' board to the one I generated 'randomly'.

I'm just going to create the same board with identical configuration. I will need to save off this board config anyways, so I can just use this config to 'regen' the identical board when I need the 'copy' for zoomed in view.

Just took me by surprise that .clone returned something different than what I cloned.

1 Like