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;
                }
            }
        }

    }
}




Our examples were largely sent or created by pupils and students themselves. Therefore, we would be pleased if you could send us any errors you found, spelling mistakes, or rephasing the example. Thank you!





Leave us a comment of this math problem and its solution (i.e. if it is still somewhat unclear...):

Showing 0 comments:
1st comment
Be the first to comment!
avatar




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

Following knowledge from mathematics are needed to solve this word math problem:

Next similar math problems:

  1. Cut trees
    stromy There are 1,200 trees in the grove, of which 55 percent are deciduous, the remaining coniferous. Workers cut down 35 percent a) trees, b) deciduous trees, c) coniferous trees. How many trees now have this grove?
  2. Driving school
    bmw-autoskola Driving final exam involving 10 attendants. The exam consists of three parts. 2 fails at test (quiz) and 6 students fails on car skills test on playground (slalom between the cone). The practical part of the test - driving in town in the real traffic - al
  3. Football league
    football_1 In the 2nd football league plays each of the 16 participants with each opponent twice. For every victory gets 3 points, 1 point for a draw, a defeat none. After the competition was team with 54 points and 12 defeats at 9th place. How many times have won?
  4. Apples 2
    apples_2 How many apples were originally on the tree, if the first day fell one third, the second day quarter of the rest and on tree remained 45 apples?
  5. Pages of book
    books_2 Lenka calculated that if every day to read 16 pages of the book, read a book a day earlier than had read only 14 pages a day. How many pages has this book?
  6. Glass with icecream
    zmrzlina_7 We have 6 kinds of ice cream and 5 kinds of fruit. We put 3 cups of ice cream and 2 fruits into each glass. How many can unique decorated glasses be?
  7. Seven
    post_1 Seven friends agree to send everyone a holiday card. How many postcards were sent?
  8. Mushrooms
    mushrooms-01 For five days, we have collected 410 mushrooms. Interestingly every day we have collected 10 mushrooms more than the preceding day. How many mushrooms we have collected during 4th day?
  9. Buttons
    knofliky Shirt has 6 buttons, blouse has 4 buttons. All buttons are 176. Shirts and blouses are together 36. How many are the shirts and blouses?
  10. 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.
  11. Tram
    tramvaj-skoda In the three-part tram went 206 passengers in front of others, 226 after others and in the middle half of all. How many passengers went in tram total?
  12. Magic number
    prof_einstein_1 The number 135 split to two addends so that one addend was 30 greater than 2/5 the addend.
  13. Farm2
    pecene_kure The farm bred turkeys, geese, hens and chickens. Everything is 400. Turkeys and geese a hen are 150. No hen has more than one chicken, but some hens has no chick. Half of them is also a quarter of the chickens. When the turkey subtracting 15, we get 75. Ho
  14. Donuts
    buchty_1 In the dining room at one table sit Thomas, Filip and Martin. Together they eat 36 donuts. How many donuts eaten everyone, when Filip ate twice as much as Thomas and Martin even half over Filip?
  15. Three-digit
    seven How many three-digit natural numbers do not have the number 7?
  16. Enrollment
    enrollment The enrollment at a local college increased 4% over last year's enrollment of 8548. Find the increase in enrollment (x1) and the current enrollment (x2).
  17. Shots
    lopta_5 Determine the percentage rate of keeper interventions if from 32 shots doesn't caught four shots.