Author Topic: Strange/Rnd domain err.  (Read 5112 times)

0 Members and 1 Guest are viewing this topic.

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Strange/Rnd domain err.
« on: April 07, 2012, 01:47:43 pm »
So my friend wanted a game on his calc for Russian roulette so I made it easy. It asks for how many people, chambers, and names, then you can play.
But sometimes when I run it I get err: domain. When I goto, it takes me to an output which makes no sense.
I basically have

Lbl A
Input "",X
If x<1 or x>8: goto A

For Q,1,X
Output(Q,1,"*
End


What is more weird is that it works for 2-4 rounds but then suddenly comes up with domain err.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Strange/Rnd domain err.
« Reply #1 on: April 07, 2012, 01:56:33 pm »
yeah happens for me sometimes too in basic. Seems to have to do with input ""
Also you can use [code][/code] tags to put yuor code into code blocks.
like this:
Code: [Select]
code here
look it's monospaced!!
so you can create ascii art here!
:)
welcome here btw.
« Last Edit: April 07, 2012, 01:57:59 pm by aeTIos »
I'm not a nerd but I pretend:

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Strange/Rnd domain err.
« Reply #2 on: April 07, 2012, 02:06:55 pm »
hmm from the look of the code, the only way to get domain error is to type non-integer number.
Sig wipe!

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Re: Strange/Rnd domain err.
« Reply #3 on: April 07, 2012, 02:45:42 pm »
Well, I changed it to
Code: [Select]
Input "people",XBut it still dosen't work :(

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Strange/Rnd domain err.
« Reply #4 on: April 07, 2012, 02:46:30 pm »
can you post the whole code?
Sig wipe!

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Re: Strange/Rnd domain err.
« Reply #5 on: April 07, 2012, 03:40:01 pm »
Code: [Select]
:" "→Str1
:Str1→Str2
:Str1→Str3
:Str1→Str4
:Str1→Str5
:Str1→Str6
:Str1→Str7
:Str1→Str8
:
:
:
:ClrHome
:Output(1,1,"RUSSIAN ROULETTE                PRESS ENTER TO        FIRE
:For(A,0,1750
:End
:Lbl AA
:ClrHome
:Output(2,1,"HOW MANY PEOPLE?(1≤X≤8)
:Input "=",X
:If X<1:Goto AA
:If X>8:Goto AA
:Lbl AB
:ClrHome
:Output(2,1,"HOW MANY        CHAMBERS?       (>0)
:Input "=",Y
:If Y<1:Goto AB
:
:ClrHome
:Output(1,1,"PLAYER NAMES
:For(θ,0,750
:End
:ClrHome
:Input "1=",Str1
:If X>1:Input "2=",Str2
:If X>2:Input "3=",Str3
:If X>3:Input "4=",Str4
:If X>4:Input "5=",Str5
:If X>5:Input "6=",Str6
:If X>6:Input "7=",Str7
:If X>7:Input "8=",Str8
:
:ClrHome
:Output(1,3,Str1
:Output(2,3,Str2
:Output(3,3,Str3
:Output(4,3,Str4
:Output(5,3,Str5
:Output(6,3,Str6
:Output(7,3,Str7
:Output(8,3,Str8
:DelVar ∟ALIVE
:8→dim(∟ALIVE
:For(θ,1,X
:¦ 1→∟ALIVE(θ)
:End
:
:
:While 1
:¦ For(θ,1,X
:¦ ¦ If ∟ALIVE(θ)=0:End
:¦ Output(θ,1,"*
:¦ Pause
:¦ randInt(1,Y)→Q

:¦ :If Q=1:Then
:¦ ¦ ClrDraw:RecallPic 2:For(W,0,1750):End:Output(θ,1," ":Output(θ,11,"(DEAD)":0→∟ALIVE(θ):
:¦ ¦
:¦ ¦ :If ∟ALIVE(1)+∟ALIVE(2)+∟ALIVE(3)+∟ALIVE(4)+∟ALIVE(5)+∟ALIVE(6)+∟ALIVE(7)+∟ALIVE(8)=1:Goto H:End


:¦ If Q≠1:Then:Output(θ,11,"(MIS)":For(W,0,1750):End:Output(θ,1," ":Output(θ,11,"     "
:¦ End
:End
:End
:
:Lbl H
:
:For(θ,1,8
:¦ If ∟ALIVE(θ)=1:Goto G
:End
:
:
:Lbl G
:ClrHome
:If θ=1:Output(1,1,Str1
:If θ=2:Output(1,1,Str2
:If θ=3:Output(1,1,Str3
:If θ=4:Output(1,1,Str4
:If θ=5:Output(1,1,Str5
:If θ=6:Output(1,1,Str6
:If θ=7:Output(1,1,Str7
:If θ=8:Output(1,1,Str2
:Output(2,1,"WINS
:Pause

(or attached file)
and btw: I know the code is all over the place :)

(the error is line 61)
« Last Edit: April 07, 2012, 03:41:33 pm by Wretchedlout »

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Re: Strange/Rnd domain err.
« Reply #6 on: May 01, 2012, 10:10:35 pm »
still nobody? :/

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Strange/Rnd domain err.
« Reply #7 on: May 01, 2012, 10:23:22 pm »
I just saw this, I have an idea :) Is it right after your program RecallPics? If so, it is because that modifies the Y variable. Not sure if that is what is actually causing it or not, though :/

Offline Wretchedlout

  • LV3 Member (Next: 100)
  • ***
  • Posts: 64
  • Rating: +6/-0
    • View Profile
Re: Strange/Rnd domain err.
« Reply #8 on: May 01, 2012, 10:47:41 pm »
well, i don't know. I ran it a few times without fixing it and no errors occured, I changed Y to U so... i'm not sure

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Strange/Rnd domain err.
« Reply #9 on: May 01, 2012, 10:57:53 pm »
My general rule is to never use the Y variable, since you never can tell when it is going to get corrupted

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Strange/Rnd domain err.
« Reply #10 on: May 01, 2012, 11:08:22 pm »
as Builderboy said, never mess with X and Y variable when you're using a graph screen as they can be changed.
Sig wipe!