
Spawkfish: Neural network chess - willlll
http://spawk.fish/introducing-spawkfish.html
======
agarden
In my game[0] it played well until it hit a position where it seemed to run
out of ideas. At that point, it let me take its queen for a rook. The strange
thing was that it felt like playing my five year old, who also plays well
until he runs out of ideas and then just sacrifices a piece.

It also missed the kind of tactics that my kid misses and played surprisingly
human like mistakes. Note move 35... Rxf2, as if it forgot about the bishop
because it had moved to the other end of the board. That's the kind of mistake
a human player might make and computers never do.

It strikes me that this would be a great engine for my five year old to
practice against. I'd love to see it added to lichess or put into a phone app
for that purpose.

0\. [http://en.lichess.org/beOA0Q2T#68](http://en.lichess.org/beOA0Q2T#68)

------
spawkfish
Hello, I'm the creator of spawkfish :)

The project is still in pretty early stages, so don't expect it won't take
down any strong chess players yet, but I'm hoping that with a bit of effort it
will be possible for neural networks to do for chess what they have recently
done for Go.

~~~
cven714
Very interesting! It played very natural, "human" positional moves and
defended against most obvious threats. There was one exception, where it
played a move that looked normal for the position--developing a piece in the
opening--but it also hung the piece. That was the only serious blunder, every
other mistake was in tactical lines more than one or two moves deep.

That seems to make sense for being trained by a NN, still impressive how well
it was able to spot concrete threats! Thank you for sharing.

(My elo is 2150ish)

~~~
spawkfish
Thanks for your feedback!

I've noticed it making quite a few errors like the one you mention. I think
that a little bit of search (say just one or two ply) will help a lot with
avoiding this kind of mistake, because the network seems very good at
recognizing when a piece is in trouble if you show it the position.

------
sabujp
It's pretty weak right now (I'm white) defeated it in less than 30 seconds :

    
    
      [Event "Spawkfish game"]
      [Date "2016.03.03"]
      [White "YOU!"]
      [Black "Spawkfish"]
      [Result "1-0"]
    
      1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Nc3 Nxe4
      5. Bxf7+ Kxf7 6. Nxe4 d5 7. Neg5+ Kg8
      8. d4 exd4 9. Nxd4 Nxd4 10. Qxd4 Qe7+
      11. Be3 h6 12. Qxd5+ Qf7 13. Qxf7# 1-0
    
    

My 1 min rating on licchess is ~1550 <-> 1700, but I can sometimes defeat any
players rated 1.8k - 2k at 1 min blitz.

------
adamt
That was really impressive. Other than playing very accurately, I felt it
played far more human-like than most computer chess engines.

I've written several chess engines, and have often wondered for some time
whether or not there was a chance for a more AI/pattern-driven approach.

Are you using your AI just for evaluation? E.g. do you have a traditional
PVS/negascout (or similar) search? Presumably an 'extreme Type C' (no search)
would fail to recognise various draws (50 move/repetition)?

Good work :-)

~~~
spawkfish
Thanks!

Right now I have just about as close to an "extreme type C" engine as
possible. There is a neural network that maps from a board position directly
to a ranked list of moves it wants to make., and a little bit of logic on top
of that to reject illegal moves.

The recognition of wins/draws/losses is actually done in a layer around the
engine, which doesn't understand these things yet. One of "tricks" it is
vulnerable to right now is being forced into a draw by repetition, because
doesn't know that is a thing to avoid.

Adding a more traditional search (augmented by the network, of course) is on
my todo list, and I think it will improve the playing strength a lot. I am
pleasantly surprised though, at how well it plays without any of that.

~~~
zardo
It would be interesting to see how strength and "human like play" scales with
the depth of the search.

There's also a really interesting possibility in training policy networks with
different attributes by using games from players with certain styles of play.

~~~
spawkfish
Training different policies in different styles is a really interesting idea.
You could then have a gating process that first chooses the "style" of move to
make and then uses the style-specific network to select a move.

I think getting data for this could be difficult though. I wonder how easy it
would be to automatically categorize a game record by "style"?

~~~
zardo
Or, rather than multiple policies, one policy that takes a player vector as an
input along with the board position. Players that you predict will make the
same move from a given board have their vectors adjusted toward each other and
away from a random sample of other player vectors.

If it works, you would be able to perform player vector math ala word2vec. (No
idea if it will work)

------
binarymax
I won :)

4R2k/p5p1/7p/n4Q2/7q/2PP1P2/Pr3P1P/5RK1 b - - 6 27

EDIT - for context, I was about 1900 USCF in my prime 20 years ago - still do
puzzles daily.

In any case, I think this is cool. I was also surprised it managed to play
efficiently given the load you must be feeling from HN. Thanks for making this
and showing it!

------
bainsfather
Normally against a chess computer, you try to play positionally and avoid
tactical situations - i.e. you avoid its strengths and target its (relative)
weakness.

It is nice (and also rather uncanny) to be in the opposite situation here.
Positionally it looks good, tactically, not so good.

A great project!

------
jhartmann
Seems very interesting, I really think these approaches will work rather well
on a variety of games. Very exciting times. Btw, there is another already Open
Source Neural Network Chess engine that might be worth exploring for similar
ideas. That codebase already has a minmax search based on the network
evaluation. Paper is at:
[http://arxiv.org/abs/1509.01549](http://arxiv.org/abs/1509.01549) Code is at:
[https://bitbucket.org/waterreaction/giraffe](https://bitbucket.org/waterreaction/giraffe)

~~~
spawkfish
Thanks for the tip :) I read this thesis when I started spawkfish, and it's
very nice work.

------
willlll
You can play against the bot online at
[http://spawk.fish/play/](http://spawk.fish/play/)

I lost, but I'm bad at chess.

------
mathattack
Very nice! The only thing missing is a Back button to allow me to back out of
mistakes. :-)

I believe that chess follows the state of the art in AI. The first wave of
success was based on brute force of computing better than people. Now it's
harnessing insight. Keep up the interesting work!

------
dfan
Very nice! It may be annoying, but I think at some point you really will need
to keep track of castling rights and en-passant (position repetition is much
harder but I don't think it is so necessary). Some evaluations depend very
heavily on them.

~~~
spawkfish
Oh, absolutely. The project is still in very early stages right now, so a lot
of important pieces are still missing.

------
anaolykarpov
I won (hardly, after I had 3 pawns against a knight during mid game) and I
don't think I'd reach 1600 elo if I were to play in tournaments. My elo is
about 1620 on chesstempo, where I solve tactics quite often (daily, during the
last 8 weeks or so)

------
tvelichkov
For a first time I'm actually having fun playing against a computer :D.

------
mkohlmyr
Definitely wasn't pretty. 1k2Q3/5Q2/8/2p5/3p4/1B1P2p1/2K5/8 b - - 5 56

------
torthrw
4RR2/1p4p1/p1p5/2p3p1/2P2kP1/7P/PP1r1P1K/8 b - - 2 31

Cool project but not hard to beat.

