James-E-A / mentalDarkChess

trustless implementation of Dark Chess
0 stars 0 forks source link

An implementation of mental poker for dark chess (or, as the kids know it, "Fog of War chess")


Q

Can two players play the following variant of correspondence chess:

a. Each player can only "see" squares that their own pieces are attacking

b. A player who cheats and violates (a) by "peeking" cannot plausibly get away with it: he will at least be exposed by the end of the game

c. Neither player trusts any "referee" to confidentially administer the boardstate (though a loose-lipped-but-honest referee may still be got to adjudicate outcomes, especially after the match)

A

This is possible using "oblivious transfer", and this program serves as a demonstration.

Basic Usage

# Linux
sudo apt install python3-venv
python3 -m venv env/
(. env/bin/activate; pip install -r requirements.txt )
# If (though not only if) you're using something other than Ubuntu, you may want do do this differently

(. env/bin/activate; cd src
 python -m DarkChess
)

## DO THE SAME IN ANOTHER WINDOW: ##
(. env/bin/activate; cd src
 python -m DarkChess
)
REM Windows
REM idek how to set up Spyder or whatever- u on your own lol
REM if you have Python in your CMD, the following
REM should just work without issue:

python -m pip install -r requirements.txt
cd src
python -m DarkChess

REM DO THE SAME IN ANOTHER WINDOW:
cd src
python -m DarkChess

Pass env lol=555 if you want White to start out with the D and E pawns removed

Development

Generate a release with the following scripts:

Linux

set -e
python3 -m venv env/
. env/bin/activate
pip install -r requirements-dev.txt -r requirements.txt
cd src
time pyinstaller --clean -y --dist ./dist/linux extra/DarkChess.spec && file dist/linux/DarkChess

Windows

TODO