Code Monkey home page Code Monkey logo

starterlichessbot's Introduction

Starter Lichess Bot

๐Ÿค– A Customizable Python Chess Bot

๐Ÿ“ Table of Contents

๐Ÿง About

This is a simple python script that listens to the Event stream for a Lichess.org BOT account and accepts/rejects challenges, plays games using fully customizable engine, responds to users in the game's chat.

There is already a sample chessbot implementation RandomMoveBot() which randomly plays a legal move.

This project was made using berserk-downstream. A client library for the Lichess API

๐ŸŽˆ Try it out

Check out my BOT account you can play against here.

๐Ÿ Getting Started

Prerequisite

Make sure you have a Lichess account that you have upgraded to a BOT account and created a PAT for your account

Installing

First clone the repository:

git clone https://github.com/Rowan441/WeirdChessBot.git

Then install virtualenv if you don't already have it:

pip install virtualenv

cd into the project directory and create a virtual environment:

virtualenv .venv

Activate the virtual enironment:

On windows:

.venv\Scripts\activate

On Unix / MacOS:

source .venv/bin/activate

Finally install the required libraries:

pip install -r requirements.txt

API Token

Important: you need to create a file named api.token in the root directory of the project add your BOT account's Personal API token to the file

echo YOURAPITOKEN > api.token

๐Ÿƒ Usage

To run the project make sure you have a Lichess account that you have upgraded to a BOT account and added your API token to a api.token file

Run the starterlichessbit.py file with optional --logfile flag:

starterlichessbot.py
OR
starterlichessbot.py --logfile ..\logs.txt  

๐Ÿ”จ Build Your Own Bot

You can create your own Bots. In this program, a Bot is defined as a class that implements: getBestMove(self, gameState, variant) and getResponseToMessage(self, chatLine) methods

Checkout the ChessBotInterface() class in the chessbots.py file for the specific details of the getBestMove and getResponseToMessage functions. You can create subclasses from ChessBotInterface() and override its methods with your own funcitonality.

Once you have a working bot you can tell the program to use it by:

  1. Importing the bot in starterlichessbot.py:
 8|  from chessbots import MyBotClass # Import your bot
  1. instantiating the bot on line 17 of starterlichessbot.py
19|  bot = MyBotClass()

In the source code this has already been done with RandomChessBot, so just replace RandomChessBot with your bot class.

โ›๏ธ Built Using

โœ๏ธ Authors

starterlichessbot's People

Contributors

rowan441 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.