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
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:

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

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


x = (Correct answer is: STROM) Wrong answer


function match($s1, $s2, $q, $w)
    $a = $b = 0;
        if($s1{$i} == $s2{$i})
            $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++)
                    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;


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

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

To solve this verbal math problem are needed these knowledge from mathematics:

Would you like to compute count of combinations? See also our permutations calculator.

Next similar examples:

  1. Troops
    regiment Route is long 147 km and the first day first regiment went at an average speed 12 km/h and journey back 21 km/h. The second day went second regiment same route at an average speed 22 km/h there and back. Which regiment will take route longer?
  2. Soaps
    mydlo_1 Each box has the same number of soaps. A quarter of all boxes contain only white soaps, and in each of the remaining 120 boxes there are always half the white soaps and half the green. White soaps total 1200. (a) the number of all soap boxes; (b) the sma
  3. Garden
    garden_1 Area of square garden is 4/5 of triangle garden with sides 24 m, 15 m and 15 m. How many meters of fencing need to fence a square garden?
  4. Equilateral triangle
    vpisany_stvorec A square is inscribed into an equilateral triangle with a side of 10 cm. Calculate the length of the square side.
  5. Trapezoid MO
    right_trapezium The rectangular trapezoid ABCD with right angle at point B, |AC| = 12, |CD| = 8, diagonals are perpendicular to each other. Calculate the perimeter and area of ​​the trapezoid.
  6. A cylinder
    string A cylinder 108 cm high has a circumference of 24 cm. A string makes exactly 6 complete turns around the cylinder while its two ends touch the cylinder's top and bottom. (forming a spiral around the cylinder). How long is the string in cm?
  7. River
    river From the observatory 14 m high and 32 m from the river bank, river width appears in the visual angle φ = 20°. Calculate width of the river.
  8. Z9-I-4
    numbers_30 Kate thought a five-digit integer. She wrote the sum of this number and its half at the first line to the workbook. On the second line wrote a total of this number and its one fifth. On the third row she wrote a sum of this number and its one nines. Fi
  9. Average age
    candles_1 The company of five people has an average age of 46 years. The average age of the first four is 43 years. How many years has the fifth member of this company?
  10. Pool
    pool If water flows into the pool by two inlets, fill the whole for 18 hours. First inlet filled pool 10 hour longer than second. How long pool is filled with two inlets separately?
  11. Bonus
    moeny Gross wage was 1430 USD including 23% bonus. How many USD were bonuses?
  12. Logic
    blue-barrel A man drinks a barrel of water for 39 days, woman for 64 days, for how many days they drink barrel together?
  13. Together
    work_1 If 8 men, 10 women, 16 children collects ₹1024 in 4 days, how many days will be required for 6 men, 5 women and 4 boys to collect ₹768? (₹ is Indian Rupee)
  14. Store
    pave One meter of the textile were discounted by 2 USD. Now 9 m of textile cost as before 8 m. Calculate the old and new price of 1 m of the textile.
  15. Find two
    eq222_7 Find two consecutive natural numbers whose product is 1 larger than their sum. Searched numbers expressed by a fraction whose numerator is the difference between these numbers and the denominator is their sum.
  16. Monkey
    monkey Monkey fell in 33 m deep well. Every day her scramble 3 meters, at night dropped back by 2 m. On that day it gets hangover from the well?
  17. Test points
    test_2 If you earned 80% of the possible 40 points, how many points did you miss to get 100%?