Ticket #46 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Further 1D conversion and engine/interface cleanup

Reported by: gunnar Owned by: gnugo
Priority: normal Milestone: 3.7.8
Component: source Version:
Severity: normal Keywords:
Cc: patch: yes

Description (last modified by gunnar) (diff)

One motivation for this patch is that there's a lot of overlap in the sgf routines of source:/engine/interface.c#2234. All of gnugo_play_sgfnode(), gnugo_play_sgftree(), gameinfo_load_sgfheader(), and gameinfo_play_sgftree_rot() look at more or less the same sgf properties.

A closer examination reveals, however, that gnugo_play_sgftree() is never used while gameinfo_load_sgfheader() is almost completely redundant since it always precedes gameinfo_play_sgftree_rot(), which rereads the same information. The only effect of loading the header first is that handicap is available before determining komi, but that can easily be achieved by reording the code in gameinfo_play_sgftree_rot(). Thus gnugo_play_sgftree() and gameinfo_load_sgfheader() are removed. It should be noted that gnugo_play_sgfnode() and gameinfo_play_sgftree_rot() still are overlapping but there's no attempt to solve that in this patch.

A second motivation is to convert some of the remaining 2D code to 1D. As a special case this reduces gnugo_genmove() to a trivial wrapper and is therefore removed. Furthermore gameinfo_play_move() is completely unused and is also removed. More importantly get_sgfmove() has been introduced as a 1D replacement (needs to be a wrapper into the 2D sgf library) for getMoveX(), getMoveY(), and getMoveXY. A local 1D wrapper to rotate() in gg_utils.c is added in engine/interface.c, which is the only place where it's needed.

gameinfo_clear() no longer sets board_size and komi because they are not part of the Gameinfo struct and they were always set to their global values anyway.

Attachments

gunnar_7_8.6 (25.6 kB) - added by gunnar 3 years ago.

Regression Results

Attachment Rev. PASS FAIL Nodes Status

Change History

Changed 3 years ago by gunnar

Changed 3 years ago by gunnar

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)
Note: See TracTickets for help on using tickets.