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

Username:   Password: 
 RegisterRegister   
 Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
razan45




PostPosted: Fri Jun 14, 2013 4:52 pm   Post subject: Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap

Turing:

setscreen ("graphics:1260;910") % sets screen for the main menu


var font1, font2, font3, font4, font5, font6, font7 : int    % declares font variable
var back : int
back := Pic.FileNew ("good_back_button_good.bmp")
var lastback := Pic.Scale (back, Pic.Width (back) div 3, Pic.Height (back) div 3)

var difficulty : int

difficulty := 10

font1 := Font.New ("Fixedsys:90:bold")  % states font and size
font2 := Font.New ("Fixedsys:40:bold")
font3 := Font.New ("Fixedsys:30:bold")
font4 := Font.New ("Arial:30:bold")
font5 := Font.New ("Fixedsys:300:bold")
font6 := Font.New ("Fixedsys:20:bold")
font7 := Font.New ("Fixedsys:5:bold")

var car1x, car1y, car2x, car2y, car1colour, car2colour, car1win, car2win, counter1, counter2, car1lose, timer : int
var again : string
car1win := 0
car2win := 0
car1x := maxx div 2
car1y := maxy div 2
car2x := maxx div 2 + 10
car2y := maxy div 2

car1colour := 11
car2colour := 12
counter1 := 0
counter2 := 0
car1lose := 0
var car1direction, car2direction : string
car1direction := "left"
car2direction := "right"

var mode : string

var colours, ccolours : int

var linecolour : int

var x, y, button : int %vars for the mouse where code

proc onetwothree
    setscreen ("graphics:1260;910")
    cls
   
    Font.Draw ("3", maxx div 2, maxy div 2, font5, 12)
    delay (1000)
    cls
   
    Font.Draw ("2", maxx div 2, maxy div 2, font5, 44)
    delay (1000)
    cls
   
    Font.Draw ("1", maxx div 2, maxy div 2, font5, 48)
    delay (1000)
    cls
end onetwothree

proc mainmenu
    drawfillbox (0, 0, maxx, maxy, black) % draws a black background

    loop
        randint (colours, 1, 255)
        Font.Draw ("Light Cycle", 430, 750, font1, colours)     % Puts the name of the game

        Font.Draw ("Single Player", 430, 350, font2, colours) % draws single player in main menu screen

        Font.Draw ("Multiplayer", 430, 250, font2, colours) % draws multiplayer in main menu screen

        Font.Draw ("Controls", 430, 150, font2, colours) %draws controls in main menu


        mode := ""

        Mouse.Where (x, y, button)

        if x >= 426 and y >= 331 and x <= 868 and y <= 397 and button = 1 then  % if they hit the single player text, mode is set to "single player"
            mode := "single player"
            exit
        elsif x >= 426 and y >= 226 and x <= 800 and y <= 296 and button = 1 then   % if they hit the multiplayer text, mode is set to "single player"
            mode := "multiplayer"
            exit
        elsif x >= 426 and y >= 142 and x <= 700 and y <= 191 and button = 1 then   % if they hit the controls text, mode is set to "single player"
            mode := "controls"
            exit
        end if
    end loop

end mainmenu
proc controls

    drawfillbox (0, 0, maxx, maxy, black)
    if mode = "controls" then

        loop

            Font.Draw ("Controls", 480, 750, font1, green)

            Font.Draw ("Player 1 Controls", 40, 650, font6, 42)
            Font.Draw ("Player 2 Controls", maxx div 2 - 250 + 40, 650, font6, 42)
            drawline (maxx div 2 - 250, 200, maxx div 2 - 250, maxy - 200, green)

            drawbox (100, 400, 150, 450, green) % ASDW boxes
            drawbox (155, 400, 205, 450, green)
            drawbox (210, 400, 260, 450, green)
            drawbox (140, 455, 190, 505, green)
            Font.Draw ("A", 113, 413, font4, green)
            Font.Draw ("S", 168, 413, font4, green)
            Font.Draw ("D", 223, 413, font4, green)
            Font.Draw ("W", 147, 468, font4, green)


            drawbox (730 - 250, 400, 780 - 250, 450, green) % Arrow Boxes
            drawbox (785 - 250, 400, 835 - 250, 450, green)
            drawbox (840 - 250, 400, 890 - 250, 450, green)
            drawbox (785 - 250, 455, 835 - 250, 505, green)


            drawline (810 - 250, 470, 810 - 250, 490, green) % top arrow
            drawline (810 - 250, 490, 805 - 250, 485, green)
            drawline (810 - 250, 490, 815 - 250, 485, green)


            drawline (810 - 250, 415, 810 - 250, 435, green) % bottom arrow
            drawline (810 - 250, 415, 805 - 250, 420, green)
            drawline (810 - 250, 415, 815 - 250, 420, green)


            drawline (855 - 250, 425, 875 - 250, 425, green) % right arrow
            drawline (875 - 250, 425, 870 - 250, 420, green)
            drawline (875 - 250, 425, 870 - 250, 430, green)


            drawline (745 - 250, 425, 765 - 250, 425, green) % left arrow
            drawline (745 - 250, 425, 750 - 250, 430, green)
            drawline (745 - 250, 425, 750 - 250, 420, green)

            drawline (750, 200, 750, maxy - 200, green) % makes the green borders in the mainmenu
            drawline (0, 200, 1260, 200, green)
            drawline (0, 710, 1260, 710, green)
            drawline (750, 455, 1260, 455, green)

            Font.Draw ("Player 1 Colour", 800, 600, font7, 42)        %writes the words for picking colour
            Font.Draw ("Player 2 Colour", 800, 500, font7, 42)
            Font.Draw ("Difficulty", 800, 300, font7, 42)

            drawfillbox (960, 600, 980, 620, 11) %red box for 1
            drawfillbox (990, 600, 1010, 620, 12) %blue box for 1
            drawfillbox (1020, 600, 1040, 620, 14) %yellow box for 1
            drawfillbox (1050, 600, 1070, 620, 10) %green box for 1
            drawfillbox (1080, 600, 1100, 620, 93) %white box for 1

            drawfillbox (960, 500, 980, 520, 11) %red box for 2
            drawfillbox (990, 500, 1010, 520, 12) %blue box for 2
            drawfillbox (1020, 500, 1040, 520, 14) %yellow box for 2
            drawfillbox (1050, 500, 1070, 520, 10) %green box for 2
            drawfillbox (1080, 500, 1100, 520, 93) %white box for 2

            drawfillbox (950, 300, 970, 320, 116) %red shades for difficulty
            drawfillbox (1000, 300, 1020, 320, 115)
            drawfillbox (1050, 300, 1070, 320, 114)
            drawfillbox (1100, 300, 1120, 320, 113)
            drawfillbox (1150, 300, 1170, 320, 112)

            Font.Draw ("Slow", 920, 270, font7, 42)
            Font.Draw ("Fast", 1165, 270, font7, 42)


            mousewhere (x, y, button)

            if x > 960 and y > 600 and x < 980 and y < 620 and button = 1 then
                car1colour := 11
                drawbox (959, 599, 981, 621, 64)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 990 and y > 600 and x < 1010 and y < 620 and button = 1 then
                car1colour := 12
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 64)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 1020 and y > 600 and x < 1040 and y < 620 and button = 1 then
                car1colour := 14
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 64)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 1050 and y > 600 and x < 1070 and y < 620 and button = 1 then
                car1colour := 10
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 64)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 1080 and y > 600 and x < 1100 and y < 620 and button = 1 then
                car1colour := 93
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 64)
            end if

            if x > 960 and y > 500 and x < 980 and y < 520 and button = 1 then
                car2colour := 11
                drawbox (959, 499, 981, 521, 64)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 990 and y > 500 and x < 1010 and y < 520 and button = 1 then
                car2colour := 12
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 64)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1020 and y > 500 and x < 1040 and y < 520 and button = 1 then
                car2colour := 14
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 64)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1050 and y > 500 and x < 1070 and y < 520 and button = 1 then
                car2colour := 10
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 64)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1080 and y > 500 and x < 1100 and y < 520 and button = 1 then
                car2colour := 93
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 64)
            end if

            if x > 960 and y > 500 and x < 980 and y < 520 and button = 1 then
                car2colour := 11
                drawbox (959, 499, 981, 521, 64)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 990 and y > 500 and x < 1010 and y < 520 and button = 1 then
                car2colour := 12
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 64)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1020 and y > 500 and x < 1040 and y < 520 and button = 1 then
                car2colour := 14
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 64)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1050 and y > 500 and x < 1070 and y < 520 and button = 1 then
                car2colour := 10
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 64)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1080 and y > 500 and x < 1100 and y < 520 and button = 1 then
                car2colour := 93
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 64)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%
            if x > 950 and y > 300 and x < 970 and y < 320 and button = 1 then
                difficulty := 25
                drawbox (949, 299, 971, 321, 64)
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1000 and y > 300 and x < 1020 and y < 320 and button = 1 then
                difficulty := 20
                drawbox (949, 299, 971, 321, 16)
                drawbox (999, 299, 1021, 321, 64)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1050 and y > 300 and x < 1070 and y < 320 and button = 1 then
                difficulty := 10
                drawbox (949, 299, 971, 321, 16)
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 64)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1100 and y > 300 and x < 1120 and y < 320 and button = 1 then
                difficulty := 5
                drawbox (949, 299, 971, 321, 16)
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 64)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1150 and y > 300 and x < 1170 and y < 320 and button = 1 then
                car2colour := 2
                drawbox (949, 299, 971, 321, 16)
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 64)
            end if


            Font.Draw ("Note: If in Single Player mode, the Player 2 controls will not work.", 20, 150, font4, 42)
            Pic.Draw (lastback, 20, 20, 2)



            if x > 20 and y > 20 and x < 20 + Pic.Width (lastback) and y < 20 + Pic.Height (lastback) and button = 1 then
                mainmenu
                if mode = "controls" then
                    controls
                elsif mode = "single player" then
                    onetwothree
                    playagain1
                elsif mode = "multiplayer" then
                    onetwothree
                    playagain
                end if
            end if
            View.Update

        end loop
    end if
end controls

procedure grid
    drawfillbox (0, 0, maxx, maxy, black)
    for x : 1 .. maxy by 100
        drawline (0, maxy - x, maxx, maxy - x, 115)
    end for
    for x : 1 .. maxx by 100
        drawline (x, maxy, x, 0, 115)
    end for
end grid

procedure explode (x, y, Colour, spread : int)
    %creates the explosions that occur when cars die
    for i : 1 .. 1300
        Draw.Oval (x, y, i, i, Colour)

        if i > spread then
            Draw.FillOval (x, y, i - spread, i - spread, 7)
        end if
    end for
end explode

%declares variable


%procedure to drawcar1 for player 1
procedure drawcar1 (car1x, car1y, car1colour : int)


    Draw.Dot (car1x, car1y, car1colour)
    Draw.Dot (car1x + 1, car1y + 1, car1colour)
    Draw.Dot (car1x + 1, car1y - 1, car1colour)
    Draw.Dot (car1x - 1, car1y + 1, car1colour)
    Draw.Dot (car1x - 1, car1y - 1, car1colour)

    Draw.Dot (car1x, car1y + 1, car1colour)
    Draw.Dot (car1x + 1, car1y, car1colour)
    Draw.Dot (car1x - 1, car1y, car1colour)
    Draw.Dot (car1x, car1y - 1, car1colour)

end drawcar1
%procedure to drawcar2 for player 2
procedure drawcar2 (car2x, car2y, car2colour : int)
    % Draw Player 2
    Draw.Dot (car2x, car2y, car2colour)
    Draw.Dot (car2x + 1, car2y + 1, car2colour)
    Draw.Dot (car2x + 1, car2y - 1, car2colour)
    Draw.Dot (car2x - 1, car2y + 1, car2colour)
    Draw.Dot (car2x - 1, car2y - 1, car2colour)

    Draw.Dot (car2x, car2y + 1, car2colour)
    Draw.Dot (car2x + 1, car2y, car2colour)
    Draw.Dot (car2x, car2y - 1, car2colour)
    Draw.Dot (car2x - 1, car2y, car2colour)
    drawcar1 (car1x, car1y, car1colour)
end drawcar2
%procedure to movecar1 for player 1 using w,a,s,d
procedure movedirectioncar1 (var car1direction : string)
    % Player 1 movement is controled with w,a,s,d
    var chars : array char of boolean

    Input.KeyDown (chars)
    if chars ('w') then
        if car1direction not= "down" then
            car1direction := "up"
        end if
    elsif chars ('s') then
        if car1direction not= "up" then
            car1direction := "down"
        end if
    elsif chars ('a') then
        if car1direction not= "right" then
            car1direction := "left"
        end if
    elsif chars ('d') then
        if car1direction not= "left" then
            car1direction := "right"
        end if
    else
    end if
end movedirectioncar1
%procedure to movecar2 for player 2 using arrow keys
procedure movedirectioncar2 (var car2direction : string)
    % Player 2 movement is controled with the directional keys
    var chars : array char of boolean

    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if car2direction not= "down" then
            car2direction := "up"
        end if
    elsif chars (KEY_DOWN_ARROW) then
        if car2direction not= "up" then
            car2direction := "down"
        end if
    elsif chars (KEY_LEFT_ARROW) then
        if car2direction not= "right" then
            car2direction := "left"
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        if car2direction not= "left" then
            car2direction := "right"
        end if
    else
    end if
end movedirectioncar2

var movespeed : int := 3
%moving car1
procedure movecar1 (var car1x, car1y : int, car1direction : string, movespeed : int)


    % Player 1's movement
    if car1direction = "up" then
        car1y += movespeed
    elsif car1direction = "down" then
        car1y -= movespeed
    elsif car1direction = "left" then
        car1x -= movespeed
    elsif car1direction = "right" then
        car1x += movespeed
    end if
end movecar1
%moving car2
procedure movecar2 (var car2x, car2y : int, car2direction : string, movespeed : int)
    % Player 2's movement
    if car2direction = "up" then
        car2y += movespeed
    elsif car2direction = "down" then
        car2y -= movespeed
    elsif car2direction = "left" then
        car2x -= movespeed
    elsif car2direction = "right" then
        car2x += movespeed
    end if
end movecar2
%maingame
proc game


    drawcar1 (car1x, car1y, car1colour)
    drawcar2 (car2x, car2y, car2colour)
    movedirectioncar1 (car1direction)
    movedirectioncar2 (car2direction)
    delay (difficulty)
    movecar1 (car1x, car1y, car1direction, movespeed)
    movecar2 (car2x, car2y, car2direction, movespeed)
    %code for when the cars hit the sides,their or others lightcyle
    if car1x <= 0
            or car1x >= 1260
            or car1y >= 910
            or car1y <= 0

            or View.WhatDotColour (car1x, car1y) = car1colour
            or View.WhatDotColour (car1x, car1y) = car2colour
            then
             explode (car1x, car1y, car1colour, 500)
        car2win := 1
    elsif car2x <= 0
            or car2x >= 1260
            or car2y >= 910
            or car2y <= 0 or View.WhatDotColour (car2x, car2y) = car1colour
            or View.WhatDotColour (car2x, car2y) = car2colour
            then
            explode (car2x, car2y, car2colour, 500)
        car1win := 1
    end if
    %draws who won
    if car1x >= 1260
            or car1x <= 0
            or car1y >= 910
            or car1y <= 0
            or car2win = 1
            then
        Font.Draw ("Car2 wins", maxx div 2, maxy div 2, font3, car2colour)
        counter2 := counter2 + 1
        delay (10)
    elsif car2x >= 1260
            or car2x <= 0
            or car2y >= 910
            or car2y <= 0
            or car1win = 1
            then
        Font.Draw ("Car1 wins", maxx div 2, maxy div 2, font3, car1colour)
        counter1 := counter1 + 1
        delay (10)
    end if
end game
%procedure if they want to play again
proc playagain
    loop
        grid
        loop
            game
            if car1x >= 1260
                    or car1x <= 0
                    or car1y >= 910
                    or car1y <= 0
                    or car2win = 1
                    or car2x >= 1260
                    or car2x <= 0
                    or car2y >= 910
                    or car2y <= 0
                    or car1win = 1 then
                exit
            end if
        end loop
        put "player1: ", counter1
        put "player2: ", counter2
        put "would you like to play again? Any Key/n"
        get again
        if again = "n" then
            mainmenu
            controls
            exit
        else
            cls
            drawfillbox (0, 0, maxx, maxy, black)
            car1win := 0
            car2win := 0
            car1x := maxx div 2
            car1y := maxy div 2
            car2x := maxx div 2 + 10
            car2y := maxy div 2
            car1colour := 11
            car2colour := 12
            car1direction := "left"
            car2direction := "right"
            font3 := Font.New ("Fixedsys:30:bold")
            grid
            loop
                game
                if car1x >= 1260
                        or car1x <= 0
                        or car1y >= 910
                        or car1y <= 0
                        or car2win = 1
                        or car2x >= 1260
                        or car2x <= 0
                        or car2y >= 910
                        or car2y <= 0
                        or car1win = 1 then
                end if
                exit
            end loop
end if
end loop
end playagain



proc game1
    timer := 0
    clock (timer)
    drawcar1 (car1x, car1y, car1colour)
    movedirectioncar1 (car1direction)
    %    delay (10)
    movecar1 (car1x, car1y, car1direction, movespeed)
    if car1x <= 0
            or car1x >= 1260
            or car1y >= 910
            or car1y <= 0
            or View.WhatDotColour (car1x, car1y) = car1colour then
            explode(car1x,car1y,car1colour,500)
        car1lose := 1
    end if
    if car1lose = 1
            then
        Font.Draw ("You lose", maxx div 2, maxy div 2, font3, 12)


        put timer / 1000 : 0 : 1
    end if
end game1

proc playagain1
    loop
        grid
        loop
            game1
            if car1lose = 1 then
                exit
            end if
        end loop
        put "you survived for:", timer / 1000 : 0 : 1, " seconds"
        timer := 0

       put "would you like to play again? Any Key/n"
        get again
           if again= "n"  then     
            exit
        else
            cls
            drawfillbox (0, 0, maxx, maxy, black)
            car1lose := 0
            car1x := maxx div 2
            car1y := maxy div 2
            car1colour := 11
            car1direction := "left"
            font3 := Font.New ("Fixedsys:30:bold")
            grid
            loop
                game1
                if car1lose = 1 then
                end if
                exit

            end loop
end if
end loop
end playagain1





Music.PlayFileReturn ("NyanCat.mp3")
loop
car1win := 0
car2win := 0
car1x := maxx div 2
car1y := maxy div 2
car2x := maxx div 2 + 10
car2y := maxy div 2 
car1lose := 0
car1direction := "left"
car2direction := "right"
mainmenu
    if mode = "controls" then
        controls
    elsif mode = "single player" then
        onetwothree
        playagain1
    elsif mode = "multiplayer" then
        onetwothree
        playagain
    end if
   
    if again = "exit" then
        exit
    end if
   
end loop




Mod Edit:
Please wrap you code in either of the following in order to preserve whitespace (indentation) and to highlight the syntax.
code:

[syntax="turing"] ... code ... [/syntax]

[code] ... code ... [/code ]
Sponsor
Sponsor
Sponsor
sponsor
MihaiG




PostPosted: Fri Jun 14, 2013 5:29 pm   Post subject: Re: Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap

Please submit to the proper forum, Please do not beg. Please read tutorials on how to submit code for help.

From the looks of it. You have problems with procedures not being declared..
In turing you may want to look at
forward and body

Turing:

var token : string
        forward procedure expn (var eValue : real)
            import forward term, var token
        ? other declarations appear here ?
        body procedure expn
            var nextValue : real
            term (eValue)               % Evaluate t
            loop                        % Evaluate { + t}
                exit when token not= "+"
                get token
                term (nextValue)
                eValue := eValue + nextValue
            end loop
        end expn

This is what you need to do..

You need to define your playagain procedure using forward then define the body with what you want it to do. This will allo wyou to call the procedure before it's been fully declared in your code
Tony




PostPosted: Fri Jun 14, 2013 5:43 pm   Post subject: RE:Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap

moved to Turing Help. Although the biggest problem here seems to be the ability to actually ask a proper question.

What seems to be the problem?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
MihaiG




PostPosted: Sat Jun 15, 2013 12:03 am   Post subject: Re: RE:Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap

Tony @ Fri Jun 14, 2013 6:43 pm wrote:
moved to Turing Help. Although the biggest problem here seems to be the ability to actually ask a proper question.

What seems to be the problem?


Tony, i ran the program and noticed declaration issues with his procedures, he seemed to be calling procedures before they were defined, but calling additional procedures inside those procedures which caused issues that made it hard to re-arrange the code. I only looked at it for a few minutes.
razan45




PostPosted: Sat Jun 15, 2013 12:16 am   Post subject: Re: RE:Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap

MihaiG @ Sat Jun 15, 2013 12:03 am wrote:
Tony @ Fri Jun 14, 2013 6:43 pm wrote:
moved to Turing Help. Although the biggest problem here seems to be the ability to actually ask a proper question.

What seems to be the problem?


Tony, i ran the program and noticed declaration issues with his procedures, he seemed to be calling procedures before they were defined, but calling additional procedures inside those procedures which caused issues that made it hard to re-arrange the code. I only looked at it for a few minutes.




Thanks MihaiG its works i used forward procedure playagain1 and forward playagain then put body procedures thanks for the 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  [ 5 Posts ]
Jump to:   


Style:  
Search: