From e423bba6ce1bf496ae7f4a1db38281bd09486af0 Mon Sep 17 00:00:00 2001 From: Tony Yang Date: Mon, 27 Dec 2021 04:36:00 +0800 Subject: [PATCH] [Update] control range of game --- game.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game.cpp b/game.cpp index 150792d..9004b0f 100644 --- a/game.cpp +++ b/game.cpp @@ -43,8 +43,8 @@ class Game { this->count++; if (num == answer) return true; - if (num > answer) this->upper = num; - else if (num < answer) this->lower = num; + if (num > answer && num < this->upper) this->upper = num; + else if (num < answer && num > this->lower) this->lower = num; return false; }