Sign in to follow this  
Followers 0
Dtvscrotes

Math Trick Program Error Plz Help

11 posts in this topic

#1 ·  Posted (edited)

I tried to make a basic math trick to work on my computer. The trick works like this.

You tell someone to think of a four digit #. Tell them they cant show u and say write it on a piece of paper.

You tell them to jumble those digits to make a new #. write this on the paper as well.

Subtract the smaller # from the larger # to make a new number. write the new number down.

Now circle one of the digits in the new number but u cant circle 0 because they r already circles.

Remove the circled digit. Then show those left over numbers to me.

Now you say i know wat number u circled.

Now u add the leftover digits together lets say this is A. -If the sum(A) is below 9 then subtract A from 9. (this answer is the number they circled.)

- If the sum(A) is below 18(above 9) then subtract A from 18.(this answer is the number they circled)

- If the sum(A) is below 27 (above 18) then subtract A from 27.(this answer is the number they circled)

- if the sum(A) is equal 9, 18 or 27 then the number they circled is 9 (or 0 if they cheated.)

Im not sure how it works but it does.

ex.A) 5476-4567=0909

0(9)09

left over = 009

0 + 0 + 9 = 9 they removed a 9.

ex.:) 7429-4972=2457

24(5)7

leftover = 247

2+4+7 = 13

18-13 = 5

they removed a 5.

Now i made a basic script so i dont have to go through the process of doing tricks to friends. My PC can do it for me but it's not working.

Ex. A) will end up as 918

Ex.;)= equals 514

notice the two added digits equal the first digit?

9 1+8

5 1+4

I dont understand PLZ HELP?

If you figure it out plz email x_shadow_x21@hotmail.com with the correct script plz. I will be very thankful and if u can explain what i did wrong so i will learn from my mistakes. TY

I'll copy paste my script.

MsgBox(0,"title", "Think of a four digit number.")

MsgBox(0,"title", "Now Rearrange that number to make a different number.")

MsgBox(0,"title", "Now subtract the smaller of the two numbers from the larger number.")

MsgBox(0,"title", "Now circle one of the numbers in your answer. Do not circle a zero because it is already a circle.")

$number1=Inputbox("question", "Please type in your first leftover digit.")

$number2=Inputbox("question", "Please type in your second leftover digit.")

$number3=Inputbox("question", "Please type in your third leftover digit.(leave blank if there was no third digit)")

Sleep(1000)

Run("notepad.exe")

Sleep(2000)

Send("The number you circled was:")

$var=$number1+ $number2+ $number3

IF $var<9 Then Send(9-$var)

IF $var<18 Then Send(18-$var)

IF $var<27 Then Send(27-$var)

IF $var=9 or $var = 18 or $var = 27 Then Send(9)

Edited by Dtvscrotes

Share this post


Link to post
Share on other sites



MsgBox(0,"title", "Think of a four digit number.")
MsgBox(0,"title", "Now Rearrange that number to make a different number.")
MsgBox(0,"title", "Now subtract the smaller of the two numbers from the larger number.")
MsgBox(0,"title", "Now circle one of the numbers in your answer. Do not circle a zero because it is already a circle.")
$number1=Inputbox("question", "Please type in your first leftover digit.")
$number2=Inputbox("question", "Please type in your second leftover digit.")
$number3=Inputbox("question", "Please type in your third leftover digit.(leave blank if there was no third digit)")
Sleep(1000)
Run("notepad.exe")
Sleep(2000)
Send("The number you circled was:")
$var=$number1+ $number2+ $number3
IF $var<9 Then Send(9-$var)
IF $var<18 Then Send(18-$var)
IF $var<27 Then Send(27-$var)
IF $var=9 or $var = 18 or $var = 27 Then Send(9)

Notice this line:

IF $var=9 or $var = 18 or $var = 27 Then Send(9)

It doesn't work the way you had it... I haven't tested your actual program yet, I just saw this error... I'll test it in a second


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

TY very fast reply TYVM

Share this post


Link to post
Share on other sites

it still adds extra digit but there is no ERROR. TY

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i changed original post to IF $var=9 or $var = 18 or $var = 27 Then Send(9) so now the only problem is the added digits

Edited by Dtvscrotes

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

I'm working a solution out now. Will post when complete. :)

This has already been answered (I think) but the thread was started 3 times! so it's all a bit of a mess now. Hav a look at the other threads with the same qusetion.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

This has already been answered (I think) but the thread was started 3 times! so it's all a bit of a mess now. Hav a look at the other threads with the same qusetion.

Woah... Thats alot. Anyhoo, this is my response. Whether it is needed or not. I enjoyed making it. I haven't enjoyed to script something for a little while.

Here it is:

$input1 = InputBox ("Think of a Number", "Think of a 4 Digit number", "", " M4")
$input2 = InputBox ("Think of a 4 Digit number", "Now rearange the numbers "&$input1&" to make a new number", "", " M4")
If $input1 < $input2 Then
    $number1 = $input2 - $input1
ElseIf $input1 > $input2 Then
    $number1 = $input1 - $input2
EndIf
$input3 = InputBox ("Think of a 4 Digit number", "Now pick one digit from "&$number1&" and enter the leftover digits.  Do not pick a 0 (Zero) as the number", "", " M4")
$number2 = StringSplit ($input3, "")
$a = 0
For $i = 1 to Ubound ($number2) -1
    $a += $number2[$i]
Next
If $a < 9 and $a > 0 Then
    If $a = 9 Then
        $answer = 9
    Else
        $answer = 9 - $a
    EndIf
ElseIf $a < 18 and $a > 9  Then
    If $a = 18 Then
        $answer = 18
    Else
        $answer = 18 - $a
    EndIf
ElseIf $a < 27 and $a > 27  Then
    If $a = 27 Then
        $answer = 27
    Else
        $answer = 27 - $a
    EndIf
EndIf

MsgBox (0, "Answer", "The number you ommited was: "&$answer)

Share this post


Link to post
Share on other sites

your script doesnt seem to work. it said i picked 6 when i picked 3 and your not supposed to type your original #'s in. Look at this one. imtrying to make this through autoit. http://www.digicc.com/fido/

Share this post


Link to post
Share on other sites

Martin figured it out it works with this script no extra digits.

MsgBox(0,"title", "Think of a four digit number.")

MsgBox(0,"title", "Now Rearrange that number to make a different number.")

MsgBox(0,"title", "Now subtract the smaller of the two numbers from the larger number.")

MsgBox(0,"title", "Now circle one of the numbers in your answer. Do not circle a zero because it is already a circle.")

$number1=Inputbox("question", "Please type in your first leftover digit.")

$number2=Inputbox("question", "Please type in your second leftover digit.")

$number3=Inputbox("question", "Please type in your third leftover digit.(leave blank if there was no third digit)")

Sleep(1000)

Run("notepad.exe")

Sleep(2000)

Send("The number you circled was:")

$var=$number1+ $number2+ $number3

#cs

;This section is from you original post

IF $var<9 Then Send(9-$var)

IF $var<18 Then Send(18-$var)

IF $var<27 Then Send(27-$var)

IF $var=9 or $var = 18 or $var = 27 Then Send(9)

#ce

;Replaced with this bit below

IF $var=9 or $var = 18 or $var = 27 Then

Send(9)

ElseIf $var<9 Then

Send(9-$var)

ElseIF $var<18 Then

Send(18-$var)

ElseIF $var<27 Then

Send(27-$var)

EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0