Play the numbers game from the popular British game show Countdown at web.

You start with a collection of random numbers, divided into small numbers from 1 to 10
and large numbers that are 15, 20, 25, and so on until 100.
Pick any combination of six numbers from both large and small numbers.

The course of the game
1) Generate a random numbers.
o Four small numbers
o Two large numbers
2) Next generate a random target number between 200 and 999.

Then use simple arithmetic operations with your six numbers try to calculate the target number
using each small and large number no more than once.
You get the highest number of points if you calculate the target number exactly
and fewer points if you can get within 10 of the target number.

For example, if your random numbers were 75, 100, 2, 3, 4, and 1, and your target number was 505,
you might say 2 + 3 =5,  5 × 100 = 500,  4 + 1 = 5,  and 5 +500 = 505.
Or more directly: (2 + 3) × 100 + 4 + 1 = 505.

Start with the small numbers to be in the range of 1 to 10
=> Generate the random Small numbers:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 )
=> Randomize this Small list:
Array ( [0] => 2 [1] => 10 [2] => 1 [3] => 7 [4] => 6 [5] => 9 [6] => 4 [7] => 3 [8] => 5 [9] => 8 )
=> Select four random Small values:  2, 7, 3, 5

Generate the random list of large numbers. Starting at 15, incrementing by five, until reach 100
=> Generate the random list of Large numbers:
Array ( [0] => 15 [1] => 20 [2] => 25 [3] => 30 [4] => 35 [5] => 40 [6] => 45 [7] => 50 [8] => 55 [9] => 60 [10] => 65 [11] => 70 [12] => 75 [13] => 80 [14] => 85 [15] => 90 [16] => 95 [17] => 100 )
=> Randomize this Large list:
Array ( [0] => 45 [1] => 80 [2] => 30 [3] => 70 [4] => 35 [5] => 75 [6] => 25 [7] => 90 [8] => 50 [9] => 40 [10] => 55 [11] => 95 [12] => 100 [13] => 20 [14] => 60 [15] => 85 [16] => 15 [17] => 65 )
=> Select two random Large values:  55, 55

Let's start playing a number game
=> Small numbers are 2, 7, 3, 5
=> Large numbers are 6, 10

The target number is: 457


Powered By   Kotisivut.com - Luotettava webhotelli    CodeIgniter PHP Framework   BaseURL: https://datatuki.net/web/  Page rendered in 0.2858 seconds