foochu / bgweb-api

Backgammon Web API
MIT License
9 stars 2 forks source link

Calculate cube decisions #1

Open amlwwalker opened 1 year ago

amlwwalker commented 1 year ago

Hi, Really nice work porting this from C to Go. In the README it expresses:

Features to-do:

Calculate cube decisions

I was wondering if this is underway - you have a plan to do this to complete this port to Go?

Thanks

foochu commented 1 year ago

Hi Alex!

Thanks for your feedback! Nice to hear somebody found this :)

I haven't started anything around cube decisions. One of those things waiting for the inspiration to hit :D

Interested tipping in? ;)

BR, Rami

amlwwalker commented 1 year ago

Hey - yeah always interested - I'm currently playing with your library to put a basic UI on top to arrange game pieces and get the best move spat out.

image

Not quite there - but basically wanting to put at the bottom the best move. Then hopefully which drag/drop can rearrange the pieces when I want to know the best option (when playing live...)

Its super cool you ported this. Really awesome work. I need to dig into the code to understand it a bit more - but happy to help where I can

foochu commented 1 year ago

Nice!! Looking cool!!! That was my main motivation, I could not find anything what was built in modular fashion. The code itself is quite loyal to the original C code.

amlwwalker commented 1 year ago

yeah i had a bit of a look after digging through the GNUBG code. Did you do this for a project or just for yourself. Lovely bit of work.

Don't stop with it! Its super cool. I'll give you a sneak preview when I have something functional 😬

I presume you are a backgammon player - whats your general motivation for this?

foochu commented 1 year ago

I thought I'd learn some Go over the xmas holidays last year and this was something which just happened to come to mind. Took a lot longer than I expected but since already spent fair amount of time on it did not want to stop and throw away. Then put it on GH because why not :)

I do play on an occasion, mostly with my kids, lol

amlwwalker commented 1 year ago

BTW - one question - any reason why you put everything in internal directory? You maybe aware and have a good reason - generally the internal directory is used when you explicitly do not want other projects using your code. Before we started chatting I forked your repository (and changed the path - probably stupidly) but I added this file

https://github.com/amlwwalker/go-gnubg/blob/main/pkg/engine/engine.go

which exposes the GNU engine of your code so other projects can use it. Not sure if you want to add that back into your code

foochu commented 1 year ago

Hey man! Generally I make everything private so can change it at will without having to worry about breaking other peoples code. Then if you want to expose something, add a wrapper for it in the pkg folder, like you've done here. A.k.a. "anti corruption layer", i.e. you can change your private stuff if you want but keep the public one backwards compatible.

I'm a bit of Go n00b myself so not 100% sure how people deal with the path issue you mentioned...hmm... Anyhow, if you don't mind submitting a PR, I'll gladly accept it!!

amlwwalker commented 1 month ago

hey @foochu Thought i'd check in and see how you are and whether you made any progress/found the inspiration on this to expose the Cube actions/suggestions from GNU? I think that might be the one feature of this that would complete this work!