
-----------------------------------
skilly
Mon Jan 14, 2008 2:38 pm

My comp. science final project
-----------------------------------
This is my final project
some of it doesn't work

View.Set ("graphics:787;492;nocursor")
%%%%%%%%%%%%%%%%%%%%%%
%% GLOBAL VARIABLES %%
%%%%%%%%%%%%%%%%%%%%%%
var playerName : array 1 .. 4 of string := init ("Comp 1", "Comp 2", "Comp 3", "Comp 4")
var font1 := Font.New ("Arial:40:bold")
var font2 := Font.New ("Arial:15:bold")
var font3 := Font.New ("Arial:12:bold")
var players : int := 0
var Roll : int
var turn : int := 0
var playerx : array 1 .. 4, 1 .. 4 of int
var playery : array 1 .. 4, 1 .. 4 of int
var playerCounter : array 1 .. 4 of int := init (0, 0, 0, 0)
var circleCounter : array 1 .. 4, 1 .. 4 of int
var mousex, mousey : int
var button : int
var stream : int
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Stets all circleCounters to 0
for row : 1 .. 4
    for col : 1 .. 4
        circleCounter (row, col) := 0
    end for
end for


%%%putting numbers into array from file%%%

%into x array%
open : stream, "playerarrayx.t", get
for row : 1 .. 4
    for col : 1 .. 4
        get : stream, playerx (row, col)
    end for
end for
close : stream

%into y array%
open : stream, "playerarrayy.t", get
for row : 1 .. 4
    for col : 1 .. 4
        get : stream, playery (row, col)
    end for
end for
close : stream

proc menu
    var input : string (1)
    %%MENU PART%%
    loop
        loop
            Draw.Fill (1, 1, black, black)
            Font.Draw ("TROUBLE!!", 250, maxy - 50, font1, Rand.Int (9, 14)) %title
            locate (maxrow div 2 - 1, maxcol div 2 - 6)
            colour (Rand.Int (9, 14))
            colourback (black)
            Draw.Box (294, 266, 473, 285, Rand.Int (9, 14))
            put "Start Game!!" .. %%button
            locate (maxrow div 2 + 1, maxcol div 2 - 6)
            colour (Rand.Int (9, 14))
            colourback (black)
            Draw.Box (294, 234, 480, 253, Rand.Int (9, 14))
            put "Instructions." ..  %%button
            locate (maxrow, 2)
            Draw.Box (5, 8, 43, 29, Rand.Int (9, 14))
            put "Back" ..  %%button
            loop
                Mouse.Where (mousex, mousey, button)
                if button = 1 and mousex >= 294 and mousex  266 and mousey < 285 then
                    Draw.Cls
                    exit
                elsif button = 1 and mousex >= 294 and mousex  234 and mousey < 253 then
                    %%%Instructions%%%
                    locate (7, maxcol div 2 - 15)
                    put "This is the game of TROUBLE!!!"
                    locate (8, maxcol div 2 - 36)
                    put "All you have to do is get you're players (there's 4)around the board once!!"
                    locate (9, maxcol div 2 - 39)
                    put "The first thing you have to do is write how many players are going to play(1-4)."
                    locate (10, maxcol div 2 - 21)
                    put "Then you need to choose who will go first."
                    locate (11, maxcol div 2 - 33)
                    put "You do this by rolling the little die in the middle of the screen."
                    locate (12, maxcol div 2 - 31)
                    put "You will then wait for you're turn and when it starts you roll."
                    locate (13, maxcol div 2 - 16)
                    put "(press any button to roll the die again)"
                    locate (14, maxcol div 2 - 23)
                    put "Next you choose which player you want to move."
                    locate (15, maxcol div 2 - 21)
                    put "(On the first turn it will move player #1.)"
                    locate (16, maxcol div 2 - 29)
                    put "You just do that until someone wins, then the game is done."
                    put ""
                    locate (18, maxcol div 2 - 29)
                    put "click to go back"
                    Time.Delay (500)
                    button := 0
                    loop
                        Mouse.Where (mousex, mousey, button)
                        exit when button = 1
                    end loop
                    Draw.Cls
                    exit
                elsif button = 1 and mousex >= 5 and mousex = 8 and mousey = 294 and mousex  266 and mousey < 285 then
                exit
            elsif button = 1 and mousex >= 5 and mousex = 8 and mousey = 294 and mousex  266 and mousey < 285 then
            exit
        elsif button = 1 and mousex >= 5 and mousex = 8 and mousey 