From b508149a817a801e1d09cdbca3a9309adf7fe2d8 Mon Sep 17 00:00:00 2001 From: Andrey Latyshev <31588368+alatyshe@users.noreply.github.com> Date: Fri, 1 Mar 2019 14:58:23 +0200 Subject: [PATCH] Update game_context.md add actual info about GameContext class --- design_doc/game_context.md | 46 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/design_doc/game_context.md b/design_doc/game_context.md index 31a8954..89df15f 100644 --- a/design_doc/game_context.md +++ b/design_doc/game_context.md @@ -1,37 +1,35 @@ # Game Context Interface ## Game Context -- class **GameContext**, with a python binding class in elfgames.go: -- **constructor**: +class **GameContext** from src_cpp/elfgames/go/train/game_context.h, with a python binding class in elfgames.go: +- Constructor: ```cpp set new context; - if mode is "selfplay" or "online", set ``eval control`` and ``writer``; else ("train mode"), initialize ``reader``, reset the ``Data Online Loader`` or ``Offline Loader``. - Push into the vector _games of size num_game Train or Selfplay; - set start call back as games[i]->mainLoop() + if mode is "train mode": + initialize DistriServer, set ``reader`` reset the ``Data Online Loader`` or ``Offline Loader``; + if mode is "selfplay" or "online": + initialize DistriClient, set ``eval control`` and ``writer``; + + Push into the vector games_ of size num_game Train or Selfplay; + set start call back as games_[i]->mainLoop() set callback after game start as load_offline_selfplay_data() ``` -- Other public members: +- Public members(all with python binding): ```cpp - getParams() // with python binding; - getGame() // with python binding; - getGameStats() - notifyNewVersion(); setInitialVersion(); setEvalMode(); // all used in training side; - setRequest() // for the client side; - Context* ctx() // get _context, with python binding + map getParams(); + GameBase* getGame(int game_idx); + DistriServer* getServer(); // used in training side + DistriClient* getClient(); // used on client side + elf::Context* ctx(); ``` -- private members: +- Private members: ```cpp - unique_ptr _context; - vector> _games; - _contex_options; - unique_ptr _train_ctrl; - unique_ptr _eval_ctrl; - unique_ptr _writer - unique_ptr> _reader - GoFeature _go_feature; - get_net_options() // get connection options like address, server, ipv6, port - load_offline_selfplay_data() // load batches from JSON files in a multi-threading way into _reader; - init_reader() +unique_ptr context_; +vector> games_; +unique_ptr server_; +unique_ptr client_; +GameFeature gameFeature_; +shared_ptr logger_; ``` ## Context