nakas commited on
Commit
1415823
·
1 Parent(s): 4de6ca2

adding in board eval

Browse files
Files changed (1) hide show
  1. Main.py +22 -1
Main.py CHANGED
@@ -1,6 +1,27 @@
1
  import streamlit as st
2
  from model import GeneralModel
3
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  def app():
6
 
 
1
  import streamlit as st
2
  from model import GeneralModel
3
+ import os
4
+ import chess
5
+ import chess.engine
6
+ import stat
7
+
8
+ def eval(fenstring):
9
+ output = ""
10
+ os.chmod("./stockfish_14_x64_popcnt",0o0777)
11
+ engine = chess.engine.SimpleEngine.popen_uci("./stockfish_14_x64_popcnt")
12
+
13
+
14
+ # Score: PovScore(Cp(+20), WHITE)
15
+
16
+ board = chess.Board(fenstring)
17
+
18
+ info = engine.analyse(board, chess.engine.Limit(depth=20),multipv=3)
19
+
20
+
21
+ # Score: PovScore(Mate(+1), WHITE)
22
+
23
+ engine.quit()
24
+ return info
25
 
26
  def app():
27