TheYoBots commited on
Commit
ef06d2e
·
2 Parent(s): 701072fd4e1206

Bump to v0.7.0

Browse files

Changes:
- Better explanation of files
- Add link to lishogi-bot.exe as an option instead of lishogi-bot.py
- Linux based files removed
- Users now have to add engine themselves
- Censored word ‘Engine’ removed from conversation.py
- Sending of ‘go commands’ properly
- Change method of sending ‘!name’ command in chat

Files changed (4) hide show
  1. config.yml +4 -4
  2. conversation.py +1 -1
  3. engine_wrapper.py +24 -14
  4. lishogi-bot.py +1 -1
config.yml CHANGED
@@ -13,10 +13,10 @@ engine: # engine settings
13
  Move Overhead: 5000 # increase if your bot flags games too often. 5000 is the highest accepted value.
14
  Threads: 2 # max CPU threads the engine can use
15
  USI_Hash: 256 # max memory (in megabytes) the engine can allocate
16
- # go_commands: # additional options to pass to the USI go command
17
- # nodes: 1 # Search so many nodes only.
18
- # depth: 5 # Search depth ply only.
19
- # movetime: 1000 # Integer. Search exactly movetime milliseconds.
20
  silence_stderr: false # some engines are very noisy
21
 
22
  abort_time: 30 # time to abort a game in seconds when there is no activity
 
13
  Move Overhead: 5000 # increase if your bot flags games too often. 5000 is the highest accepted value.
14
  Threads: 2 # max CPU threads the engine can use
15
  USI_Hash: 256 # max memory (in megabytes) the engine can allocate
16
+ # go_commands: # additional options to pass to the USI go command
17
+ # nodes: 1 # Search so many nodes only.
18
+ # depth: 5 # Search depth ply only.
19
+ # movetime: 1000 # Integer. Search exactly movetime milliseconds.
20
  silence_stderr: false # some engines are very noisy
21
 
22
  abort_time: 30 # time to abort a game in seconds when there is no activity
conversation.py CHANGED
@@ -20,7 +20,7 @@ class Conversation:
20
  game.ping(60, 120)
21
  self.send_reply(line, "Waiting 60 seconds...")
22
  elif cmd == "name":
23
- self.send_reply(line, "{} (lishogi-bot v{})".format(self.engine.name(), self.version))
24
  elif cmd == "howto":
25
  self.send_reply(line, "How to run your own bot: https://github.com/TheYoBots/Lishogi-Bot")
26
  elif cmd == "eval" and line.room == "spectator":
 
20
  game.ping(60, 120)
21
  self.send_reply(line, "Waiting 60 seconds...")
22
  elif cmd == "name":
23
+ self.send_reply(line, "lishogi-bot v0.7.0")
24
  elif cmd == "howto":
25
  self.send_reply(line, "How to run your own bot: https://github.com/TheYoBots/Lishogi-Bot")
26
  elif cmd == "eval" and line.room == "spectator":
engine_wrapper.py CHANGED
@@ -19,7 +19,7 @@ def create_engine(config, board):
19
 
20
  silence_stderr = cfg.get("silence_stderr", False)
21
 
22
- return USIEngine(board, commands, cfg.get("usi_options", {}) or {}, silence_stderr)
23
 
24
 
25
  class EngineWrapper:
@@ -64,10 +64,9 @@ class EngineWrapper:
64
 
65
  class USIEngine(EngineWrapper):
66
 
67
- def __init__(self, board, commands, options, silence_stderr=False):
68
- commands = commands[0] if len(commands) == 1 else commands
69
- self.go_commands = options.get("go_commands", {})
70
- print("GO, OPTIONS:", options)
71
 
72
  self.engine = engine_ctrl.Engine(commands)
73
  self.engine.usi()
@@ -82,15 +81,26 @@ class USIEngine(EngineWrapper):
82
 
83
  def search_with_ponder(self, board, wtime, btime, winc, binc, ponder=False):
84
  moves = [m.usi() for m in list(board.move_stack)]
85
- best_move, ponder_move = self.engine.go(
86
- board.sfen(),
87
- moves,
88
- wtime=wtime,
89
- btime=btime,
90
- winc=winc,
91
- binc=binc,
92
- #ponder=ponder
93
- )
 
 
 
 
 
 
 
 
 
 
 
94
  return (best_move, ponder_move)
95
 
96
  def search(self, board, wtime, btime, winc, binc):
 
19
 
20
  silence_stderr = cfg.get("silence_stderr", False)
21
 
22
+ return USIEngine(board, commands, cfg.get("usi_options", {}), cfg.get("go_commands", {}), silence_stderr)
23
 
24
 
25
  class EngineWrapper:
 
64
 
65
  class USIEngine(EngineWrapper):
66
 
67
+ def __init__(self, board, commands, options, go_commands={}, silence_stderr=False):
68
+ commands = commands[0] if len(commands) == 1 else commands
69
+ self.go_commands = go_commands
 
70
 
71
  self.engine = engine_ctrl.Engine(commands)
72
  self.engine.usi()
 
81
 
82
  def search_with_ponder(self, board, wtime, btime, winc, binc, ponder=False):
83
  moves = [m.usi() for m in list(board.move_stack)]
84
+ cmds = self.go_commands
85
+ if len(cmds) > 0:
86
+ best_move, ponder_move = self.engine.go(
87
+ board.sfen(),
88
+ moves,
89
+ nodes=cmds.get("nodes"),
90
+ depth=cmds.get("depth"),
91
+ movetime=cmds.get("movetime"),
92
+ #ponder=ponder
93
+ )
94
+ else:
95
+ best_move, ponder_move = self.engine.go(
96
+ board.sfen(),
97
+ moves,
98
+ wtime=wtime,
99
+ btime=btime,
100
+ winc=winc,
101
+ binc=binc,
102
+ #ponder=ponder
103
+ )
104
  return (best_move, ponder_move)
105
 
106
  def search(self, board, wtime, btime, winc, binc):
lishogi-bot.py CHANGED
@@ -30,7 +30,7 @@ try:
30
  except ImportError:
31
  from http.client import BadStatusLine as RemoteDisconnected
32
 
33
- __version__ = "0.6.0"
34
 
35
  terminated = False
36
 
 
30
  except ImportError:
31
  from http.client import BadStatusLine as RemoteDisconnected
32
 
33
+ __version__ = "0.7.0"
34
 
35
  terminated = False
36