Skip to content

Commit

Permalink
refine one condition
Browse files Browse the repository at this point in the history
  • Loading branch information
glennj committed Nov 16, 2024
1 parent f08d871 commit 0dca08c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ sub measure ( $bucketOne, $bucketTwo, $goal, $startBucket ) {
( $first, $second ) = ( $second, $first ) if $startBucket eq 'two';

my $moves = 0;

fill $first;
$moves++;

if ( $second->{size} == $goal ) {
if ( $second->{size} == $goal && $first->{size} != $goal ) {
fill $second;
$moves++;
}
Expand Down
3 changes: 1 addition & 2 deletions exercises/practice/two-bucket/.meta/template-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ example: |-
($first, $second) = ($second, $first) if $startBucket eq 'two';
my $moves = 0;
fill $first;
$moves++;
if ($second->{size} == $goal) {
if ($second->{size} == $goal && $first->{size} != $goal) {
fill $second;
$moves++;
}
Expand Down

0 comments on commit 0dca08c

Please sign in to comment.