aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-05-31 18:37:27 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-05-31 18:37:27 -0700
commit926bebb122ba4226b65088bd0d2f964c8d9e9f8c (patch)
treeb6400facbe7bb5baa5b1c5273533b169b1ee7d80
parentf646428790b0f8e26de2bd01a1bb67e45fb7cdd4 (diff)
downloadchessh-bot-926bebb122ba4226b65088bd0d2f964c8d9e9f8c.tar.gz
chessh-bot-926bebb122ba4226b65088bd0d2f964c8d9e9f8c.zip
change ai level from 2 => 3
-rw-r--r--src/api/index.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/api/index.ts b/src/api/index.ts
index b201aba..ae9b26a 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -24,7 +24,6 @@ const sendNextMove = (gameId: number, move: string): Promise<BotMoveResponse> =>
.then((r): BotMoveResponse => {
const body = r.data as BotMoveResponse;
if (r.status === 200) {
- console.log(body);
return body;
}
throw new Error(
@@ -40,18 +39,15 @@ router.post<BotMoveRequest, string>('/move', async (req, res) => {
for (const update of updateMessages) {
if (update.bot_turn) {
- console.log(update);
- const move = aiMove(update.fen);
+ const move = aiMove(update.fen, 3);
const moveFrom = Object.keys(move)[0];
const moveTo = move[moveFrom];
- try {
- await sendNextMove(update.game_id, moveFrom + moveTo);
- } catch (e) {
- console.log(e);
- }
+
+ await sendNextMove(update.game_id, moveFrom + moveTo);
}
}
+
res.status(200).send('OK');
});