text: #!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  # pylint: disable=C0103,C0111
  
  import argparse
  import sys
  
  from snake.game import PureGame, GameConf
  from snake.utils import dotdict
  from snake.rl.coach import Coach
  from snake.rl.nnet_wrapper import NNetWrapper
  import logging
  
  logging.basicConfig(level=logging.INFO)
  sys.setrecursionlimit(5001)
  
  args = dotdict({
      'lr': 0.001,
      'dropout': 0.3,
      'epochs': 10,
      'batch_size': 64,
      'cuda': False,
      'num_channels': 128,
      'checkpoint': './temp/',
      'load_model': False,
      'load_folder_file': ('/dev/models/8x100x50','best.pth.tar'),
      'numItersForTrainExamplesHistory': 20,
      'numIters': 20,
      'numEps': 100,              # Number of complete self-play games to simulate during a new iteration.
      'tempThreshold': 15,        #
      'updateThreshold': 0.6,     # During arena playoff, new neural net will be accepted if threshold or more of games are won.
      'maxlenOfQueue': 20000,    # Number of game examples to train the neural networks.
      'numMCTSSims': 25,          # Number of games moves for MCTS to simulate.
      'cpuct': 1,
  })
  
  def main():
      logging.info('Loading %s...', PureGame.__name__)
      game = PureGame(GameConf())
  
      logging.info('Loading %s...', NNetWrapper.__name__)
      nnet = NNetWrapper(game, args)
  
      if args.load_model:
          logging.info('Loading checkpoint "%s/%s"...', args.load_folder_file)
          nnet.load_checkpoint(args.load_folder_file[0], args.load_folder_file[1])
      else:
          logging.warning('Not loading a checkpoint!')
  
      logging.info('Loading the Coach...')
      coach = Coach(game, nnet, args)
  
      if args.load_model:
          logging.info("Loading 'trainExamples' from file...")
          coach.loadTrainExamples()
  
      logging.info('Starting the learning process 🎉')
      coach.learn()
  
  
  if __name__ == "__main__":
      main()
  