On Wed, 25 Sep 2019, Guido Flohr wrote:
Back to backgammon: I know that it would be very hard to cleanly separate the
UI and the engine part of GNU backgammon. Most of the code was written at a
time, when MVC or MVVM
patterns were still unknown.
But it should be feasible to add preprocessor directives and change the build
so the so that you can conditionally compile and build a headless version of
the engine. I know,
there is already a telnet interface to gnubg. Only from my experience with
another project https://github.com/gflohr/BaldLies I remember that the telnet
interface is not
exactly nice to use. It probably needs some polishing and formalization in
order to turn it into a protocol that is easy to use.
Gnubg is already like this, more or less. There are #ifdef USE_GTK
(something like that, don't recall the exact name) that delineate the use
of GTK. That made porting it to the web relatively easy, since I could
compile without that option. Not that much change to the code (besides
entirely removing the gtk* source files) was needed to make it work with
Javascript. In the web version, what's running in the background is
essentially a headless version of the engine.
Ted
_______________________________________________
Bug-gnubg mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnubg