Skip to content

mdoege/TUROjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TUROjs—PyTUROCHAMP as a Python web app

Install Flask and python-chess:

pypy3 -m pip install Flask --user
pypy3 -m pip install python-chess --user

(Of course you can also use regular Python 3, but PyPy is much faster.)

Start the web app:

pypy3 ptc_web.py

Open this URL in your web browser:

http://localhost:5000/

Start play by dragging a white piece. If you want to switch sides, press the Get Move button. If you click the button repeatedly, the computer will play itself.

Reload the page to start a new game.

You can also select different engines: Bare, Bernstein, Plankalkül, and SOMA. The selection can be changed during a game, so e.g. each move can be played by a different engine.

Speech synthesis browser support

The Web Speech API is used to announce computer moves. This works best in the desktop versions of Firefox and Safari (i.e., the TUROjs welcome message is read too), whereas in desktop Chrome move announcement works but the welcome message on page load is blocked.

In mobile browsers, there is no speech output when it is not directly triggered by user interaction (e.g. pressing a button) and therefore it gets blocked in TUROjs completely. The only exception is Firefox on Android.

Other packages used