| 1 | #! /bin/false | ||
| 2 | |||
| 3 | # Copyright (C) 2021-2026 Guido Flohr <guido.flohr@cantanea.com>, | ||
| 4 | # all rights reserved. | ||
| 5 | |||
| 6 | # This program is free software. It comes without any warranty, to | ||
| 7 | # the extent permitted by applicable law. You can redistribute it | ||
| 8 | # and/or modify it under the terms of the Do What the Fuck You Want | ||
| 9 | # to Public License, Version 2, as published by Sam Hocevar. See | ||
| 10 | # http://www.wtfpl.net/ for more details. | ||
| 11 | |||
| 12 | package Chess::Plisco::Engine::Constants; | ||
| 13 | 9 | $Chess::Plisco::Engine::Constants::VERSION = 'v1.0.3'; | |
| 14 | 9 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 9 | ▶ | use integer; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 9 | ▶ | use base qw(Exporter); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 9 | ▶ | use constant DEPTH_QUIESCENCE => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 9 | ▶ | use constant DEPTH_UNSEARCHED => -2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 9 | ▶ | use constant DEPTH_ENTRY_OFFSET => -3; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | 9 | ▶ | use constant BOUND_NONE => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 9 | ▶ | use constant BOUND_UPPER => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 9 | ▶ | use constant BOUND_LOWER => 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | 9 | ▶ | use constant BOUND_EXACT => 3; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | # For debugging output. | ||
| 29 | 9 | ▶ | use constant BOUND_TYPES => [ |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 'BOUND_NONE', 'BOUND_UPPER', 'BOUND_LOWER', 'BOUND_EXACT', | ||
| 31 | 9 | ]; | |
| 32 | |||
| 33 | 9 | ▶ | use constant MATE => 32000; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 9 | ▶ | use constant INF => MATE + 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | 9 | ▶ | use constant NONE => INF + 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 9 | ▶ | use constant MAX_PLY => 246; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | 9 | ▶ | use constant DRAW => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 38 | |||
| 39 | 9 | ▶ | use constant MATE_IN_MAX_PLY => MATE - MAX_PLY; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | 9 | ▶ | use constant MATED_IN_MAX_PLY => -MATE_IN_MAX_PLY; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | |||
| 42 | 9 | ▶ | use constant VALUE_TB => MATE_IN_MAX_PLY - 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 43 | 9 | ▶ | use constant VALUE_TB_WIN_IN_MAX_PLY => VALUE_TB - MAX_PLY; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | 9 | ▶ | use constant VALUE_TB_LOSS_IN_MAX_PLY => -VALUE_TB_WIN_IN_MAX_PLY; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | |||
| 46 | # Node types for search. | ||
| 47 | 9 | ▶ | use constant ROOT_NODE => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | 9 | ▶ | use constant PV_NODE => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | 9 | ▶ | use constant NON_PV_NODE => 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 50 | |||
| 51 | # For debugging output. | ||
| 52 | 9 | ▶ | use constant NODE_TYPES => ['Root', 'PV', 'NonPV']; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 53 | |||
| 54 | # Indices into TT probe results. | ||
| 55 | # | ||
| 56 | # Boolean flag for a hit. | ||
| 57 | 9 | ▶ | use constant TT_ENTRY_OCCUPIED => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 58 | # The depth of the entry. | ||
| 59 | 9 | ▶ | use constant TT_ENTRY_DEPTH => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 60 | # The best move. | ||
| 61 | 9 | ▶ | use constant TT_ENTRY_MOVE => 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 62 | # Value and static evaluation. | ||
| 63 | 9 | ▶ | use constant TT_ENTRY_VALUE => 3; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 64 | 9 | ▶ | use constant TT_ENTRY_EVAL => 4; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 65 | # Bound type. | ||
| 66 | 9 | ▶ | use constant TT_ENTRY_BOUND_TYPE => 5; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 67 | # Flag for PV nodes. | ||
| 68 | 9 | ▶ | use constant TT_ENTRY_PV => 6; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 69 | # The index into the TT array. | ||
| 70 | 9 | ▶ | use constant TT_CLUSTER_INDEX => 7; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 71 | # The index of the bucket inside the cluster. | ||
| 72 | 9 | ▶ | use constant TT_BUCKET_INDEX => 8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 73 | # The current bucket. | ||
| 74 | 9 | ▶ | use constant TT_BUCKET => 9; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 75 | |||
| 76 | 9 | our @EXPORT = qw( | |
| 77 | DEPTH_QUIESCENCE DEPTH_UNSEARCHED DEPTH_ENTRY_OFFSET | ||
| 78 | BOUND_NONE BOUND_UPPER BOUND_LOWER BOUND_EXACT BOUND_TYPES | ||
| 79 | MATE INF MAX_PLY DRAW | ||
| 80 | ROOT_NODE PV_NODE NON_PV_NODE NODE_TYPES | ||
| 81 | MATE_IN_MAX_PLY MATED_IN_MAX_PLY | ||
| 82 | VALUE_TB VALUE_TB_WIN_IN_MAX_PLY VALUE_TB_LOSS_IN_MAX_PLY | ||
| 83 | ); | ||
| 84 | |||
| 85 | 9 | 1; | |