nknguyenhc / CS3263-project

Xiangqi engine using principal variation search
0 stars 0 forks source link

[Bug] Sacrifice rook for nothing #7

Closed nknguyenhc closed 5 months ago

nknguyenhc commented 5 months ago

Engine: red, player: black

  1. H8+7 P3+1
  2. C2.3 H2+3
  3. C3+4 C2.1
  4. H2+3 R1.2
  5. C8+4 H8+9
  6. R1.2 R9.8
  7. R2+6 H3+4
  8. C3.1 P3+1
  9. P7+1 H4-2
  10. C1.5 H2-4
  11. R9.8 R2+9
-- -- E1 A1 K1 A1 E1 R1 --
-- -- -- -- -- -- -- -- --
C1 -- -- H1 -- -- -- C1 H1
P1 -- -- -- C0 -- -- R0 --
-- -- -- -- -- -- -- -- --
-- -- P0 -- -- -- -- -- --
P0 -- -- -- P0 -- P0 -- P0
-- -- H0 -- -- -- H0 -- --
-- -- -- -- -- -- -- -- --
-- R1 E0 A0 K0 A0 E0 -- --

At this stage, optimal move for red is H7-8 to take back the rook, however, engine decides R2+1??? The following is the trace:

optimal seq at depth=1: [H (7, 2) (9, 1)]
valuation at depth=1: 735.9394118129294
optimal seq at depth=2: [H (7, 2) (9, 1)]
valuation at depth=2: 735.9394118129294
optimal seq at depth=3: [H (7, 2) (9, 1)]
valuation at depth=3: 735.9394118129294
optimal seq at depth=4: [H (7, 2) (9, 1), K (0, 4) (1, 4)]
valuation at depth=4: 87.8377899642951
optimal seq at depth=5: [R (3, 7) (2, 7), R (0, 7) (2, 7), H (7, 2) (9, 1)]
valuation at depth=5: 57.31215886107964
  1. R2+1 R8+2
  2. H7-8 R8+5
-- -- E1 A1 K1 A1 E1 -- --
-- -- -- -- -- -- -- -- --
C1 -- -- H1 -- -- -- -- H1
P1 -- -- -- C0 -- -- -- --
-- -- -- -- -- -- -- -- --
-- -- P0 -- -- -- -- -- --
P0 -- -- -- P0 -- P0 -- P0
-- -- -- -- -- -- H0 R1 --
-- -- -- -- -- -- -- -- --
-- H0 E0 A0 K0 A0 E0 -- --

Here, red should run the horse, possibly with H3-5. Arguably, red is already in a bad position. The following is the trace:

optimal seq at depth=1: [H (7, 6) (8, 4)]
valuation at depth=1: 34.06811266572947
optimal seq at depth=2: [H (7, 6) (8, 4)]
valuation at depth=2: 34.06811266572947
optimal seq at depth=3: [H (7, 6) (8, 4)]
valuation at depth=3: 34.06811266572947
optimal seq at depth=4: [H (9, 1) (7, 2), K (0, 4) (1, 4)]
valuation at depth=4: -444.73308392122954
optimal seq at depth=5: [H (9, 1) (7, 2), K (0, 4) (1, 4), H (7, 6) (8, 4)]
valuation at depth=5: -628.391097172864
  1. H8+7 R8.7
  2. H7-5

The progression afterwards is not important.