diff --git a/contracts/src/models/game.cairo b/contracts/src/models/game.cairo index dfd7101..549ddfb 100644 --- a/contracts/src/models/game.cairo +++ b/contracts/src/models/game.cairo @@ -132,19 +132,38 @@ impl GameImpl of GameTrait { fn get_difficulty(ref self: Game) -> Difficulty { let mut difficulty = self.difficulty(); if (difficulty == Difficulty::None) { // Difficulty::None meaning increasing difficulty - difficulty = Difficulty::Master; - if (self.moves < 20) { - difficulty = Difficulty::Easy; - } else if (self.moves < 40) { - difficulty = Difficulty::Medium; - } else if (self.moves < 80) { - difficulty = Difficulty::MediumHard; - } else if (self.moves < 120) { - difficulty = Difficulty::Hard; - } else if (self.moves < 160) { - difficulty = Difficulty::VeryHard; - } else if (self.moves < 200) { - difficulty = Difficulty::Expert; + + // we are in normal mode or free mode + if(self.mode.into() == Mode::Normal) { + // weekly + if (self.moves < 20) { + difficulty = Difficulty::MediumHard; + } else if (self.moves < 40) { + difficulty = Difficulty::Hard; + } else if (self.moves < 80) { + difficulty = Difficulty::VeryHard; + } else if (self.moves < 120) { + difficulty = Difficulty::Expert; + } else { + difficulty = Difficulty::Master; + } + } else { + // free mode + if (self.moves < 20) { + difficulty = Difficulty::Easy; + } else if (self.moves < 40) { + difficulty = Difficulty::Medium; + } else if (self.moves < 80) { + difficulty = Difficulty::MediumHard; + } else if (self.moves < 120) { + difficulty = Difficulty::Hard; + } else if (self.moves < 160) { + difficulty = Difficulty::VeryHard; + } else if (self.moves < 200) { + difficulty = Difficulty::Expert; + } else { + difficulty = Difficulty::Master; + } } } difficulty diff --git a/contracts/src/types/mode.cairo b/contracts/src/types/mode.cairo index ac54214..5f2c237 100644 --- a/contracts/src/types/mode.cairo +++ b/contracts/src/types/mode.cairo @@ -38,7 +38,7 @@ impl ModeImpl of ModeTrait { fn difficulty(self: Mode) -> Difficulty { match self { Mode::Normal => Difficulty::None, // meaning increasing difficulty - Mode::Daily => Difficulty::VeryHard, + Mode::Daily => Difficulty::Expert, Mode::Free => Difficulty::None, // meaning increasing difficulty _ => Difficulty::None, }