jeudi 28 janvier 2021

In Perl , How to generate All Possible Patterns ,

may i know how to ( in Perl ) , generate below All Possible Patterns in a file and on screen output , and each slot in the pattern can be accessed , ?!

many thanks for all ,

input value ,

1 , no. of slots ,

2 , no. of objects ,

for example ,

no. of object = 2 , { a , b } ,

no. of slots = 4 ,

then , output ,

no. of all possible patterns = 2^4 = 16 ,

then ,

row is 16 ,

column is 8 ,

eachSlot[i][j] = allow assign or change its value ,

then , output format look like ,

a a a a

a a a b

a a b a

a a b b

a b a a

a b a b

a b b a

a b b b

b a a a

b a a b

b a b a

b a b b

b b a a

b b a b

b b b a

b b b b

and ,

if see 'a' , then do sth actionX ,

if see 'b' , then do sth actionY ,

many thanks for all the advices and helps ,

Aucun commentaire:

Enregistrer un commentaire