Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

shuffling instead of randomizing

  • Loading branch information...
commit 5a8d2d9c86b195a96810b6cc448e75771a986fd7 1 parent 1e64092
@polettix authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Narsil/Game.pm
View
4 lib/Narsil/Game.pm
@@ -7,6 +7,7 @@ use English qw( -no_match_vars );
use Try::Tiny;
use Moo;
use 5.012;
+use List::Util qw< shuffle >;
extends 'Narsil::Object';
@@ -123,7 +124,8 @@ sub calculate_join_application {
my @participants = $match->participants();
if (scalar(@participants) == $self->allowed_number_of_users()) {
$match->phase('active');
- $match->add_mover($participants[rand @participants]);
+ $match->participants(@participants = shuffle @participants);
+ $match->add_mover($participants[0]);
} ## end if (scalar(@participants...
} ## end if (!$match->is_participant...
Please sign in to comment.
Something went wrong with that request. Please try again.