elo: fix display 2
This commit is contained in:
parent
3ad74c90b7
commit
14254e44ba
14
src/elo.rs
14
src/elo.rs
@ -5,7 +5,7 @@ use crate::{
|
|||||||
logic::{ChildrenEvalMethod, FutureMoveConfig},
|
logic::{ChildrenEvalMethod, FutureMoveConfig},
|
||||||
repr::{Board, Piece, Winner},
|
repr::{Board, Piece, Winner},
|
||||||
};
|
};
|
||||||
use indicatif::{ParallelProgressIterator, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||||
use skillratings::{
|
use skillratings::{
|
||||||
@ -202,12 +202,6 @@ impl PlayerArena {
|
|||||||
|
|
||||||
created_pairs
|
created_pairs
|
||||||
.into_par_iter()
|
.into_par_iter()
|
||||||
.progress_with_style({
|
|
||||||
ProgressStyle::with_template(
|
|
||||||
"[{elapsed_precise}] {pos:>7}/{len:7} ETA: {eta}",
|
|
||||||
)
|
|
||||||
.expect("invalid ProgressStyle")
|
|
||||||
})
|
|
||||||
.map(|((i, j), (p1, p2))| (i, j, Self::play_two_inner(p1, p2)))
|
.map(|((i, j), (p1, p2))| (i, j, Self::play_two_inner(p1, p2)))
|
||||||
.for_each(|(i, j, o)| {
|
.for_each(|(i, j, o)| {
|
||||||
sender.send((i, j, o)).expect("Failed to send result");
|
sender.send((i, j, o)).expect("Failed to send result");
|
||||||
@ -220,9 +214,15 @@ impl PlayerArena {
|
|||||||
|
|
||||||
// Process results on main thread as they arrive
|
// Process results on main thread as they arrive
|
||||||
let mut received_num = 0;
|
let mut received_num = 0;
|
||||||
|
let p = ProgressBar::new(num as u64).with_style(
|
||||||
|
ProgressStyle::with_template("[{elapsed_precise}] {pos:>7}/{len:7} ETA: {eta}")
|
||||||
|
.expect("invalid ProgressStyle"),
|
||||||
|
);
|
||||||
|
|
||||||
while let Ok((i, j, o)) = receiver.recv() {
|
while let Ok((i, j, o)) = receiver.recv() {
|
||||||
self.process_outcome(i, j, &o);
|
self.process_outcome(i, j, &o);
|
||||||
received_num += 1;
|
received_num += 1;
|
||||||
|
p.inc(1);
|
||||||
|
|
||||||
term.clear_last_lines(self.players.len())
|
term.clear_last_lines(self.players.len())
|
||||||
.expect("unable to clear prev lines");
|
.expect("unable to clear prev lines");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user