For speed you should also use bytes rather than vector to avoid the cost of indirection
What could be the reason not to use the match feature?
The only situation I can think of is that you are modifying core Racket, and (require racket/match)
would create a cyclic dependency.
@laurent.orseau I did decide to use bytes, but I thought there was no indirection for vectors of immediate values.
Thanks. I have come across that. The <https://www.chessprogramming.org/Main_Page|chess programming wiki> has been (a little) helpful also.
I have modest goals - I simply want to create an engine good enough to beat me :) I’m probably ~ 1650, or so.
So I’m taking an 80/20 approach - I’ll use alpha beta, and I think I’ll have to have at least a small opening book, and I’ll probably extend the depth of search for captures (or other significant moves), but I’m not going to do the fancy stuff initially.
Transposition tables ate going to save you a lot though, i recommend
I’ll look into them, but as far as storing positions I’ve searched, it seems like they will have always been searched at a lesser depth, so I’m unsure of the value. I do agree that being able to transpose between book openings might be useful.
My first go years ago with Racket used a functional approach out of curiosity - I think that’s doomed to inferiority :) This time I’m mutating the heck out of things and allocating very little, I think it will beat me :)
It’s also relatively easy to implement
(afk) I’m not sure. I don’t think it’s documented, so I wouldn’t rely on it. If it’s documented then go for it i guess
@badkins By the way, 1650 is not bad at all!:chess_pawn: (In fact, it’s impressive.)
It’s not impressive if you knew how long I’ve been playing, and how many hours I’ve spent :)
A good friend of mine was only ~ 1,900, but he could beat me every time, and easily, w/o ever looking at the board!!
Of course, he does have nearly total recall, so that’s not fair :)
What’s “recall”? Total recollection of the board? That’s very impressive too. Very curious. I’ve been playing (for fun) for many years too, though I kinda don’t play much anymore, but I never really found a way to understand strategies beyond the obvious ones — such as a good attention. So even though I easily beat everyone that doesn’t really play, I can never beat a player at your level, say. How do people eventually find their ways to such different levels of expertise? In chess, I have no idea. In programming, for example, I was really about to focus on math instead of computer science when I discovered sort of by accident the book HtDP and then I made a whole new career plan — which I have been happily following. So Lisp, Racket and the HtDP authors showed me a way to think that let me see beyond. In chess, I never found such thing. Though, true, I never really read a single book on chess. So maybe that explains. (I did read many books in computer science and programming and so it took really many years until I found something that I could really think it was powerful and beautiful and worth investing on.)
The last couple of years, I have been quite fond of playing bullet on Lichess.
But … er … with your rating - I think your goal is plenty ambitious :slightly_smiling_face:
@anything “total recall” as in an extremely good memory - not forgetting things.
@soegaard2 I think I got up to 1780 on http://chess.com\|chess.com when I was studying a lot. Now I just play 5 minute blitz games on lichess and have hit 1680, but settled around 1650 if I concentrate :)
Engine is looking promising - assuming it’s working ok, it did a ply of 8 in 31 seconds w/ very little gc time. My functional approach never hit 6.
With a few smarts, I think a ply of 8 will crush me :)
I’ll put the code on github when it’s working.
I very briefly hit 1663 on Lichess (bullet), but is usually around 1550–1600. The rating suffers, if I play when tired :slightly_smiling_face:
I’ll look forward to playing your program.
Have you by chance seen the listings of the old 1–2k bytes programs?
No, but I once saw a tiny little Javascript program that was quite good :)
lol - I don’t have the main loop yet, so I have to painfully enter moves in code, but I just played d4 and it responded with c5. At first I thought it was a stupid move, and that I have a lot of work to do, but it turns out to be “Benoni Defense” from MCO–13 :)
Son of sorrows!
Hmm. I can’t find the program I was thinking of. I’ll send you a link, if I stumble upon it again.
It might have been this program ny Peter Jennings for the KIM–1 (the KIM–1 was made by Chuck Peddle, the main designer of ohe 6502 cpu, in 1976): http://www.benlo.com/microchess/index.html The manual contains both the algorithm for the evaluation of a board as well as the complete source listing! http://benlo.com/microchess/Kim-1Microchess.html
Wow, I just got spanked at ply 7 :) I’m very pleased!
Lol. Awesome. I have the same dream, I gotta tell you — write a chess engine that beats me and I always knew this was going to be easy to do (I mean beat me, not write it), but I got a long way to go still before I can tackle something like that. Both of you have actually amazing ratings. Years ago I used to play on http://freechess.org\|freechess.org using xboard or winboard. These days I would just anonymously hop on http://lichess.com\|lichess.com and play. Over the years I kinda settled on playing 3 minute matches, but 5 minutes is also very interesting.
I watched a documentary on Claude Shannon some other day. The movie showed a chess machine that would move the real solid pieces in your front of you. I suppose he must have built something like that. Pretty cool.
I think the 7 ply was a fluke. I just beat it pretty badly w/ 7 ply. I think it’s because I don’t have any extended search i.e. following captures.
Woohoo - using a depth of 8, the program just mated me! I can’t wait to add a few optimizations.
Here’s the game: 1. a3 d5 2. d4 Nc6 3. e3 Nf6 4. a4 e5 5. Bb5 Bd7 6. Bxc6 Bxc6 7. dxe5 Ne4 8. f4 Qh4+ 9. g3 Nxg3 10. Nf3 Qh5 11. Rg1 Ne4 12. b3 O-O-O 13. Ke2 f6 14. Bb2 Qe8 15. h4 Qf7 16. Qd4 fxe5 17. Qxa7 b6 18. Nxe5 Qe6 19. Bd4 Bd6 20. Nxc6 Kd7 21. Nxd8 Rxd8 22. Rxg7+ Be7 23. c4 Nc5 24. cxd5 Qh3 25. Bxc5 Qh2+ 26. Kf3 Qh1+ 27. Ke2 Qxd5 28. Rxe7+ Kc6 29. Qxc7#
I did make a few questionable moves in a hurry, but it still played a decent game.
Stockfish felt White’s 12 move was a blunder giving Black an advantage of about 6 points.
That is a very decent game. It’s definitely cool. Congrats! Regarding the 12th move, I have no idea why — Stockfish on Lichess does indeed prefer Qe2 on the 12th move.