Bug 90195 - KReversi: Changing the skill level late in a game doesn't count as cheating
Summary: KReversi: Changing the skill level late in a game doesn't count as cheating
Status: RESOLVED FIXED
Alias: None
Product: kreversi
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Inge Wallin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-24 22:54 UTC by Inge Wallin
Modified: 2006-02-16 22:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Inge Wallin 2004-09-24 22:54:27 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

If you play at skill level 1 (beginner) all through a game, but change to level 7 (expert) at the last move, then the result of the game is attributed to level 7 in the highscore even though almost all of the game was played at level 1.

If the user changes skill level during the game, the score in the highscore list should be attributed to the lowest level that was ever used during the game.

Note: this should be the case even if the game is saved and then restored.  Hence the lowest level used must be saved with the rest of the game data.
Comment 1 Inge Wallin 2004-09-26 17:16:20 UTC
CVS commit by ingwa: 

Fix bug 90195: KReversi: Changing the skill level late in a game
doesn't count as cheating:

Introduce a parameter lowestStrength that keeps track of the lowest
strength used for the computer engine during the game.

I will backport this to KDE_3_3_BRANCH.

CCMAIL: 90195-done@bugs.kde.org


  M +9 -0      ChangeLog   1.39
  M +4 -1      board.cpp   1.49
  M +1 -0      board.h   1.21


--- kdegames/kreversi/ChangeLog  #1.38:1.39
@@ -1,4 +1,13 @@
 2004-09-26  Inge Wallin  <ingwa@c83-250-5-110.bredband.comhem.se>
 
+        Fix bug 90195: KReversi: Changing the skill level late in a game
+        doesn't count as cheating:
+        * board.h (Board::m_lowestStrength): new member
+        * board.cpp (Board::newGame): set m_lowestStrength
+        * board.cpp (Board::setStrength): update m_lowestStrength and
+        update highscore type.
+
+2004-09-26  Inge Wallin  <inge@lysator.liu.se>
+
         Fix Bug 90190: KReversi: Switch sides and then Undo gets the
         program out of sync.

--- kdegames/kreversi/board.cpp  #1.48:1.49
@@ -150,4 +150,5 @@ void Board::newGame()
   m_game->Reset();
   m_competitiveGame = Prefs::competitiveGameChoice();
+  m_lowestStrength  = strength();
   //kdDebug() << "Competitive: " << m_competitiveGame << endl;
 
@@ -322,5 +323,7 @@ void Board::setStrength(uint st)
   st = QMAX(QMIN(st, 7), 1);
   m_engine->setStrength(st);
-  KExtHighscore::setGameType(st-1);
+  if (m_lowestStrength < st)
+    m_lowestStrength = st;
+  KExtHighscore::setGameType(m_lowestStrength-1);
 }
 

--- kdegames/kreversi/board.h  #1.20:1.21
@@ -146,4 +146,5 @@ private:
 
   State    m_status;            // Ready, Thinking, Hint
+  bool     m_lowestStrength;    // Lowest strength during the game.
   bool     m_competitiveGame;   // True if the game has been
                                 // competitive during all moves so far.


Comment 2 Michel 2006-02-16 22:29:06 UTC
Don't know if this is the same bug, but I started a game on Expert, played a couple moves, and changed it to Average. I won the game and it listed my high score in the Expert ranking rather than Average.

KReversi v1.6
OS FreeBSD 6.0 Release for x86
gcc version 3.4.4 20050518