Skip to content

Commit

Permalink
Plus or minus boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromind committed Apr 17, 2024
1 parent f9c719b commit 6a41819
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/Running examples/plus_or_minus/plus_or_minus_full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@ async fn b(role: &mut B) -> Result<(), Box<dyn Error>> {

async fn c(role: &mut C) -> Result<(), Box<dyn Error>> {
try_session(role, HashMap::new(), |s: PlusMinusC<'_, _>| async {
let mut min = 0;
let mut max = 10000000; // both included
let mut min = i32::MIN;
let mut max = i32::MAX; // both included
let mut s = s;
loop {
let attempt = min + ((max - min) / 2);
let attempt = min/2 + max/2;
let s1 = s.send(Guess(attempt)).await?;
match s1.branch().await? {
PlusMinusC2::Correct(Correct(_), s_end) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ async fn b(role: &mut B) -> Result<(), Box<dyn Error>> {

async fn c(role: &mut C) -> Result<(), Box<dyn Error>> {
try_session(role, HashMap::new(), |s: PlusMinusC<'_, _>| async {
let mut min = 0;
let mut max = 10000000; // both included
let mut min = i32::MIN;
let mut max = i32::MAX; // both included
let mut s = s;
loop {
let attempt = min + ((max - min) / 2);
let attempt = min/2 + max/2;
let s1 = s.send(Guess(attempt)).await?;
match s1.branch().await? {
PlusMinusC2::Correct(Correct(_), s_end) => {
Expand Down

0 comments on commit 6a41819

Please sign in to comment.