-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from Hacking3DPrinters/development
Merge update 1.0b0
- Loading branch information
Showing
13 changed files
with
206 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | ||
<html><head><title>Python: package robotic_chess</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
</head><body bgcolor="#f0f0f8"> | ||
|
||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | ||
<tr bgcolor="#7799ee"> | ||
<td valign=bottom> <br> | ||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>robotic_chess</strong></big></big></font></td | ||
><td align=right valign=bottom | ||
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/codespace/.python/current/lib/python3.10/site-packages/robotic_chess/__init__.py">/home/codespace/.python/current/lib/python3.10/site-packages/robotic_chess/__init__.py</a></font></td></tr></table> | ||
<p></p> | ||
<p> | ||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | ||
<tr bgcolor="#aa55cc"> | ||
<td colspan=3 valign=bottom> <br> | ||
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr> | ||
|
||
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> | ||
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="robotic_chess.chess.html">chess</a><br> | ||
</td><td width="25%" valign=top><a href="robotic_chess.gcode.html">gcode</a><br> | ||
</td><td width="25%" valign=top><a href="robotic_chess.octoprint.html">octoprint</a><br> | ||
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p> | ||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | ||
<tr bgcolor="#eeaa77"> | ||
<td colspan=3 valign=bottom> <br> | ||
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> | ||
|
||
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> | ||
<td width="100%"><dl><dt><a name="-human_move"><strong>human_move</strong></a>()</dt></dl> | ||
<dl><dt><a name="-letter_to_number"><strong>letter_to_number</strong></a>(letter)</dt></dl> | ||
<dl><dt><a name="-notation_to_coords"><strong>notation_to_coords</strong></a>(move='a1a2')</dt></dl> | ||
<dl><dt><a name="-robot_move"><strong>robot_move</strong></a>(best_move)</dt></dl> | ||
<dl><dt><a name="-rounddown"><strong>rounddown</strong></a> = floor(x, /)</dt><dd><tt>Return the floor of x as an Integral.<br> | ||
<br> | ||
This is the largest integer <= x.</tt></dd></dl> | ||
<dl><dt><a name="-roundup"><strong>roundup</strong></a> = ceil(x, /)</dt><dd><tt>Return the ceiling of x as an Integral.<br> | ||
<br> | ||
This is the smallest integer >= x.</tt></dd></dl> | ||
</td></tr></table> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
from setuptools import setup | ||
from os import system | ||
import platform | ||
import getpass | ||
|
||
if __name__ == "__main__": | ||
setup() | ||
system('git clone https://github.com/official-stockfish/Stockfish.git') | ||
system('cd Stockfish/src/ && make -j build') | ||
system('sudo mv Stockfish/src/stockfish /usr/local/bin/') | ||
system('sudo chmod a+x /usr/local/bin/stockfish') | ||
|
||
if platform.system()=='Linux': | ||
setup() | ||
system('git clone https://github.com/official-stockfish/Stockfish.git') | ||
system('cd Stockfish/src/ && make -j build') | ||
system('sudo mv Stockfish/src/stockfish /usr/local/bin/') | ||
system('sudo chmod a+x /usr/local/bin/stockfish') | ||
elif platform.system()=='Windows': | ||
setup() | ||
system('git clone https://github.com/official-stockfish/Stockfish.git') | ||
system('cd Stockfish/src/ && make -j build') | ||
system('move Stockfish/src/stockfish C:/Users/'+str(getpass.getuser())+'/stockfish') | ||
else: | ||
raise OSError('OS unsupported.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
stockfish==3.28.0 | ||
octoprint-cli==3.3.2 | ||
chess==1.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
print('Loading python-chess lib...') | ||
import chess | ||
print('Loading stockfish lib...') | ||
from stockfish import Stockfish | ||
print('Loading stockfish engine...') | ||
import getpass | ||
import platform | ||
if platform.system()=='Linux': | ||
stockfish_path="/usr/local/bin/stockfish" # place path to stockfish here | ||
elif platform.system()=='Windows': | ||
stockfish_path="C:/Users/"+str(getpass.getuser())+"/stockfish" | ||
else: | ||
raise OSError('Unsupported OS') | ||
class Engine: | ||
def __init__(self,fenstr='rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR',cpu=2,ram=2048): | ||
self.stockfish = Stockfish(path=stockfish_path, parameters={"Threads": cpu, "Hash": ram}) | ||
if self.stockfish.is_fen_valid(fenstr): | ||
self.stockfish.set_fen_position(fenstr) | ||
self.board = chess.Board(fen=fenstr) | ||
def engine_skill(self,rating=3000): | ||
self.stockfish.set_elo_rating(rating) | ||
def get_piece(self,square='a1'): | ||
return self.stockfish.get_what_is_on_square(square) | ||
def get_capture(self,move='a1a2'): | ||
return self.stockfish.will_move_be_a_capture(move) | ||
def engine_move(self): | ||
move=self.stockfish.get_best_move() | ||
self.board.push_uci(move) | ||
return move | ||
def opponent_move(self,move): | ||
# expects an UCI string | ||
self.board.push_uci(move) | ||
self.stockfish.make_moves_from_current_position([move.uci()]) | ||
def check_win(self): | ||
return self.board.is_game_over() | ||
|
||
class Board(chess.Board): | ||
pass | ||
|
||
class Move(chess.Move): | ||
pass | ||
|
||
print('Chesslib v2') | ||
print('MIT Licence 2024 Benjamin Porter') |