Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Round robin processing -- boustrophedon

by Discipulus (Canon)
on Sep 09, 2019 at 17:06 UTC ( [id://11105894]=note: print w/replies, xml ) Need Help??


in reply to Round robin processing

Hello llarochelle

you can also use a boustrophedon distribution:

use Data::Dump my @A = (1..12); my $data; my $i = 0; while (@A){ push @{$data->[$i]},shift @A; $i == 3 ? $i = -1 : $i == -4 ? $i = 0 : $i < 0 ? $i-- : $i +++; } dd $data; __DATA__ [ [1, 8, 9], [2, 7, 10], [3, 6, 11], [4, 5, 12] ]

See also How to get this not the usual round robin looping for more examples about such distribution

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-24 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found