I mean time complexity is proportional to the number of pieces on the chessboard (if I don't compute mobility). If I use mobility I have to generate all moves. So then time complexity is proportional to number of moves.
So its O(number of chess pieces) against O(number of moves).
Edit[we are talking about evaluation function only]
How to improve tactical play ?
Moderator: Ras
-
Sven
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: How to improve tactical play ?
Ok, now I understand. This means, so far your evaluation function was basically material+PST only, plus maybe some terms that do not involve scanning the board. Now mobility (which certainly one of the most expensive eval terms but not unimportant for playing strength) comes in as the first term that needs scanning the board, so it will obviously cause a slowdown. But by how much? If you say "I lose two plies" then a factor of 9 or 16 (for an EBF of 3 or 4) seems quite huge for me.Henk wrote:I mean time complexity is proportional to the number of pieces on the chessboard (if I don't compute mobility). If I use mobility I have to generate all moves. So then time complexity is proportional to number of moves.
So its O(number of chess pieces) against O(number of moves).
Edit[we are talking about evaluation function only]
Clearly mobility evaluation is expensive. But you get a value back, by penalizing inactive pieces and favoring those with a high mobility and therefore improving the detection of bad positions and moves.
Sven
-
Henk
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: How to improve tactical play ?
It's the mobility that checks if a field is attacked by a pawn that costs me two ply. Just counting moves is far less costly. Only one play or so. My test uses fixed time per move. So truncation may cost a ply too.Sven Schüle wrote:Ok, now I understand. This means, so far your evaluation function was basically material+PST only, plus maybe some terms that do not involve scanning the board. Now mobility (which certainly one of the most expensive eval terms but not unimportant for playing strength) comes in as the first term that needs scanning the board, so it will obviously cause a slowdown. But by how much? If you say "I lose two plies" then a factor of 9 or 16 (for an EBF of 3 or 4) seems quite huge for me.Henk wrote:I mean time complexity is proportional to the number of pieces on the chessboard (if I don't compute mobility). If I use mobility I have to generate all moves. So then time complexity is proportional to number of moves.
So its O(number of chess pieces) against O(number of moves).
Edit[we are talking about evaluation function only]
Clearly mobility evaluation is expensive. But you get a value back, by penalizing inactive pieces and favoring those with a high mobility and therefore improving the detection of bad positions and moves.
Sven
-
hgm
- Posts: 28480
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: How to improve tactical play ?
Keeping track of which squares are attacked by Pawns should not be that expensive, compared to counting moves. Even without bitboards it is something you can do incrementally, with almost no cost at all.
-
Henk
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: How to improve tactical play ?
Maybe there are some other (performance) bugs. My tests are bad too as usual. I have to repeat it all and be more careful.hgm wrote:Keeping track of which squares are attacked by Pawns should not be that expensive, compared to counting moves. Even without bitboards it is something you can do incrementally, with almost no cost at all.
-
Henk
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: How to improve tactical play ?
Another example of a highly tactical game lost by Skipper.
For now I only added mobility (simple move count) to the knight.
[pgn]
[Site "http://lichess.org/vQlUvmvZ"]
[Date "2014.03.25"]
[White "Anonymous"]
[Black "AI-level-7"]
[Result "0-1"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "106"]
[Variant "Standard"]
1. Nc3 d5 2. d4 Nf6 3. Nf3 e6 4. Bf4 Be7 5. e3 O-O 6. Bd3 c5 7. O-O Nbd7 8. b3 Nh5 9. Be5 g6 10. Qd2 a6 11. e4 Nxe5 12. dxe5 d4 13. Ne2 b5 14. c3 g5 15. cxd4 g4 16. Ne1 Bb7 17. dxc5 Bxc5 18. Rad1 Qh4 19. b4 Be7 20. Qc3 Rac8 21. Qb2 Qg5 22. Nc2 f6 23. exf6 Bxf6 24. Qb3 Rfe8 25. g3 Be5 26. f4 gxf3 27. Rxf3 Qg4 28. Rf2 Nf4 29. Rxf4 Bxf4 30. h3 Qg6 31. Nxf4 Qxg3+ 32. Ng2 Qxh3 33. Nce3 Rcd8 34. e5 Bf3 35. Rd2 Kh8 36. Qc3 Bxg2 37. Nxg2 Qg3 38. Rd1 Qf3 39. Qc2 Reg8 40. Rd2 Rd4 41. Bf1 Qe3+ 42. Rf2 Rh4 43. Qc5 Qh6 44. Rf3 Rh1+ 45. Kf2 Qd2+ 46. Be2 Rh2 47. Kf1 Rhxg2 48. Re3 Rg2g1+ 49. Kf2 Qe1+ 50. Kf3 Rg1g4 51. Bc4 Qd1+ 52. Re2 Rg4g3+ 53. Kf2 Qg1# 0-1
[/pgn]
For now I only added mobility (simple move count) to the knight.
[pgn]
[Site "http://lichess.org/vQlUvmvZ"]
[Date "2014.03.25"]
[White "Anonymous"]
[Black "AI-level-7"]
[Result "0-1"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "106"]
[Variant "Standard"]
1. Nc3 d5 2. d4 Nf6 3. Nf3 e6 4. Bf4 Be7 5. e3 O-O 6. Bd3 c5 7. O-O Nbd7 8. b3 Nh5 9. Be5 g6 10. Qd2 a6 11. e4 Nxe5 12. dxe5 d4 13. Ne2 b5 14. c3 g5 15. cxd4 g4 16. Ne1 Bb7 17. dxc5 Bxc5 18. Rad1 Qh4 19. b4 Be7 20. Qc3 Rac8 21. Qb2 Qg5 22. Nc2 f6 23. exf6 Bxf6 24. Qb3 Rfe8 25. g3 Be5 26. f4 gxf3 27. Rxf3 Qg4 28. Rf2 Nf4 29. Rxf4 Bxf4 30. h3 Qg6 31. Nxf4 Qxg3+ 32. Ng2 Qxh3 33. Nce3 Rcd8 34. e5 Bf3 35. Rd2 Kh8 36. Qc3 Bxg2 37. Nxg2 Qg3 38. Rd1 Qf3 39. Qc2 Reg8 40. Rd2 Rd4 41. Bf1 Qe3+ 42. Rf2 Rh4 43. Qc5 Qh6 44. Rf3 Rh1+ 45. Kf2 Qd2+ 46. Be2 Rh2 47. Kf1 Rhxg2 48. Re3 Rg2g1+ 49. Kf2 Qe1+ 50. Kf3 Rg1g4 51. Bc4 Qd1+ 52. Re2 Rg4g3+ 53. Kf2 Qg1# 0-1
[/pgn]
-
Henk
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: How to improve tactical play ?
With incrementally you mean when making and unmaking a move you update the attacked squares by the pawns ? Don't think that would be cheaper for you have order power(m, depth -1) non leave nodes.hgm wrote:Keeping track of which squares are attacked by Pawns should not be that expensive, compared to counting moves. Even without bitboards it is something you can do incrementally, with almost no cost at all.
-
hgm
- Posts: 28480
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: How to improve tactical play ?
That is much smaller than the number of leaf nodes, power(m, depth), right? But, more importantly, when updating during MakeMove you only have to consider two capture moves of a single Pawn in the old and new position, and that only when you move a Pawn. If you calculate it from scratch you would have to loop over all Pawns always, and clear the entire board before you do so, to make sure that squares not attacked by Pawns will get a zero count.Henk wrote:With incrementally you mean when making and unmaking a move you update the attacked squares by the pawns ? Don't think that would be cheaper for you have order power(m, depth -1) non leave nodes.
-
Henk
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: How to improve tactical play ?
If a pawn is captured you have to update too, so you have to test each capture too.hgm wrote:That is much smaller than the number of leaf nodes, power(m, depth), right? But, more importantly, when updating during MakeMove you only have to consider two capture moves of a single Pawn in the old and new position, and that only when you move a Pawn. If you calculate it from scratch you would have to loop over all Pawns always, and clear the entire board before you do so, to make sure that squares not attacked by Pawns will get a zero count.Henk wrote:With incrementally you mean when making and unmaking a move you update the attacked squares by the pawns ? Don't think that would be cheaper for you have order power(m, depth -1) non leave nodes.
-
hgm
- Posts: 28480
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: How to improve tactical play ?
Indeed, that is true. But applying the eeffects of the disappearance of two Pawns and re-appearance of one of them elsewhere is still much less work than creating an empty scratch board, and letting 8 Pawns appear there. Plus that only a small fraction of the moves move or capture a Pawn. Most moves might be Pawn moves in the initial position, but that quickly reverses once you develop pieces and Pawn chains start interlocking.