Logik game

Letter game Logik is a two player game, which has the following rules:
1. The first player thinks five-letter word in which no letter is not
repeated.
2. The second player writes a five-letter word.
3. The first player answers two numbers - the first number indicates how many letters written word coincides with the imaginary word, and is also on the correct position; the second number indicates how many letters written word is contained in the imaginary word, but is not the right place.
4. Steps 2 and 3 are repeated until the second player imaginary word guess.
Recording one game of two friends looked like this:
SONET 1 2
MUDRC 0 2
PLAST 0 2
KMOTR 0 4
ATOLY 1 1
DOGMA 0 2

The next move was meant by the word guessed. Determine which word
it was.

Note:
Our presented solution contains a program in PHP language, which will solve the given combination of letters - by brute force, quickly and painlessly.

Result

x = (Correct answer is: STROM) Wrong answer

Solution:

x = STROM
function match($s1, $s2, $q, $w)
{
    $a = $b = 0;
    for($i=0;$i<5;$i++)
    {
        if($s1{$i} == $s2{$i})
        {
            $a++;
        }
        else
        {
            $b += strpos($s2, $s1{$i})!==false;
        }
    }

    return $a == $q && $b == $w;
}

for($a=65; $a<91; $a++)
{
    for($b=65; $b<91; $b++)
    {
        for($c=65; $c<91; $c++)
        {
            for($d=65; $d<91; $d++)
            {
                for($e=65; $e<91; $e++)
                {
                    $s=chr($a).chr($b).chr($c).chr($d).chr($e);
                    if(!match($s,"SONET", 1, 2)) continue;
                    if(!match($s,"MUDRC", 0, 2)) continue;
                    if(!match($s,"PLAST", 0, 2)) continue;
                    if(!match($s,"KMOTR", 0, 4)) continue;
                    if(!match($s,"ATOLY", 1, 1)) continue;
                    if(!match($s,"DOGMA", 0, 2)) continue;

                    echo $s;
                    exit;
                }
            }
        }

    }
}




We would be pleased if you find an error in the word problem, spelling mistakes, or inaccuracies and send it to us. Thank you!






Showing 0 comments:
avatar




Tips to related online calculators
See also our permutations calculator.
Would you like to compute count of combinations?

Next similar math problems:

  • Phone numbers
    old_phone How many 7-digit telephone numbers can be compiled from the digits 0,1,2,..,8,9 that no digit is repeated?
  • Five letters
    charH How many ways can five letters be arranged?
  • Digits
    numbers2_18 How many natural numbers greater than 4000 which are formed from the numbers 0,1,3,7,9 with the figures not repeated, B) How many will the number of natural numbers less than 4000 and the numbers can be repeated?
  • How many
    numbers2_41 How many double-digit numbers greater than 30 we can create from digits 0, 1, 2, 3, 4, 5? Numbers cannot be repeated in a two-digit number.
  • Three digits number 2
    numbers_7 Find the number of all three-digit positive integers that can be put together from digits 1,2,3,4 and which are subject to the same time has the following conditions: on one positions is one of the numbers 1,3,4, on the place of hundreds 4 or 2.
  • Numbers
    numbers_3 How many different 3 digit natural numbers in which no digit is repeated, can be composed from digits 0,1,2?
  • Three-digit numbers
    poker_hand_ranking How many three-digit numbers are from the numbers 0 2 4 6 8 (with/without repetition)?
  • How many 4
    numbers2_1 How many 4 digit numbers that are divisible by 10 can be formed from the numbers 3, 5, 7, 8, 9, 0 such that no number repeats?
  • A license
    License_Plate A license plate has
3 letters followed by 4 numbers. Repeats are not allowed for the letters, but they are for the numbers. If they are issued at random, what is the probability that the 3 letters are in alphabetical order and the 3 numbers are consecutiv
  • Digits
    numbers_48 How many five-digit numbers can be written from numbers 0.3,4, 5, 7 that is divided by 10 and if digits can be repeated.
  • Solve 2
    numbers2_47 Solve integer equation: a +b+c =30 a, b, c = can be odd natural number from this set (1,3,5,7,9,11,13,15)
  • Three-digit numbers
    numbers_2 We have digits 0,1,4,7 that cannot be repeated. How many three-digit numbers can we write from them? You can help by listing all the numbers.
  • Three digits number
    3digit From the numbers 1, 2, 3, 4, 5 create three-digit numbers that digits not repeat and number is divisible by 2. How many numbers are there?
  • Password
    codes The voltage station is every day changing the master password, which consists of three letters. Code generation process does not change and is based on the following procedure: The following letters (A) to (I) correspond to different numbers from 1 to 9.
  • STRESSED word
    DESSERTS Each letter in STRESSED is printed on identical cards, one letter per card, and assembled in random order. Calculate the probability that the cards spell DESSERTS when assembled.
  • VCP equation
    combinatorics3 Solve the following equation with variations, combinations and permutations: 4 V(2,x)-3 C(2,x+ 1) - x P(2) = 0
  • Three workplaces
    workers_49 How many ways can we divide nine workers into three workplaces if they need four workers in the first workplace, 3 in the second workplace and 2 in the third?