Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:25 21 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Cats do Countdown etc game

Author Message
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 589
Posted: 05:13am 05 Aug 2025
Copy link to clipboard 
Print this post

There is a game show "... Cats do Countdown" from the UK on local tele here, a send-up of "Letters and Numbers" and so on. It has a segment where you try to calculate a target number from six numbers, which I enjoy as it helps keep the noggin ticking  over, I chicken out of the letter games though   . In fact if you mix up "Letters and Numbers" you get something like "Lemurs and Nutters"   .

I have added substrings and a random number function and so on in my interpreter and so needed a reasonable test. So for a bit of fun I have written a "Numbers" game, which presents two large numbers eg 25,50,75,100 and four small (0 - 9) and a "target" number,  the aim being to calculate it using  the six numbers before the time runs out. The answer is then presented before you have had any luck   .

To be devious here the target number is a sum randomly generated using the six numbers, so it is testing the formula translation as well, I hope it works !!  

It should translate to MM Basic easily enough, which I will leave to others
more versed in that.

It works OK so far but concatenated divisions look iffy, eg x = 40 / 10 / 2 but they are uncommon,  best not to use them. Note that in this example formal integer arithmetic is used, eg 1/7 = 0, 5/3 = 1, and negatives are OK.


*** ! Lemurs and Nutters ! ***

How will the numbers stack up ?

Hit enter twice  ..

Thinking..

Your numbers are

25  25 2 1 7 4
Your target is ...  307

Ten seconds left !!

The formula is .. 1 * 7 + 2 *  25 / 4 *  25


OK




     PROGRAM lemursandnutters

     INTEGER*4 a, d, e, f, i, j, k
     INTEGER*4 m
     DOUBLE b, c

     CHARACTER*9 small
     CHARACTER*15 large

     CHARACTER*2 smlout
     CHARACTER*4 lgout
     CHARACTER*30 tank
     INTEGER*4 posn(6)
     INTEGER*4 proc(6)
     INTEGER*4 length(6)
     CHARACTER*8 symb  
     CHARACTER*50 eqn
     CHARACTER*1 run

     INTEGER*4 go, milsec, span  

     small = '123456789'
     large = ' 25 50 75100'

     symb = '+-*/    '

     go = MILLI (1)

     PRINT "*** ! Lemurs and Nutters ! ***"
     PRINT
     PRINT "How will the numbers stack up ?"
     PRINT
     PRINT "Hit enter twice  .."


     a = 2147483647
     j = 1


     READ run

     milsec =  MILLI (1)
     span = milsec - go

     PRINT "Thinking.."

     DO j = 1, span
       a = RAND 4
     END DO

     span = 0
     j = 1

     PRINT
     PRINT "Your numbers are "
     PRINT

C  Two large numbers

     FORMAT (2A4)
     DO i = 1, 2  
      lgout(1:4) = symb(5:8)
      d = 1 + 3 * ( RAND 4 )
      e = d + 2
      k = j + 3
      tank(j:k) = large(d:e)
      lgout(1:3) = large(d:e)
      posn(i) = j
      length(i) = 3
      j = j + 3
      WRITE (6,0) lgout
     END DO

C Four small

     FORMAT (4A2,/)
     DO i = 3, 6
      smlout(1:2) = symb(5:6)
      d =  1 + RAND 9  
      tank(j:j) = small(d:d)
      smlout(1:1) = small(d:d)  
      posn(i) = j
      length(i) = 1
      j = j + 1
      WRITE (6,0) smlout
     END DO

C cache in random order

     j = 1

     DO i = 1, 6
      d = 1 + RAND 6
      m = proc(d)
      WHILE ( m = 1 ) THEN
       d = 1 + RAND 6  
       m = proc(d)
      END WHILE

      proc(d) = 1

      IF ( i > 1 ) THEN    
       eqn(j:j) = symb(5:5)
       j = j + 1
      END IF

      k = j + length(d) - 1
      e = posn(d)
      f = e + length(d) - 1
      eqn(j:k) = tank(e:f)
      j = j + length(d)  

      eqn(j:j) = symb(5:5)
      j = j + 1

C add random operator symbol

      IF ( i < 6 ) THEN
       d =  1 + RAND 4
       eqn(j:j) = symb(d:d)
       j = j + 1
      END IF

     END DO

C Evaluate and print  

     EVAL eqn                                              
     PASTE k

     PRINT "Your target is ...  ", k

     go = MILLI (1)
     PRINT
     PRINT "Ten seconds left !!"

C Wait ( not long enough !! )

     WHILE (span < 10000) THEN
       milsec =  MILLI (1)
       span = milsec - go
     END WHILE

     PRINT
     PRINT "The formula is .. ", eqn
     PRINT


     END
\



Edited 2025-08-05 15:19 by zeitfest
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4062
Posted: 06:54am 05 Aug 2025
Copy link to clipboard 
Print this post

In "Cats" you're not allowed to do a division that results in a fraction (even if the fraction would multiply out later).

So, for example, 1 * 7 + 2 *  25 / 4 *  25 is not valid (because the result of the division by 4 is not a whole number).

Also, there would be no answers with 1*7 as the multiplication is pointless.

John
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6289
Posted: 07:09am 05 Aug 2025
Copy link to clipboard 
Print this post

The answer is 25*4*(1+2) + 7
'Normal' countdown rules don't allow high numbers that are the same. Two 25s are a no-no.
VK7JH
MMedit
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 589
Posted: 11:47pm 17 Aug 2025
Copy link to clipboard 
Print this post

Sadly it looks like the episodes shown in Aus are years behind .

Sadly because one of the team captains Sean passed away two years ago.
All that humor and brilliance lost.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025