view release on metacpan or search on metacpan
lib/Algorithm/MasterMind.pm view on Meta::CPAN
410411412413414415416417418419420421422423424425426427428429430431432mastermind. Proposed by Knuth in one of his original papers.
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
lib/Algorithm/MasterMind.pm view on Meta::CPAN
445446447448449450451452453454455456457458459460461462463464Turns a string into a hash, to help
with
comparisons. Used internally,
mainly.
=head2 not_in_combination( $string)
Returns the letters from the alphabet that are _not_ in this
combination. Might be useful for certain strategies.
=head2 random_combination
Combines randomly the alphabet, issuing, you guessed it, a random
combination.
=head2 partitions
From a set of combinations, returns the "partitions", that is, the
number of combinations that would return every set of black and white
response. Inputs an array, returns a hash keyed to the combination,
each key containing a value corresponding to the number of elements in
each partition.
lib/Algorithm/MasterMind/CGA_Partitions.pm view on Meta::CPAN
140141142143144145146147148149150151152153154155156157158159160161162This function, and all the rest, are directly inherited from base
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
lib/Algorithm/MasterMind/EDA.pm view on Meta::CPAN
168169170171172173174175176177178179180181182183184185186187188189190Yields the first combination
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
lib/Algorithm/MasterMind/EDA_Partitions.pm view on Meta::CPAN
143144145146147148149150151152153154155156157158159160161162163164165This function, and all the rest, are directly inherited from base
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
lib/Algorithm/MasterMind/Evo.pm view on Meta::CPAN
114115116117118119120121122123124125126127128129130131132133134my
$rules
=
$self
->number_of_rules();
my
$ga
=
$self
->{
'_ga'
};
my
$max_number_of_consistent
=
$self
->{
'_max_consistent'
};
my
$last_rule
=
$rules
[
$#rules
];
my
$alphabet_size
= @{
$self
->{
'_alphabet'
}};
if
(
$self
->{
'_played_out'
} ) {
$self
->eliminate_last_played;
}
#Check for combination guessed right except for permutation
if
(
$last_rule
->{
'blacks'
}+
$last_rule
->{
'whites'
} ==
$length
) {
if
( !
$self
->{
'_consistent_endgame'
} ) {
my
%permutations
;
map
(
$permutations
{
$_
} = 1,
map
(
join
(
""
,
@$_
),
permutations([
split
( //,
$last_rule
->{
'combination'
} ) ] ) ) );
my
@permutations
=
keys
%permutations
;
$self
->{
'_endgame'
} =
Algorithm::MasterMind::Partition::Most->start_from( {
evaluated
=>
$self
->{
'_evaluated'
},
alphabet
=> \
@alphabet
,
lib/Algorithm/MasterMind/MOGA.pm view on Meta::CPAN
211212213214215216217218219220221222223224225226227228229230231232233way
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
lib/Algorithm/MasterMind/Random.pm view on Meta::CPAN
7475767778798081828384858687888990919293949596way
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
lib/Algorithm/MasterMind/Sequential.pm view on Meta::CPAN
798081828384858687888990919293949596979899100way
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
Returns the rules (combinations, blacks, whites played so far) y a
reference to array
lib/Algorithm/MasterMind/Sequential_Alt.pm view on Meta::CPAN
87888990919293949596979899100101102103104105106107108way
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()
Returns the rules (combinations, blacks, whites played so far) y a
reference to array
lib/Algorithm/MasterMind/Test.pm view on Meta::CPAN
5758596061626364656667686970717273747576777879way
=head2 issue_next()
Issues the next combination
=head2 feedback()
Obtain the result to the last combination played
=head2 guesses()
Total number of guesses
=head2 evaluated()
Total number of combinations checked to issue result
=head2 number_of_rules ()
Returns the number of rules in the algorithm
=head2 rules()