mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:17:34 +00:00
ColorLines: Use AK::shuffle() for shuffling
This commit is contained in:
parent
5b273f3823
commit
4b525fc98e
1 changed files with 1 additions and 9 deletions
|
@ -62,7 +62,7 @@ public:
|
||||||
result.append(point);
|
result.append(point);
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
random_shuffle(result);
|
shuffle(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,14 +336,6 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void random_shuffle(PointArray& points)
|
|
||||||
{
|
|
||||||
// Using Fisher–Yates in-place shuffle
|
|
||||||
if (points.size() > 1)
|
|
||||||
for (size_t i = points.size() - 1; i > 1; --i)
|
|
||||||
swap(points[i], points[get_random_uniform(i + 1)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr int number_of_marbles_to_remove { 5 };
|
static constexpr int number_of_marbles_to_remove { 5 };
|
||||||
|
|
||||||
using Row = Array<Color, board_size.width()>;
|
using Row = Array<Color, board_size.width()>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue