I did try doing that, but it lead to distorted scores, and terrible moves.alvinypeng wrote: ↑Sun Feb 26, 2023 11:25 pmUsing tapered piece square tables can improve your engine positionally. Also, you can speed up your engine by incrementally updating your piece square table scores every time you make a move rather than computing them from scratch every time you call your evaluate function.Enderjed wrote: ↑Sun Feb 26, 2023 7:54 pm So far on my PC, the fastest I've been able to get 3.2 (and 3.2 "Archer") is 16 Kn/s, and generally takes less time than 30 seconds for it's first move.
It does search at far greater depths and faster when there are less pieces on the board (so far the current record is a depth of 12) [In testing, this has given Valiant a stronger endgame, giving it a unique skill curve over game time due to it's depth being tied to piece count.]
{Versions older than 3.2 and 3.2 archer run much slower due to their time management code being quite lenient}
The reasoning on why the engine is so slow is because:
1. It's compiled for python 3.x, which runs at the speed of an actual python
2. I would compile it in PyPy 3 to make it go [drastically] faster, but I have yet to learn on how to get it to successfully compile in PyPy3
3. Iterative deepening is what consumes the most time, but without it, the engine would be drastically lower in elo
Although I must say that I do thank you (and alvinypeng) for downloading my engine and giving it a shot.
Is there anything about it (strategically and/or positionally) that could use improvement?
Engine Release: Valiant
Moderator: Ras
-
- Posts: 39
- Joined: Tue Sep 27, 2022 7:13 pm
- Location: United Kingdom, East Midlands
- Full name: Jedidiah F. Sessions
Re: Engine Release: Valiant
-
- Posts: 243
- Joined: Tue Jan 31, 2023 4:34 pm
- Full name: Adam Kulju
Re: Engine Release: Valiant
Distorted scores? Are you sure there wasn't a bug in your code? A ((middlegamescore*phase) + (endgamescore*(maxphase-phase))/maxphase should not be very hard to implement and it gave a couple hundred elo for me.Enderjed wrote: ↑Sun Feb 26, 2023 11:32 pmI did try doing that, but it lead to distorted scores, and terrible moves.alvinypeng wrote: ↑Sun Feb 26, 2023 11:25 pmUsing tapered piece square tables can improve your engine positionally. Also, you can speed up your engine by incrementally updating your piece square table scores every time you make a move rather than computing them from scratch every time you call your evaluate function.Enderjed wrote: ↑Sun Feb 26, 2023 7:54 pm So far on my PC, the fastest I've been able to get 3.2 (and 3.2 "Archer") is 16 Kn/s, and generally takes less time than 30 seconds for it's first move.
It does search at far greater depths and faster when there are less pieces on the board (so far the current record is a depth of 12) [In testing, this has given Valiant a stronger endgame, giving it a unique skill curve over game time due to it's depth being tied to piece count.]
{Versions older than 3.2 and 3.2 archer run much slower due to their time management code being quite lenient}
The reasoning on why the engine is so slow is because:
1. It's compiled for python 3.x, which runs at the speed of an actual python
2. I would compile it in PyPy 3 to make it go [drastically] faster, but I have yet to learn on how to get it to successfully compile in PyPy3
3. Iterative deepening is what consumes the most time, but without it, the engine would be drastically lower in elo
Although I must say that I do thank you (and alvinypeng) for downloading my engine and giving it a shot.
Is there anything about it (strategically and/or positionally) that could use improvement?
go and star https://github.com/Adam-Kulju/Patricia!
-
- Posts: 39
- Joined: Tue Sep 27, 2022 7:13 pm
- Location: United Kingdom, East Midlands
- Full name: Jedidiah F. Sessions
Re: Engine Release: Valiant
It certainly could have been buggy or straight up logically incorrect code, as I am quite the poor programmer.
-
- Posts: 39
- Joined: Tue Sep 27, 2022 7:13 pm
- Location: United Kingdom, East Midlands
- Full name: Jedidiah F. Sessions
Re: Engine Release: Valiant
Due to a workload increase, updates to Valiant will be far less constant.
Although do feel free to enter the engine into tournaments, and/or suggest improvements.
Although do feel free to enter the engine into tournaments, and/or suggest improvements.
-
- Posts: 243
- Joined: Tue Jan 31, 2023 4:34 pm
- Full name: Adam Kulju
Re: Engine Release: Valiant
I got around to fully testing it and I am pretty sure something is wrong with your piece square tables. It keeps running its king up (and getting immediately crushed).
I looked at the eval code to 3.1 (I don't know if these mistakes are also in 3.2, but by its play it seems to be) and found:
1. [rather minor] your queen pst needs to be flipped like all of your other tables
2. [very major!] you are using the king pst for the endgame at all times, including the middlegame! Your search is not very deep, so what kept happening over and over again was Valiant kept running the king towards the center to improve its static evaluation score, and was unable to see that it lost tactically.
An example game which shows it:
[pgn][Event "*"]
[Site "*"]
[Date "2023.03.05"]
[Time "23:08:15"]
[Round "*"]
[White "Willow 2.5"]
[Black "Valiant 3.2"]
[Result "1-0"]
[Termination "mate"]
[ECO "E10"]
[Opening "Queen's pawn game"]
[TimeControl "60+1"]
[PlyCount "51"]
1.d4 Nf6 2.c4 e6
3.Nf3 {End of opening} Nc6 {-0.1/4 3620 8036; E10: Queen's pawn game} 4.e3 {+0.2/12 2229 470107} d5 {-0.1/4 5635 8618}
5.Nc3 {+0.2/12 1944 424338} Bb4 {-0.3/3 1839 122} 6.Bd3 {+0.5/13 4353 934391} Bxc3+ {-0.3/4 5821 9973}
7.bxc3 {+0.7/12 2836 625799} Kd7 {-0.5/3 1557 127} 8.Ba3 {+1.3/12 1806 396985} Ne4 {-0.5/3 2328 3687}
9.Qc2 {+1.4/11 2065 421962} f5 {-0.3/3 2315 3225} 10.cxd5 {+1.6/12 2563 541941} exd5 {-0.4/4 4909 5450}
11.c4 {+1.7/13 1789 362101} Ke6 {-0.5/3 1717 1610} 12.cxd5+ {+5.7/14 2302 428119} Kf6 {+4.3/4 3010 5198}
13.dxc6 {+5.9/14 3297 647607} Qd5 {+4.4/4 6986 7268} 14.Bb2 {+5.9/13 3030 606293} bxc6 {+3.6/3 2397 3136}
15.O-O {+6.0/13 4927 938080} Bb7 {+3.3/3 3150 5336} 16.Bc4 {+6.9/13 1636 225497} Qd6 {+3.6/3 2216 3054}
17.d5+ {+7.2/13 1724 313152} Kg6 {+3.7/4 4843 4492} 18.Ne5+ {+10.7/12 1991 394191} Kf6 {+4.5/4 4304 3246}
19.dxc6 {+12.9/13 3484 694331} Bxc6 {+6.9/3 2841 312} 20.Nf7+ {+13.2/14 2393 540059} Kg6 {+9.2/3 731 1509}
21.Nxd6 {+13.6/13 1880 411201} cxd6 {+9.3/3 1350 2968} 22.f3 {+13.6/11 1596 386518} Nc5 {+10.0/3 1568 3195}
23.Qc3 {+15.3/13 1765 389367} Kh5 {+10.4/3 1299 2321} 24.Qxg7 {+999.9/12 1543 276863} Rhc8 {+11.1/3 2030 5085}
25.Qxh7+ {+1000.0/14 2133 435021} Kg5 {+320.0/7 973 3233} 26.h4# {+1000.0/15 1859 358642} 1-0
[/pgn]
Fixing that should definitely boost your engine's rating by a few hundred ELO points
I looked at the eval code to 3.1 (I don't know if these mistakes are also in 3.2, but by its play it seems to be) and found:
1. [rather minor] your queen pst needs to be flipped like all of your other tables
2. [very major!] you are using the king pst for the endgame at all times, including the middlegame! Your search is not very deep, so what kept happening over and over again was Valiant kept running the king towards the center to improve its static evaluation score, and was unable to see that it lost tactically.
An example game which shows it:
[pgn][Event "*"]
[Site "*"]
[Date "2023.03.05"]
[Time "23:08:15"]
[Round "*"]
[White "Willow 2.5"]
[Black "Valiant 3.2"]
[Result "1-0"]
[Termination "mate"]
[ECO "E10"]
[Opening "Queen's pawn game"]
[TimeControl "60+1"]
[PlyCount "51"]
1.d4 Nf6 2.c4 e6
3.Nf3 {End of opening} Nc6 {-0.1/4 3620 8036; E10: Queen's pawn game} 4.e3 {+0.2/12 2229 470107} d5 {-0.1/4 5635 8618}
5.Nc3 {+0.2/12 1944 424338} Bb4 {-0.3/3 1839 122} 6.Bd3 {+0.5/13 4353 934391} Bxc3+ {-0.3/4 5821 9973}
7.bxc3 {+0.7/12 2836 625799} Kd7 {-0.5/3 1557 127} 8.Ba3 {+1.3/12 1806 396985} Ne4 {-0.5/3 2328 3687}
9.Qc2 {+1.4/11 2065 421962} f5 {-0.3/3 2315 3225} 10.cxd5 {+1.6/12 2563 541941} exd5 {-0.4/4 4909 5450}
11.c4 {+1.7/13 1789 362101} Ke6 {-0.5/3 1717 1610} 12.cxd5+ {+5.7/14 2302 428119} Kf6 {+4.3/4 3010 5198}
13.dxc6 {+5.9/14 3297 647607} Qd5 {+4.4/4 6986 7268} 14.Bb2 {+5.9/13 3030 606293} bxc6 {+3.6/3 2397 3136}
15.O-O {+6.0/13 4927 938080} Bb7 {+3.3/3 3150 5336} 16.Bc4 {+6.9/13 1636 225497} Qd6 {+3.6/3 2216 3054}
17.d5+ {+7.2/13 1724 313152} Kg6 {+3.7/4 4843 4492} 18.Ne5+ {+10.7/12 1991 394191} Kf6 {+4.5/4 4304 3246}
19.dxc6 {+12.9/13 3484 694331} Bxc6 {+6.9/3 2841 312} 20.Nf7+ {+13.2/14 2393 540059} Kg6 {+9.2/3 731 1509}
21.Nxd6 {+13.6/13 1880 411201} cxd6 {+9.3/3 1350 2968} 22.f3 {+13.6/11 1596 386518} Nc5 {+10.0/3 1568 3195}
23.Qc3 {+15.3/13 1765 389367} Kh5 {+10.4/3 1299 2321} 24.Qxg7 {+999.9/12 1543 276863} Rhc8 {+11.1/3 2030 5085}
25.Qxh7+ {+1000.0/14 2133 435021} Kg5 {+320.0/7 973 3233} 26.h4# {+1000.0/15 1859 358642} 1-0
[/pgn]
Fixing that should definitely boost your engine's rating by a few hundred ELO points

go and star https://github.com/Adam-Kulju/Patricia!
-
- Posts: 39
- Joined: Tue Sep 27, 2022 7:13 pm
- Location: United Kingdom, East Midlands
- Full name: Jedidiah F. Sessions
Re: Engine Release: Valiant
If all the piece square tables are backwards, then that ironically means that the archer variant is more tactically correct than standard Valiant, even though Valiant "Archer" has a much lower winrate overallWhiskers wrote: ↑Mon Mar 06, 2023 6:16 am I got around to fully testing it and I am pretty sure something is wrong with your piece square tables. It keeps running its king up (and getting immediately crushed).
I looked at the eval code to 3.1 (I don't know if these mistakes are also in 3.2, but by its play it seems to be) and found:
1. [rather minor] your queen pst needs to be flipped like all of your other tables
2. [very major!] you are using the king pst for the endgame at all times, including the middlegame! Your search is not very deep, so what kept happening over and over again was Valiant kept running the king towards the centre to improve its static evaluation score, and was unable to see that it lost tactically.
Fixing that should definitely boost your engine's rating by a few hundred ELO points![]()
I have also done some further observations, and to attempt to counter this suicidal royal charge, for the next version I have added tapered piece square tables (albeit, there is no interpolation between the tapering, so in the future I might try to add various types of interpolation).
This has allowed it to play black more successfully, at the cost of losing to 3.2 Standard when playing as white.
In general, it has now been able to beat mildly stronger engines, such as LittleleLouch, Ax 0.8 and BBC 1.4 (with Stockfish NNUE)
Although it does still lose to some strategies, so I would predict it's Elo to be within a blunt range of 1200-2000
-
- Posts: 243
- Joined: Tue Jan 31, 2023 4:34 pm
- Full name: Adam Kulju
Re: Engine Release: Valiant
Have you made sure that all your piece square table lookups are operating properly? For example, if you have a white king on e1, and a black king on e8, does your engine add the correct value for both squares? (can be easily verified with a print statement or two)Enderjed wrote: ↑Mon Mar 06, 2023 4:43 pmIf all the piece square tables are backwards, then that ironically means that the archer variant is more tactically correct than standard Valiant, even though Valiant "Archer" has a much lower winrate overallWhiskers wrote: ↑Mon Mar 06, 2023 6:16 am I got around to fully testing it and I am pretty sure something is wrong with your piece square tables. It keeps running its king up (and getting immediately crushed).
I looked at the eval code to 3.1 (I don't know if these mistakes are also in 3.2, but by its play it seems to be) and found:
1. [rather minor] your queen pst needs to be flipped like all of your other tables
2. [very major!] you are using the king pst for the endgame at all times, including the middlegame! Your search is not very deep, so what kept happening over and over again was Valiant kept running the king towards the centre to improve its static evaluation score, and was unable to see that it lost tactically.
Fixing that should definitely boost your engine's rating by a few hundred ELO points![]()
I have also done some further observations, and to attempt to counter this suicidal royal charge, for the next version I have added tapered piece square tables (albeit, there is no interpolation between the tapering, so in the future I might try to add various types of interpolation).
This has allowed it to play black more successfully, at the cost of losing to 3.2 Standard when playing as white.
In general, it has now been able to beat mildly stronger engines, such as LittleleLouch, Ax 0.8 and BBC 1.4 (with Stockfish NNUE)
Although it does still lose to some strategies, so I would predict it's Elo to be within a blunt range of 1200-2000
Also, an easy way to stop the king from rushing into the middle would be to use this PST from the Simplified evaluation function during the middlegame and only switch to the other one once the amount of material on the board drops below a certain point.
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-20,-30,-30,-40,-40,-30,-30,-20,
-10,-20,-20,-20,-20,-20,-20,-10,
20, 20, 0, 0, 0, 0, 20, 20,
20, 30, 10, 0, 0, 10, 30, 20
go and star https://github.com/Adam-Kulju/Patricia!
-
- Posts: 39
- Joined: Tue Sep 27, 2022 7:13 pm
- Location: United Kingdom, East Midlands
- Full name: Jedidiah F. Sessions
Re: Engine Release: Valiant
Valiant Mk4 does have the same king PST for it's earlygame evaluation. Although it does change to midgame and endgame when turns progress, not when material falls.Whiskers wrote: ↑Mon Mar 06, 2023 6:04 pmHave you made sure that all your piece square table lookups are operating properly? For example, if you have a white king on e1, and a black king on e8, does your engine add the correct value for both squares? (can be easily verified with a print statement or two)Enderjed wrote: ↑Mon Mar 06, 2023 4:43 pmIf all the piece square tables are backwards, then that ironically means that the archer variant is more tactically correct than standard Valiant, even though Valiant "Archer" has a much lower winrate overallWhiskers wrote: ↑Mon Mar 06, 2023 6:16 am I got around to fully testing it and I am pretty sure something is wrong with your piece square tables. It keeps running its king up (and getting immediately crushed).
I looked at the eval code to 3.1 (I don't know if these mistakes are also in 3.2, but by its play it seems to be) and found:
1. [rather minor] your queen pst needs to be flipped like all of your other tables
2. [very major!] you are using the king pst for the endgame at all times, including the middlegame! Your search is not very deep, so what kept happening over and over again was Valiant kept running the king towards the centre to improve its static evaluation score, and was unable to see that it lost tactically.
Fixing that should definitely boost your engine's rating by a few hundred ELO points![]()
I have also done some further observations, and to attempt to counter this suicidal royal charge, for the next version I have added tapered piece square tables (albeit, there is no interpolation between the tapering, so in the future I might try to add various types of interpolation).
This has allowed it to play black more successfully, at the cost of losing to 3.2 Standard when playing as white.
In general, it has now been able to beat mildly stronger engines, such as LittleleLouch, Ax 0.8 and BBC 1.4 (with Stockfish NNUE)
Although it does still lose to some strategies, so I would predict it's Elo to be within a blunt range of 1200-2000
Also, an easy way to stop the king from rushing into the middle would be to use this PST from the Simplified evaluation function during the middlegame and only switch to the other one once the amount of material on the board drops below a certain point.
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-30,-40,-40,-50,-50,-40,-40,-30,
-20,-30,-30,-40,-40,-30,-30,-20,
-10,-20,-20,-20,-20,-20,-20,-10,
20, 20, 0, 0, 0, 0, 20, 20,
20, 30, 10, 0, 0, 10, 30, 20
-
- Posts: 39
- Joined: Tue Sep 27, 2022 7:13 pm
- Location: United Kingdom, East Midlands
- Full name: Jedidiah F. Sessions
Re: Engine Release: Valiant
MK V has finally been released. (along with source)
In terms of changes, the piece evaluation has been renovated, giving the engine a more discernible understanding of the start, mid, and endgame. This is alongside some cosmetic and auditory improvements.
It's strong enough to beat me now in a reasonable timeframe.
Within testing, it's win rate has become far more reliable. So I'd assume it's rating to be closer to 1600-2000.
In terms of changes, the piece evaluation has been renovated, giving the engine a more discernible understanding of the start, mid, and endgame. This is alongside some cosmetic and auditory improvements.
It's strong enough to beat me now in a reasonable timeframe.
Within testing, it's win rate has become far more reliable. So I'd assume it's rating to be closer to 1600-2000.
-
- Posts: 243
- Joined: Tue Jan 31, 2023 4:34 pm
- Full name: Adam Kulju
Re: Engine Release: Valiant
What's Valiant's strongest time control? It kind of struggled when I put it in a 30 seconds + 0.5 sec increment match
Code: Select all
Result:
--------------------------------------------------------------------------
# name games wins draws losses score elo + -
1. Celestial 100 98 1 1 98.5 304 105 66
2. VALIANT MK V 100 1 1 98 1.5 -304 66 105
Cross table:
--------------------------------------------------------------------------
# name score games 1 2
1. Celestial 98.5 100 x 111111111111111111111111111111111111111111111111111111=111111111101111111111111111111111111111111111
2. VALIANT MK V 1.5 100 000000000000000000000000000000000000000000000000000000=000000000010000000000000000000000000000000000 x
Tech:
--------------------------------------------------------------------------
Tech (average nodes, depths, time/m per move, others per game), counted for computing moves only, ignored moves with zero nodes:
# name nodes/m NPS depth/m time/m moves time #fails
1. Celestial 471K 501814 5.9 0.9 30.7 28.8 1
2. VALIANT MK V 2K 1322 3.2 1.2 30.2 36.4 1
all --- 232K 222385 4.5 1.1 30.5 32.6 2
go and star https://github.com/Adam-Kulju/Patricia!