6 added 73 characters in body
source | link

PHP, 135 134 123 117 122122 121 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

Removing whitespace after echo saves 1 byte

Replacing "\n" with an ctual line break saves 1 byte

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo$s[$i].(++$i%3?"":"\n""
");

Try it online!Try it online!

PHP, 135 134 123 117 122 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

Removing whitespace after echo saves 1 byte

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo$s[$i].(++$i%3?"":"\n");

Try it online!

PHP, 135 134 123 117 122 121 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

Removing whitespace after echo saves 1 byte

Replacing "\n" with an ctual line break saves 1 byte

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo$s[$i].(++$i%3?"":"
");

Try it online!

5 added 54 characters in body
source | link

PHP, 135 134 123 117117 122 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

Removing whitespace after echo saves 1 byte

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo $s[$i]echo$s[$i].(++$i%3?"":"\n");

Try it online!Try it online!

PHP, 135 134 123 117 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo $s[$i].(++$i%3?"":"\n");

Try it online!

PHP, 135 134 123 117 122 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

Removing whitespace after echo saves 1 byte

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo$s[$i].(++$i%3?"":"\n");

Try it online!

4 removed method 1, improved method 2
source | link

PHP, 135 134 123123 117 bytes

A lot of potentialLooping over str to reduce this I think. All the "substr"'s are a mess.print instead saves 1 byte

$s=str_shuffle(str_pad(str_repeat(m,$argv[1]),8,n));echo(substr($s,0,3)."\n".substr($s,3,1).$argv[1].substr($s,4,1)."\n".substr($s,5));

Try it online! str_split and implode to insert the centre number saves 11 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

$s=implode$n=$argv[1];$s=implode($argv[1]$n,str_split(str_shuffle(str_pad(str_repeat(m,$argv[1]$n),8,n)),4));for(;$i<9;)echo $s[$i].(++$i%3?"":"\n");

Try it online!Try it online!

PHP, 135 134 123 bytes

A lot of potential to reduce this I think. All the "substr"'s are a mess.

$s=str_shuffle(str_pad(str_repeat(m,$argv[1]),8,n));echo(substr($s,0,3)."\n".substr($s,3,1).$argv[1].substr($s,4,1)."\n".substr($s,5));

Try it online!

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

$s=implode($argv[1],str_split(str_shuffle(str_pad(str_repeat(m,$argv[1]),8,n)),4));for(;$i<9;)echo $s[$i].(++$i%3?"":"\n");

Try it online!

PHP, 135 134 123 117 bytes

Looping over str to print instead saves 1 byte

str_split and implode to insert the centre number saves 11 bytes

Don't need to assign the string to $s anymore saving 6 bytes
Yes you do. Otherwise the string is shuffled after every echo...

$n=$argv[1];$s=implode($n,str_split(str_shuffle(str_pad(str_repeat(m,$n),8,n)),4));for(;$i<9;)echo $s[$i].(++$i%3?"":"\n");

Try it online!

3 new method, improved 2nd method
source | link
2 new method
source | link
1
source | link