Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 HELP MATRIX STUFF
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jekate




PostPosted: Tue Mar 09, 2004 8:00 pm   Post subject: HELP MATRIX STUFF

I was trying to make a matrix thingy and as I was trying it out, I came to a problem I cannot fix. Here is my program so far.

Quote:

setscreen ("graphics:v16")
var count, num : int
count := 0

cls
color(10)
loop
count := count + 1
randint (num, 0, 1)

locate (count, 1)
put num
delay(50)
end loop




As I tried to run it, a problem comes up saying:
"Row greater than maxrow"
I am using version 3.1.1A and have also tried the newest version of winOOT but it still does not work. Pls help.
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Tue Mar 09, 2004 8:12 pm   Post subject: (No subject)

you didnt stop the row from increasing past max
something like this
code:

setscreen ("graphics:v16")
var count,count2, num : int
count := 0
count2:=1

cls
color(10)
loop
count := count + 1

randint (num, 0, 1)
if count = maxrow then
count:=1
count2:=count2+1
end if
locate (count, count2)
put num
delay(50)
end loop

or
code:

setscreen ("graphics:v16")
var count,count2, num : int
count := 0
count2:=1

cls
color(10)
loop
count := count + 1

randint (num, 0, 1)

if count = maxrow then
count:=1
randint (count2, 1, maxcol)
end if
locate (count, count2)
put num
delay(50)
end loop

Im really not an expert at this sort of thing, and Im lazy Very Happy
jonos




PostPosted: Tue Mar 09, 2004 8:19 pm   Post subject: (No subject)

nice start. but lets start over.

the reason you are getting that error is because turing will not draw text off the screen, so if you have a max number of rows of 10, turing will not print something on a row of 11 because that doesn't show up on the screen.

to get past this problem you could just get rid of:

locate(count, 1) because without it is is doing the exact same thing.

play around with that, and when you figure it out, try this code:

code:

setscreen ("graphics:500;500,nobuttonbar")%makes size of screen, gets rid of button bar which is a stupid part of turing most of the time
var num : int %the randint variable
var line : string := ""% makes and initializes a variable which will be our string

color (10)%sets text colour to lime green
colorback (7)%sets background colour to black
cls

loop
    for counter : 1 .. maxcol %sets a counter that will make one character (0 or 1) for each column for the whole screen across (so the charactesr fill up the whole screen)
        randint (num, 0, 1)%makes random integer
        line := line + intstr(num)%makes the line of numbers, intstr(num) converts the num variable to a string so that we can cancatenate
    end for
    put line %puts the line we made of random numbers
    line := "" %%resets the line variable so that its a whole new combo of 1s and 0s
    delay (25)
end loop


keep programming, and when you get better head on over to other basics to start blitz basic and be cool like everyone else in there.

edit: damn paul, too fast for the lamer jonos
nate




PostPosted: Tue Mar 09, 2004 10:10 pm   Post subject: (No subject)

Catylst made some crazy matrix program a while back, check it out for ideas, and maybe you can personal message him if you need some help.
recneps




PostPosted: Wed Mar 10, 2004 1:34 pm   Post subject: (No subject)

or, even simpler, just remove the locate line
and add .. to the end of the put, so it becomes
code:
setscreen ("graphics:v16")
var count, num : int
count := 0

cls
color(10)
loop
count := count + 1
randint (num, 0, 1)

locate (count, 1)
put num
delay(50)
end loop

And that way turing makes it go the the next line when it finishes Smile

it looks cool like this too Very Happy
code:

setscreen ("graphics:v16")
var count, num : int
count := 0

cls
colourback(7)
color(10)
loop
count := count + 1
randint (num, 0, 1)


put num..
end loop
jonos




PostPosted: Wed Mar 10, 2004 3:50 pm   Post subject: (No subject)

the problem with that one is that it kindof shows the line being made at the bottom... mine doesn't, buts its longer code, so it cancels out.
Jekate




PostPosted: Wed Mar 17, 2004 6:36 pm   Post subject: (No subject)

Thanx for the help but it doesn't really fit in with what I would like it to do. I am still trying t figure out how to fix it.
I have fixed the "row greater then maxrow" bit but then I came over another problem. As soon as it starts scrolling down the screen, it starts to go very very fast. I don't want that.

This is what I got so far. Scince I do not know how to do arrays and things, I have to state each variable. I haven't put a fork for each variable yet, this is still not finished.

There are some smilies in this but they are not suppose to be. You can probably guess what is suppose to fit in where the smilies are.


Also, is there a way to stop everything that is happening in the program. So let's say I have a couple of loops going, songs, and other things going. Is there a command to stop the loops and everything but still keep the program going so I can put more.

Quote:
setscreen ("graphics:v16")
var num, count1, count2, count3, count4, count5, count6, count7, count8 : int
var count9, count10, count11, count12, count13, count14, count15, count16 : int
var count17, count18, count19, count20, count21, count22, count23, count24 : int
var count25, count26, count27, count28, count29, count30, count31, count32 : int
count1 := 0
count2 := 0
count3 := 0
count4 := 0
count5 := 0
count6 := 0
count7 := 0
count8 := 0
count9 := 0
count10 := 0
count11 := 0
count12 := 0
count13 := 0
count14 := 0
count15 := 0
count16 := 0
count17 := 0
count18 := 0
count19 := 0
count20 := 0
count21 := 0
count22 := 0
count23 := 0
count24 := 0
count25 := 0
count26 := 0
count27 := 0
count28 := 0
count29 := 0
count30 := 0
count31 := 0
count32 := 0

color (10)
cls

process one
loop
count1 := count1 + 1
randint (num, 0, 1)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end one

process two
loop
randint (num, 0, 1)
locate (count1, 2)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end two

process three
loop
randint (num, 0, 1)
locate (count1, 3)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end three

process four
loop
randint (num, 0, 1)
locate (count1, 4)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end four

process five
loop
randint (num, 0, 1)
locate (count1, 5)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end five

process six
loop
randint (num, 0, 1)
locate (count1, 6)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end six

process seven
loop
randint (num, 0, 1)
locate (count1, 7)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end seven

process eight
loop
randint (num, 0, 1)
locate (count1, 8)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end eight

process nine
loop
randint (num, 0, 1)
locate (count1, 9)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end nine

process ten
loop
count10 := count10 + 1
randint (num, 0, 1)
locate (count10, 10)
if count10 = maxrow then
count10 := 25
end if
put num
delay (70)
end loop
end ten

process eleven
loop
count11 := count11 + 1
randint (num, 0, 1)
locate (count11, 11)
if count11 = maxrow then
count11 := 25
end if
put num
delay (70)
end loop
end eleven

process twelve
loop
randint (num, 0, 1)
locate (count1, 12)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end twelve

process thirteen
loop
randint (num, 0, 1)
locate (count1, 13)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end thirteen

process fourteen
loop
randint (num, 0, 1)
locate (count1, 14)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end fourteen

process fifteen
loop
randint (num, 0, 1)
locate (count1, 15)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end fifteen

process sixteen
loop
randint (num, 0, 1)
locate (count1, 16)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end sixteen

process seventeen
loop
randint (num, 0, 1)
locate (count1, 17)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end seventeen

process eighteen
loop
randint (num, 0, 1)
locate (count1, 18)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end eighteen

process nineteen
loop
randint (num, 0, 1)
locate (count1, 19)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end nineteen

process twenty
loop
randint (num, 0, 1)
locate (count1, 20)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end twenty

process twentyone
loop
randint (num, 0, 1)
locate (count1, 21)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end twentyone

process twentytwo
loop
randint (num, 0, 1)
locate (count1, 22)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end twentytwo

process twentythree
loop
randint (num, 0, 1)
locate (count1, 23)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end twentythree

process twentyfour
loop
randint (num, 0, 1)
locate (count1, 24)
if count1 = maxrow then
count1 := 25
end if
put num
delay (70)
end loop
end twentyfour


fork one
fork two
fork three
fork four
fork five
fork six
fork seven
fork eight
fork nine
fork ten
fork eleven
fork twelve
fork thirteen
fork fourteen
fork fifteen
fork sixteen
fork seventeen
fork eighteen
fork nineteen
fork twenty
fork twentyone
fork twentytwo
fork twentythree
fork twentyfour
jonos




PostPosted: Wed Mar 17, 2004 6:54 pm   Post subject: (No subject)

dont use processes, because turing will just mess with those. you should try to use loops to do what you want.

but your last questions: you can use exit for your loops to stop a loop.

anyways, don't use locate() because that is the problem that the program is not continueing. you should just let the text do it itself (moving down the run window), but you are using processes, so that may not be possible. I highly suggest you don't use processes, you can do the same thing with a loop (probably i haven't looked at your code at length).

as for your speed problem, you could use delay(), but as you are using processes, that may mess it up.

explain what you want in detail and then we may be able to be more effective in our help.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: