Skip to content

Commit

Permalink
refactor: Use constants instead of magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Apricot-S committed Sep 25, 2024
1 parent f3bc88c commit 0184d53
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This file is part of https://github.com/Apricot-S/xiangting

use crate::bingpai::Bingpai;
use crate::constants::NUM_TILE_INDEX;
use crate::constants::{MAX_NUM_SHOUPAI, NUM_TILE_INDEX};
use crate::shoupai::{FuluMianziList, FuluMianziListExt};
use bitvec::prelude::*;

Expand Down Expand Up @@ -182,9 +182,9 @@ fn calculate_replacement_number_formula(
mut num_gulipai: u8,
has_jiangpai: bool,
) -> u8 {
debug_assert!(num_mianzi <= 4);
debug_assert!(num_mianzi_candidate <= 7);
debug_assert!(num_gulipai <= 14);
debug_assert!(num_mianzi <= (MAX_NUM_SHOUPAI / 3));
debug_assert!(num_mianzi_candidate <= (MAX_NUM_SHOUPAI / 2));
debug_assert!(num_gulipai <= MAX_NUM_SHOUPAI);

// Adjust for excess meld candidates
if (num_mianzi + num_mianzi_candidate) > 4 {
Expand Down

0 comments on commit 0184d53

Please sign in to comment.