Johannes91
Veteran
- Joined
- Mar 28, 2006
- Messages
- 1,341
This is actually a really trivial case, because permutation doesn't change. Something like this would do (in Perl):
Or functionally:
In general, just loop or use recursion to visit all positions. If you're not ignoring any pieces, then you have to deal with parities, but it's not a big deal.
Code:
@foo = qw(? +? -?);
for $a (@foo) { for $b (@foo) { for $c (@foo) {
print "~U ? ? FR ? ! ! ! ! ? !! RFD $a $b $c @? !!\n" } } }
Code:
@foo = qw(? +? -?); sub _;
sub _ { if (@_ - 3) { _ @_, $_ for @foo }
else { print "~U ? ? FR ? ! ! ! ! ? !! RFD @_ @? !!\n" } }
_ $_ for @foo
Last edited: