Hey so recently I coded a BOT, and it is not playing moves at all. I coded it with python. @AngryOfficePanda. Could someone maybe tell me why my BOT may not be playing moves if they know?
Hey so recently I coded a BOT, and it is not playing moves at all. I coded it with python. @AngryOfficePanda. Could someone maybe tell me why my BOT may not be playing moves if they know?
We can't help you if you don't show us some code, namely of the bits regarding communication with Lichess, how it receives and sends moves, and so on.
Also try looking at what Lichess returns when your bot tries to send moves
We can't help you if you don't show us some code, namely of the bits regarding communication with Lichess, how it receives and sends moves, and so on.
Also try looking at what Lichess returns when your bot tries to send moves
Ok thanks, I am going to experiment again with it, see if the problem reoccurs
Ok thanks, I am going to experiment again with it, see if the problem reoccurs
I will show you what I see, I am taking the screenshots right now
I will show you what I see, I am taking the screenshots right now
That is fine, and I am having so much trouble with the screenshots, so give me a while to sort it out.
That is fine, and I am having so much trouble with the screenshots, so give me a while to sort it out.
token: "xxxxxxxxxxxxx" # lichess OAuth2 Token
url: "https://lichess.org/" # lichess base URL
engine: # engine settings
dir: "./engines/" # dir containing engines, relative to this project
name: "stockfish.exe" # binary name of the engine to use
protocol: "uci" # "uci" or "xboard"
uci_ponder: true # think on opponent time; only works if "protocol" is "uci"
polyglot:
enabled: false # activate polyglot book
book:
standard: # list of book file paths for variant standard
- engines/book1.bin
- engines/book2.bin
# atomic: # list of book file paths for variant atomic
# - engines/atomicbook1.bin
# - engines/atomicbook2.bin
# etc.
# use the same pattern for giveaway, crazyhouse, horde, kingofthehill, racingkings, 3check as well
min_weight: 1 # selects move with highest weight but not below this value
selection: "weighted_random" # move slection is one of "weighted_random", "uniform_random" or "best_move" (but not below the min_weight in 2. and 3. case)
max_depth: 8 # half move max depth
# engine_options: # any custom command line params to pass to the engine
# cpuct: 3.1
uci_options: # arbitrary UCI options passed to the engine
Move Overhead: 100 # increase if your bot flags games too often
Threads: 2 # max CPU threads the engine can use
# Hash: 256 # max memory (in megabytes) the engine can allocate
# go_commands: # additional options to pass to the UCI go command
# nodes: 1 # Search so many nodes only.
# depth: 5 # Search depth ply only.
# movetime: 1000 # Integer. Search exactly movetime milliseconds.
# xboard_options: # arbitrary xboard options passed to the engine
# cores: "4"
# memory: "4096"
# egtpath: # dir containing egtb, relative to this project
# gaviota: "Gaviota path"
# nalimov: "Nalimov Path"
# scorpio: "Scorpio Path"
# syzygy: "Syzygy Path"
silence_stderr: false # some engines (yes you, leela) are very noisy
abort_time: 20 # time to abort a game in seconds when there is no activity
fake_think_time: false # artificially slow down the bot to pretend like it's thinking
move_overhead: 2000 # increase if your bot flags games too often
challenge: # incoming challenges
concurrency: 1 # number of games to play simultaneously
sort_by: "best" # possible values: "best", "first"
accept_bot: false # accepts challenges coming from other bots
only_bot: false # accept challenges by bots only
max_increment: 180 # maximum amount of increment to accaept a challenge. the max is 180. set to 0 for no increment
min_increment: 0 # minimum amount of increment to accept a challenge
max_base: 315360000 # maximum amount of base time to accept a challenge. the max is 315360000 (10 years)
min_base: 0 # minimum amount of base time to accept a challenge
variants: # chess variants to accept (http://lichess.org/variant)
- standard
- fromPosition
# - antichess
# - atomic
# - chess960
# - crazyhouse
# - horde
# - kingOfTheHill
# - racingKings
# - threeCheck
time_controls: # time controls to accept
- bullet
- blitz
- rapid
# - classical
# - correspondence
modes: # game modes to accept
- casual # unrated games
- rated # rated games - must comment if the engine doesn't try to win
token: "xxxxxxxxxxxxx" # lichess OAuth2 Token
url: "https://lichess.org/" # lichess base URL
engine: # engine settings
dir: "./engines/" # dir containing engines, relative to this project
name: "stockfish.exe" # binary name of the engine to use
protocol: "uci" # "uci" or "xboard"
uci_ponder: true # think on opponent time; only works if "protocol" is "uci"
polyglot:
enabled: false # activate polyglot book
book:
standard: # list of book file paths for variant standard
- engines/book1.bin
- engines/book2.bin
# atomic: # list of book file paths for variant atomic
# - engines/atomicbook1.bin
# - engines/atomicbook2.bin
# etc.
# use the same pattern for giveaway, crazyhouse, horde, kingofthehill, racingkings, 3check as well
min_weight: 1 # selects move with highest weight but not below this value
selection: "weighted_random" # move slection is one of "weighted_random", "uniform_random" or "best_move" (but not below the min_weight in 2. and 3. case)
max_depth: 8 # half move max depth
# engine_options: # any custom command line params to pass to the engine
# cpuct: 3.1
uci_options: # arbitrary UCI options passed to the engine
Move Overhead: 100 # increase if your bot flags games too often
Threads: 2 # max CPU threads the engine can use
# Hash: 256 # max memory (in megabytes) the engine can allocate
# go_commands: # additional options to pass to the UCI go command
# nodes: 1 # Search so many nodes only.
# depth: 5 # Search depth ply only.
# movetime: 1000 # Integer. Search exactly movetime milliseconds.
# xboard_options: # arbitrary xboard options passed to the engine
# cores: "4"
# memory: "4096"
# egtpath: # dir containing egtb, relative to this project
# gaviota: "Gaviota path"
# nalimov: "Nalimov Path"
# scorpio: "Scorpio Path"
# syzygy: "Syzygy Path"
silence_stderr: false # some engines (yes you, leela) are very noisy
abort_time: 20 # time to abort a game in seconds when there is no activity
fake_think_time: false # artificially slow down the bot to pretend like it's thinking
move_overhead: 2000 # increase if your bot flags games too often
challenge: # incoming challenges
concurrency: 1 # number of games to play simultaneously
sort_by: "best" # possible values: "best", "first"
accept_bot: false # accepts challenges coming from other bots
only_bot: false # accept challenges by bots only
max_increment: 180 # maximum amount of increment to accaept a challenge. the max is 180. set to 0 for no increment
min_increment: 0 # minimum amount of increment to accept a challenge
max_base: 315360000 # maximum amount of base time to accept a challenge. the max is 315360000 (10 years)
min_base: 0 # minimum amount of base time to accept a challenge
variants: # chess variants to accept (http://lichess.org/variant)
- standard
- fromPosition
# - antichess
# - atomic
# - chess960
# - crazyhouse
# - horde
# - kingOfTheHill
# - racingKings
# - threeCheck
time_controls: # time controls to accept
- bullet
- blitz
- rapid
# - classical
# - correspondence
modes: # game modes to accept
- casual # unrated games
- rated # rated games - must comment if the engine doesn't try to win
That is all of my code, I hid the token letter so that is why it is xxxxxxxxxx. BTW that is also config.yml
That is all of my code, I hid the token letter so that is why it is xxxxxxxxxx. BTW that is also config.yml
This is config.py
import yaml
import os
import os.path
def load_config(config_file):
with open(config_file) as stream:
try:
CONFIG = yaml.safe_load(stream)
except Exception as e:
print("There appears to be a syntax problem with your config.yml")
raise e
# [section, type, error message]
sections = [["token", str, "Section token must be a string wrapped in quotes."],
["url", str, "Section url must be a string wrapped in quotes."],
["engine", dict, "Section engine must be a dictionary with indented keys followed by colons.."],
["challenge", dict, "Section challenge must be a dictionary with indented keys followed by colons.."]]
for section in sections:
if section[0] not in CONFIG:
raise Exception("Your config.yml does not have required section {}.".format(section[0]))
elif not isinstance(CONFIG[section[0]], section[1]):
raise Exception(section[2])
engine_sections = [["dir", str, "´dir´ must be a string wrapped in quotes."],
["name", str, "´name´ must be a string wrapped in quotes."]]
for subsection in engine_sections:
if subsection[0] not in CONFIG["engine"]:
raise Exception("Your config.yml does not have required engine subsection {}.".format(subsection))
if not isinstance(CONFIG["engine"][subsection[0]], subsection[1]):
raise Exception("´engine´ subsection {}".format(subsection[2]))
if CONFIG["token"] == "xxxxxxxxxxxxxxxx":
raise Exception("Your config.yml has the default Lichess API token. This is probably wrong.")
if not os.path.isdir(CONFIG["engine"]["dir"]):
raise Exception("Your engine directory {} is not a directory.")
engine = os.path.join(CONFIG["engine"]["dir"], CONFIG["engine"]["name"])
if not os.path.isfile(engine):
raise Exception("The engine %s file does not exist." % engine)
if not os.access(engine, os.X_OK):
raise Exception("The engine %s doesn't have execute (x) permission. Try: chmod +x %s" % (engine, engine))
return CONFIG
This is config.py
import yaml
import os
import os.path
def load_config(config_file):
with open(config_file) as stream:
try:
CONFIG = yaml.safe_load(stream)
except Exception as e:
print("There appears to be a syntax problem with your config.yml")
raise e
# [section, type, error message]
sections = [["token", str, "Section `token` must be a string wrapped in quotes."],
["url", str, "Section `url` must be a string wrapped in quotes."],
["engine", dict, "Section `engine` must be a dictionary with indented keys followed by colons.."],
["challenge", dict, "Section `challenge` must be a dictionary with indented keys followed by colons.."]]
for section in sections:
if section[0] not in CONFIG:
raise Exception("Your config.yml does not have required section `{}`.".format(section[0]))
elif not isinstance(CONFIG[section[0]], section[1]):
raise Exception(section[2])
engine_sections = [["dir", str, "´dir´ must be a string wrapped in quotes."],
["name", str, "´name´ must be a string wrapped in quotes."]]
for subsection in engine_sections:
if subsection[0] not in CONFIG["engine"]:
raise Exception("Your config.yml does not have required `engine` subsection `{}`.".format(subsection))
if not isinstance(CONFIG["engine"][subsection[0]], subsection[1]):
raise Exception("´engine´ subsection {}".format(subsection[2]))
if CONFIG["token"] == "xxxxxxxxxxxxxxxx":
raise Exception("Your config.yml has the default Lichess API token. This is probably wrong.")
if not os.path.isdir(CONFIG["engine"]["dir"]):
raise Exception("Your engine directory `{}` is not a directory.")
engine = os.path.join(CONFIG["engine"]["dir"], CONFIG["engine"]["name"])
if not os.path.isfile(engine):
raise Exception("The engine %s file does not exist." % engine)
if not os.access(engine, os.X_OK):
raise Exception("The engine %s doesn't have execute (x) permission. Try: chmod +x %s" % (engine, engine))
return CONFIG
first of all, ive no idea about python. but u should just post the code on pastebin.com and not try to screenshot it. i am assuming u did that on a smart phone where copy/paste etc is very clunky?
use your desktop pc or notebook and "notepad++" or smth better suited for python (again im clueless) to edit it. those basic editors will show u syntax errors and such so one less thing to worry about. synchronize the code on github if u really wanna work on it from your mobile. you will be at least 10x slower than on a desktop tho. so i would only use it to read and not edit. if u get ideas on how to edit just make a memo and do it later for sake of your sanity.
if u want help from somebody qualified i suggest u remake the thread so u have your 2 config files linked to pastebin or embedded as a quote in post #1 so ppl can copy/paste it in their editor easily and dont have to search through the thread to even find it. this will improve the chance of getting help drastically!
once you have made a new thread, message a moderator to close old one (i dont know how heavily moderated this forum is but this way ur posts dont get closed for double-posting).
first of all, ive no idea about python. but u should just post the code on pastebin.com and not try to screenshot it. i am assuming u did that on a smart phone where copy/paste etc is very clunky?
use your desktop pc or notebook and "notepad++" or smth better suited for python (again im clueless) to edit it. those basic editors will show u syntax errors and such so one less thing to worry about. synchronize the code on github if u really wanna work on it from your mobile. you will be at least 10x slower than on a desktop tho. so i would only use it to read and not edit. if u get ideas on how to edit just make a memo and do it later for sake of your sanity.
if u want help from somebody qualified i suggest u remake the thread so u have your 2 config files linked to pastebin or embedded as a quote in post #1 so ppl can copy/paste it in their editor easily and dont have to search through the thread to even find it. this will improve the chance of getting help drastically!
once you have made a new thread, message a moderator to close old one (i dont know how heavily moderated this forum is but this way ur posts dont get closed for double-posting).