<commit_before># (C) 2019, <NAME>, Apache 2 License
# Main entry point for the chess program and UCI command processing

import sys
import time
import chess # https://github.com/niklasf/python-chess
from control import controller

line = None # save the move line for go
board = None

def quit(clist):
  sys.exit()

def uci(clist):
  print("id name FINNY 0.1")
  print("id author <NAME>")
  print("uciok") ## do not forget!!

def isready(clist): #sync engine + gui
  print("readyok")

def ucinewgame(clist): # init engine. No answer required
  global board 
  board = chess.Board()
  print(">>> finny initialized")

def position(clist): # position startpos moves e2e4 e7e5 | position startpos | position fen 'fen'
  global line 
  if clist[0] == 'startpos':
    clist.pop(0) # remove startpos or fen
    # if not clist:
    if len(clist) != 0: # position startpos
      clist.pop(0) # remove moves
    line = clist
  else: # must be fen then
    print(">>> fen not yet implemented!")    

def go(clist): # pass [timestamp, line, goargs=clist] 
  mytup = board, time.time(), line, clist
  controller(mytup)

commands = { # implemented
		"quit" : quit,
		"uci" : uci,
		"isready" : isready,
		"ucinewgame" : ucinewgame,
		"position" : position,
		"go" : go
} # globals()[cmd](clist) => is undebuggable. Hence a dict

uinput = "empty"

while uinput != "quit": # main UCI loop
  uinput = input()
  clist = uinput.split(" ")
  cmd = clist.pop(0)
  result = commands.get(cmd, "empty")
  if result == "empty":
    print(">>> invalid command")
  else: 
    result(clist)

<commit_msg>need good version numbers<commit_after># (C) 2019, <NAME>, Apache 2 License
# Main entry point for the chess program and UCI command processing

import sys
import time
import chess # https://github.com/niklasf/python-chess
from control import controller

line = None # save the move line for go
board = None

def quit(clist):
  sys.exit()

def uci(clist):
  print("id name FINNY 0.1") # Command 1/3 real version number!
  print("id author <NAME>") # Command 2/3
  print("uciok") ## do not forget!! # Command 3/3

def isready(clist): #sync engine + gui
  print("readyok")

def ucinewgame(clist): # init engine. No answer required
  global board 
  board = chess.Board()
  print(">>> finny initialized")

def position(clist): # position startpos moves e2e4 e7e5 | position startpos | position fen 'fen'
  global line 
  if clist[0] == 'startpos':
    clist.pop(0) # remove startpos or fen
    # if not clist:
    if len(clist) != 0: # position startpos
      clist.pop(0) # remove moves
    line = clist
  else: # must be fen then
    print(">>> fen not yet implemented!")    

def go(clist): # pass [timestamp, line, goargs=clist] 
  mytup = board, time.time(), line, clist
  controller(mytup)

commands = { # implemented
		"quit" : quit,
		"uci" : uci,
		"isready" : isready,
		"ucinewgame" : ucinewgame,
		"position" : position,
		"go" : go
} # globals()[cmd](clist) => is undebuggable. Hence a dict

uinput = "empty"

while uinput != "quit": # main UCI loop
  uinput = input()
  clist = uinput.split(" ")
  cmd = clist.pop(0)
  result = commands.get(cmd, "empty")
  if result == "empty":
    print(">>> invalid command")
  else: 
    result(clist)


{'fraction_non_alphanumeric': 0.1360396653238302, 'fraction_numerical': 0.011775643012085528, 'mean_word_length': 3.6048502139800287, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7408589', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1121, 'n_words': 366}