govariantsteam / govariants

A place to play Go variants
https://www.govariants.com
GNU Affero General Public License v3.0
5 stars 1 forks source link

Allow More Board Types for Some Variants #158

Closed JonKo314 closed 2 months ago

JonKo314 commented 9 months ago

What

Looking at our currently supported Go variants, there are only a few which don't work with a graph-like board right away:

But other ones could be easily played with graph-like boards in theory, yet they can't, because they extend the Baduk variant, which only allows grid boards:

It would be nice, if we allowed those variants to be played on other boards too.

How

But there are different ways to achieve this:

Depending on how it's done, we might have to think about what we do with the current implementations. Do we keep them?

benjaminpjones commented 9 months ago

Note: I wrote group_utils in a way that it doesn't depend directly on Grid. One could implement a Fillable that represents a graph, and it should drop into Baduk quite easily.

Re: what to do with old code: I'll try not to be too attached to Grid, but in addition to Arrays being more cache friendly, it can also be nice for readability to use coordinates instead of node IDs board.at({x: 3, y: 3}) vs. board.at(41)

JonKo314 commented 9 months ago

Noted.

It's not just about the code though, it's also about old games and configs. Although it wouldn't be too bad to drop all games at this point.

benjaminpjones commented 9 months ago

In fact, I've got a graph branch that does exactly this! Fillable Graph class here: https://github.com/govariantsteam/govariants/commit/86d8a0ecf98091cf70f6ac4595844e65d008bcf2#diff-5d3c16a2ad75c17994d1b1eed708d6ad72008638e25833c8c64db2db00e3e91b There might be some reason why I haven't merged, but I can't remember.

benjaminpjones commented 9 months ago

it's also about old games and configs

IMO it's good to keep the grid configs around.. It's a lot easier to grep { width: 9, height: 9 } than a list of 81 nodes and 144 edges

merowin commented 9 months ago

I think a Board Interface / Abstract class sounds nice.

merowin commented 3 months ago

Should we close this as done? (Freeze Go is still on my list though)