
-----------------------------------
Reira
Wed Nov 14, 2007 8:21 pm

Drawing a Cross using Asterisks in Turing
-----------------------------------
here is the code. 

var column:int:=1
var row:int:=1
put repeat ("*", 80)
loop
    locate (row, column)
    put "*"
    column := column + 1
    if column > 80 then
        column := 1
    end if
    delay (100)
    cls

        locate (column, row )
    put "*"
    column := column - 1
    if column < 80 then
        column := 80
    end if


    locate (row, column)
    put "*"
    column := column + 1
    if column > 25 then
        column := 1
    end if
    delay (100)
    cls


        locate (column, row )
    put "*"
    column := column - 1
    if column < 80 then
        column := 1
    end if


    cls
end loop


-----------------------------------
Nick
Wed Nov 14, 2007 8:25 pm

RE:Drawing a Cross using Asterisks in Turing
-----------------------------------
so do u want something like 

 *
***
 * or a giant one?

-----------------------------------
Reira
Wed Nov 14, 2007 8:26 pm

RE:Drawing a Cross using Asterisks in Turing
-----------------------------------
yup, a giant one. 
a small one would be too easy, hehe ^^

-----------------------------------
Nick
Wed Nov 14, 2007 8:34 pm

Re: Drawing a Cross using Asterisks in Turing
-----------------------------------
ok ill go step by step

first get rid of put reapeat and your row varible

second replace your loop with 1 for and 1 for decreasing loop one after the other both called row

third in both loops keep only     locate (row, column)
    put "*"
    column := column + 1
    if column > 80 then
        column := 1
    end if
    delay (100)

finally in between the 2 loops have a line to reset column back to 1

-----------------------------------
CodeMonkey2000
Wed Nov 14, 2007 8:35 pm

Re: Drawing a Cross using Asterisks in Turing
-----------------------------------
Like this?
var column : int := 1
var row : int := 1
locate (maxrow div 2, 1)
put repeat ("*", maxcol)
for x : 1 .. maxrow
    locate (x, maxcol div 2)
    put "*" ..
end for

-----------------------------------
Reira
Wed Nov 14, 2007 8:46 pm

RE:Drawing a Cross using Asterisks in Turing
-----------------------------------
hmmm wow this makes things much shorter... 
i thought this would take at least four "for" loops... i saw someone in my class do this in a much longer code. and the teacher told me to do a loop for each line... ah well thanks momop for your explanation... I finally get it! And CodeMonkey, you did it quite differently from the way people attempted to do this in my CompSci class... but this version is much shorter than any version I have seen so far. Anways, thanks for your help! ^^
Now, it's time to memorise... o_0
