
This program uses several advanced data structures taught in our second-year courses These expressions in order to find the closest one. We might be lucky and find an expression that gives the target value,īut in problems that cannot be solved exactly, we need in principle to evaluate all Of arithmetic expressions that can be formed from the six given numbers - aboutģ0,000,000. The Countdown problem is difficult to solve quickly because of the huge number Stephen wrote his program in C, and I have re-implemented it in Java for this This program was designed by Stephen Williams, and won a recent competition. The answer appears almost instantly.Įvery year we run a programming competition for Computer Science students, When both the given numbers and the target have been chosen, the Solve button is enabled click on it to see the closest solution to the target.You can type a target number into the box on the right (click in the box first), or use the right-hand Random button to choose it randomly.You can use the panel at the left to choose the six given numbers, or click on Random to have the computer make a random choice.

Launch the program by clicking on the button shown above. The operations of arithmetic to make the target number. Contestants are given a random selection of six numbersĪnd a three-digit target number they must combine the given numbers using
COMPUTER COUNTDOWNS TV
Thanks again - I finally understand the looping system.This program solves the 'numbers game' from the TV game showĬountdown. setCursorPos but the program now works fine so this is great.
COMPUTER COUNTDOWNS CODE
This worked great and was pretty much exactly what I was looking for, there were minimal errors in your code but easy to fix so it didn't cause major hassle Just fyi, you needed to make mon a local variable and mon.cursorPos should be. Sec = tonumber(read()) -# how many seconds do you want to runįor i = sec, 0, -1 do -# Start at "sec", stop at 0, and count by -1Įdited by Unknowntissue, 01 April 2016 - 08:32 PM. If input = "Y" or input = "y" then -# works for both upper and lower y RunProgram = true -# while this is true the program will keep looping Mon.setTextScale(4) -# toy with this number until you are happyĮngine = "back" -# Just in case you ever need to change the side the engines are on you only need to change this Mon = peripheral.find("monitor") -# Will find Monitor no matter what side it is on If you want me to explain more I would be happy to just let me know. I don't know how much you know but I don't want to post a wall of text if I don't have to so I'll just post how I think the code should look. The reason for this is if you wanted to move the monitor to the top for some reason you don't have to go fishing for it deep in the code.( It also makes your code run smoother when you get into more intense stuff) Technically this does work but it is good practice to keep variables that will never change out of the repeating loop. Personally I like it when people tell me what I did wrong in my code so I can correct my way of looking at it.įirst thing I would change is move the following to the start of the program and out of the loop: I'm still a beginner at code just like you so i can explain how its done in the point of view of a newbie.
COMPUTER COUNTDOWNS PRO
I'm no pro but I think I can help you too. The two monitor things I have written in there are prep to display the number.Įdited by Bomb Bloke, 01 April 2016 - 04:31 AM. Here's my code so far (don't judge exactly how sloppy it is): I'm not bothered about second/minute format (unless it won't be too much bother to add that in). But, I want said numeric value to be displayed on a 2 x 2 monitor (left of the computer) ticking down, second after second. I have set up a redstone system that will power on some engines for a length of time dictated by the numeric value I've input.

First off I'll start by saying it's beyond funny how bad I am at coding, secondly, I've searched for a solution for an hour or so and can't find one that quite fits what I need so here's my question.
