Merge branch 'master' into horizontal

* master:
  rename AI FSM
  Revert "update stockfish integration to accept command arguments"
  get rid of syzygy and polyglot - both useless for analysis
  don't highlight [>>] when replaying last ply
  fix autoscroll when joining a started game
  tweak classical and variants rating regulation
  remove dead code
  For all themes
  Adds border box for white pieces + factorization
horizontal
Thibault Duplessis 2015-10-19 02:00:47 +02:00
commit ae0ad66c5b
13 changed files with 26 additions and 56 deletions

View File

@ -1,9 +0,0 @@
#!/bin/sh
./bin/install-stockfish
./bin/install-polyglot
# ./bin/install-syzygy
./bin/install-polyglot-default-config
vim application.conf
vim polyglot.ini

View File

@ -1,15 +0,0 @@
#!/bin/bash
mkdir -p local
cd local
rm -rf polyglot
git clone https://github.com/ddugovic/polyglot.git
cd polyglot
git checkout 2d5bbd35dd1c44a1a7556793e16b9070047848fb
cd src
touch configure.ac aclocal.m4 configure Makefile.am Makefile.in
./configure --disable-assert
make
cd ../../..
cp -a local/polyglot/src/polyglot local/Stockfish/src/stockfish bin/
curl -o local/eco.bin https://raw.githubusercontent.com/ornicar/lichess-data/master/polyglot-db-26k.bin

View File

@ -1,7 +0,0 @@
#!/bin/sh
if [ -f polyglot.ini ]; then
exit 0;
fi
curl -o polyglot.ini https://raw.githubusercontent.com/ornicar/lila/master/conf/polyglot.ini

View File

@ -1,11 +0,0 @@
#!/bin/sh
if [ -d local/tb ]; then
exit 0;
fi
cd local
curl -O 91.121.169.81/syzygy/syzygy-5-man.tgz
tar xzf syzygy-5-man.tgz
mv syzygy tb
cd ..

View File

@ -21,12 +21,12 @@ private[ai] final class ActorFSM(
startWith(Starting, none)
when(Starting) {
case Event(Out(t), _) if t startsWith "PolyGlot" =>
case Event(Out(t), _) if t startsWith "Stockfish" =>
process write "uci"
stay
case Event(Out("uciok"), job) =>
config.init foreach process.write
loginfo(s"[$name] stockfish polyglot is ready")
loginfo(s"[$name] stockfish is ready")
job.fold(goto(Idle))(start)
case Event(req: Req, none) => stay using Job(req, sender, None).some
}

View File

@ -5,7 +5,9 @@ import scala.concurrent.duration.FiniteDuration
import actorApi._
private[ai] case class Config(
command: List[String],
execPath: String,
hashSize: Int,
nbThreads: Int,
nbInstances: Int,
playMaxMoveTime: FiniteDuration,
analyseMoveTime: FiniteDuration,

View File

@ -24,7 +24,9 @@ final class Env(
val ServerOnly = c getBoolean "server-only"
private val config = new Config(
command = c.getStringList("command").toList,
execPath = c getString "exec_path",
hashSize = c getInt "hash_size",
nbThreads = c getInt "threads",
nbInstances = c getInt "instances",
playMaxMoveTime = c duration "play.movetime",
analyseMoveTime = c duration "analyse.movetime",

View File

@ -57,9 +57,9 @@ private[ai] final class Process(
object Process {
def apply(command: List[String], name: String)(out: String => Unit, err: String => Unit, debug: Boolean) =
def apply(execPath: String, name: String)(out: String => Unit, err: String => Unit, debug: Boolean) =
new Process(
builder = SProcess(command),
builder = SProcess(execPath),
name = name,
out = out,
err = err,

View File

@ -18,7 +18,7 @@ private[ai] final class Puller(
private val name: String = s"$id"
private val master = context.parent
private val worker: ActorRef = context.actorOf(
Props(classOf[ActorFSM], name, Process(config.command, s"SF-$id") _, config, logger),
Props(classOf[ActorFSM], name, Process(config.execPath, s"SF-$id") _, config, logger),
name = name)
private def pull {

View File

@ -13,11 +13,14 @@
height: 64px;
padding-left: 64px;
width: 512px;
border-radius: 3px;
box-sizing: border-box;
}
body.dark #board_editor .spare.black {
#board_editor .spare.black {
background: #444;
border-radius: 3px;
}
#board_editor .spare.white {
background: #ccc;
}
#board_editor .spare.top {
margin-bottom: 15px;

View File

@ -27,6 +27,7 @@ module.exports = function(opts) {
this.vm = {
ply: init.startPly(this.data),
initializing: true,
flip: false,
redirecting: false,
replayHash: '',

View File

@ -42,7 +42,9 @@ module.exports = {
if (!ctrl.data.player.spectator && ctrl.vm.ply !== round.lastPly(ctrl.data))
setTimeout(function() {
ctrl.vm.initializing = false;
if (ctrl.jump(round.lastPly(ctrl.data))) m.redraw();
}, 500);
else ctrl.vm.initializing = false;
}
};

View File

@ -136,7 +136,7 @@ function renderButtons(ctrl) {
return m('a', {
class: 'button ' + b[0] + ' ' + classSet({
disabled: (ctrl.broken || !enabled),
glowed: b[0] === 'last' && ctrl.isLate()
glowed: b[0] === 'last' && ctrl.isLate() && !ctrl.vm.initializing
}),
'data-icon': b[1],
onclick: enabled ? partial(ctrl.jump, b[2]) : null
@ -147,8 +147,9 @@ function renderButtons(ctrl) {
function autoScroll(el, ctrl) {
raf(function() {
if (ctrl.data.steps.length < 7) return;
var st;
if (ctrl.vm.ply === round.lastPly(ctrl.data)) st = 9999;
if (ctrl.vm.ply >= round.lastPly(ctrl.data) - 1) st = 9999;
else {
var plyEl = el.querySelector('.active') || el.querySelector('turn:first-child');
if (plyEl) st = plyEl.offsetTop - el.offsetHeight / 2 + plyEl.offsetHeight / 2;
@ -168,11 +169,12 @@ module.exports = function(ctrl) {
ctrl.replayEnabledByPref() ? m('div.moves', {
config: function(el, isUpdate) {
if (isUpdate) return;
var f = partial(autoScroll, el, ctrl);
var scrollNow = partial(autoScroll, el, ctrl);
ctrl.vm.autoScroll = {
now: f,
throttle: util.throttle(300, false, f)
now: scrollNow,
throttle: util.throttle(300, false, scrollNow)
};
scrollNow();
},
onmousedown: function(e) {
var turn = parseInt($(e.target).siblings('index').text());