Skip to content

Commit

Permalink
Merge pull request #8 from miguel-ambrona/ambrona@fast-flag
Browse files Browse the repository at this point in the history
Quick version
  • Loading branch information
miguel-ambrona authored Jan 4, 2024
2 parents 898f2f3 + 03ac62d commit 0b37dc6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ followed by a list of commands separated by `>>=`.
(Input lines starting with `//` are ignored.)

The following commands are supported:
- `r[0-9]+`: retracts as many half moves as the integer indicates.
- `r[0-9]+`: retracts as many half moves as the integer indicates in all
open goals.
The retraction routine does not perform any legality checks on the
retracted position (which may contain non-standard material or immaginary
checks). However, if the given position is **dead**, all retracted positions
will be **alive**.

- `flip`: flips the turn of all open goals.

- A solve command (which stops the potential `>>=` chain). The following solve
commands are supported:
- `#[0-9]+[.5]?`: *forced mate* in the given number of moves.
Expand Down Expand Up @@ -120,6 +124,15 @@ nsols 1
nsols 0
```

- For impatients, you can run *Deadpos* with flag `--fast` to significtly
speed-up the analysis of dead positions. This means the analysis may miss
some complicated dead positions and there is no way to know about it.
Use this flag if you want to find cooks (if they exist, they will probably
be found anyway) or you are designing a problem, but in order to mark a
problem as C+ (computer tested) you should run the program without this flag.

- You can disable the progress bar with `--no-progress-bar`.

## Feedback

Please, open an issue if you have any suggestions.
Expand Down
1 change: 1 addition & 0 deletions lib/cha/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

cha:
git clone https://github.com/miguel-ambrona/D3-Chess.git
cd D3-Chess/ && git checkout 6dcb86e7f7751dfddd7e9d0ee9b01106e2612728
cd D3-Chess/src/ && make && make cha-lib

install:
Expand Down
17 changes: 16 additions & 1 deletion src/deadpos.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def set_ep(fen, ep):
words[3] = ep
return " ".join(words)

def flip_turn(fen):
print(fen)
words = fen.split(" ")
words[1] = "w" if words[1] == "b" else "b"
return " ".join(words)

def retractor_worker():
return Popen(["../lib/retractor/_build/default/retractor/retractor.exe"], \
stdout=PIPE, stdin=PIPE, stderr=STDOUT)
Expand Down Expand Up @@ -153,8 +159,17 @@ def process_cmd(fens, cmd, worker, mate_solver, draw_solver):
fens = retract(fens, worker, draw_solver)
return (fens, len(fens))

elif cmd == "flip":
new_fens = []
for (fen, aux) in fens:
fen = flip_turn(fen)
aux += ["flip"]
new_fens.append((fen, aux))

return (new_fens, len(new_fens))

else:
if "#" in cmd:
if "#" in cmd or "--fast" in sys.argv:
n = solve(cmd, fens, mate_solver)
else:
n = solve(cmd, fens, draw_solver)
Expand Down
2 changes: 1 addition & 1 deletion src/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int cooperative_search(Position &pos, Depth n, UTIL::Search &search) {
(GOAL == SOLVER::DRAW && dead) ||
(GOAL == SOLVER::DEAD && dead && !stalemate);

if (search.progress_bar() && (search.search_depth() <= 2 || n >= 6))
if (search.progress_bar() && (search.search_depth() <= 2 || n >= 4))
std::cout << "progress level " << search.search_depth()
<< " next " << nb_legal_moves << std::endl;

Expand Down

0 comments on commit 0b37dc6

Please sign in to comment.