Computer Science Canada

Culminating Project Helpage

Author:  Flying_Fajita [ Sun Jan 14, 2007 3:21 am ]
Post subject:  Culminating Project Helpage

Alright, first and foremost let me warn you that my coding, my program will be very simple (to you guys) and amateur. I've learned coding since 3 months ago and at first I was very excited but due to my teacher's slowness at teaching everything (I learned in one hour here, what she taught us over a month), I lost interest within a month and this is the first time I'm embarking on a major project - which happens to be my final project. We have to make a quiz with at least 6 questions, with more than one guess per question, to allow the user to return to main menu from any other screens, and for there to be the user's mark at the end of the quiz.

Here's how far i've gotten with a day's work. I have six days left to work on it, but want to finish it by Sunday midnight seeing as I have a french, history, and civics project due on the same day. I'm not done adding comments to the entire program because I'm planning to do it at the end.

First and foremost, I'd like some feedback on what you guys think of it thus far. Obviously I have a long way to go.

Secondly, I was wondering if there's any coding that could be trimmed down, I noticed you guys suggested it a lot to other people.

Thirdly, for the actual quiz itself, since the user gets mroe than one guess (i'm going ot allow a total of 3 per question with about 10 questions in total) I was wondering how to actually do it. I haev a very vague idea in the form of case selection, but I'm not sure how that'd work out. Also for the actual scoring, should I do it number of correct questions divided by total questions, minus five percent for every extra attempt taken or something more simple.

I know how to do accumulators and counters - or atleast I did, I just haven't practised it in over a month.

Lastly, I was hoping someone could give me some good tips on improving it, and/or some ideas on what else I can add to 'wow' my teacher. We ARE allowed to use things that we don't know - hell I'd say about 50% of the stuff on my program we never learned, but the reason I'm eager to make my program involve many complicated things (which I understand) that we haven't learned is because there's this kid in my class who spends his entire weekend and days at home on this forum reading up on how to make stuff, and well he makes some very weird/complicated stuff that my teacher's always been praising, and I was hoping to at the least come close to that stuff Razz

Okay, so please and thank you. Smile

Also I just realized, my music doesn't work for some reason

code:
% Program by Himel Don for Mrs. Spangler's Computer Class
% Made during January 10th, 2007 and January 17th, 2007
% Culminating Project

setscreen ("graphics:600;500,position:center;center,nobuttonbar,nocursor,noecho,title:Himel's Culminating Project!")

%All user input variables are declared
var selection : int
var return1, return2 : string

%All window variables are declared
var iWindow : int := Window.Open ("graphics:600;500")
var winID1 : int
var winID2 : int
var winID3 : int
var winID4 : int

%Picture and font variables are declared
var picture : int := Pic.FileNew ("enRAGEd_cover.jpg")
var picture2 : int := Pic.FileNew ("enRAGED_covermenu.jpg")
var picture3 : int := Pic.FileNew ("enRAGED_coverhistory.jpg")
var picture4 : int := Pic.FileNew ("enRAGED_coverquiz.jpg")
var picture5 : int := Pic.FileNew ("enRAGED_covergallery.jpg")
var picture6 : int := Pic.FileNew ("gal1.jpg")
var picture7 : int := Pic.FileNew ("gal2.jpg")
var picture8 : int := Pic.FileNew ("gal3.jpg")
var picture9 : int := Pic.FileNew ("gal4.jpg")
var picture10 : int := Pic.FileNew ("gal5.jpg")
var picture11 : int := Pic.FileNew ("gal6.jpg")
var picture12 : int := Pic.FileNew ("gal7.jpg")
var picture13 : int := Pic.FileNew ("gal8.jpg")
var picture14 : int := Pic.FileNew ("enRAGED_coverquotes.jpg")
var font1 := Font.New ("Impact:11")
var font2 := Font.New ("Monotype Corsiva:10")

process playstuff
    loop
           Music.PlayFile ("Killing_In_The_Name_Of.MID")
    end loop
end playstuff

%Process that plays opening music
process play1
    sound (440, 500)
    sound (400, 500)
    sound (500, 500)
    sound (360, 500)
    sound (440, 500)
    sound (400, 500)
    sound (500, 500)
    sound (360, 500)
end play1

%Procedure for the quiz window.
%Everytime a question is answered
%this quizrefresh procedure
%is called upon.
procedure quizrefresh
    var x1, y1, x2, y2 : int
    winID2 := Window.Open ("graphics:500;400;nobuttonbar,title:Quiz,;position:top;left")

    Window.Select (winID2)
    Window.SetActive (winID2)
    Pic.Draw (picture4, 0, 0, 0)
    for i : 1 .. 200
        Window.GetPosition (winID2, x1, y1)
        Window.Set (winID2, "position:" + intstr (x1) + "," + intstr (y1 - 1))
        delay (10)
    end for
end quizrefresh

%Procedure for the gallery
%slideshow.
procedure gallery
    Pic.Draw (picture6, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture7, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture8, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture9, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture10, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture11, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture12, 90, 90, 0)
    delay (4500)
    Pic.Draw (picture13, 90, 90, 0)
end gallery

%Fork command to play opening music
fork play1

%Draws first screen picture
Pic.Draw (picture, 0, 0, 0)
%Delay for viewer to be allowed reasonable amount of time
%to view opening picture
delay (4000)

%Clears screen for main menu area
cls
%This procedure allows the user to navigate to and from each page.
procedure mainmenu

fork playstuff

    %Second screen contains header and instructions
    Pic.Draw (picture2, 0, 0, 0)
    %Instructions text
    Font.Draw ("This is the main menu. Read below for choices.", 167, 360, font1, black)
    Font.Draw ("After picking choice, please type selected choice.", 160, 345, font1, black)
    Font.Draw ("Please note that typed character will not appear.", 160, 330, font1, black)
    Font.Draw ("Typed character will still be recognized by program.", 155, 315, font1, black)
    %User inputs which 'page' they want to go to
    get selection
    %If statements which lead to next pages
    if selection = 1 then

        % Variables for x and y coordinates set
        var x1, y1, x2, y2 : int
        %Window one attributes set
        winID1 := Window.Open ("graphics:500;400;nobuttonbar,noecho,nocursor,title:History,;position:top;right")
        %Selects winID1
        Window.Select (winID1)
        %Sets winID1 as the active window
        Window.SetActive (winID1)
        %Draws background picture
        Pic.Draw (picture3, 0, 0, 0)
        %Looping instruction which causes the window
        %to move down via X(1,2) and Y(1,2) coordinates
        for i : 1 .. 200
            Window.GetPosition (winID1, x1, y1)
            Window.Set (winID1, "position:" + intstr (x1) + "," + intstr (y1 - 1))
            delay (10)
        end for

        get return1
        if return1 = "1" then
            Window.Close (Window.GetActive)
            mainmenu
        elsif return1 = "no" then
            put "Okay."
        end if

    elsif selection = 2 then

        quizrefresh

        get return1
        if return1 = "exit" then
            Window.Close (Window.GetActive)
            mainmenu
        elsif return1 = "1" then
            put "Okay."
        end if

    elsif selection = 3 then
        var x1, y1, x2, y2 : int
        winID3 := Window.Open ("graphics:500;400;nobuttonbar,noecho,nocursor,title:Gallery,;position:top;left")

        Window.Select (winID3)
        Window.SetActive (winID3)
        Pic.Draw (picture5, 0, 0, 0)

        get return1
        if return1 = "1" then
            gallery
            cls
            Window.Close (Window.GetActive)
            winID3 := Window.Open ("graphics:500;400;nobuttonbar,noecho,nocursor,title:Gallery,;position:top;left")

            Window.Select (winID3)
            Window.SetActive (winID3)
            Pic.Draw (picture5, 0, 0, 0)
            get return2
            if return2 = "2" then
                gallery
                cls
                Window.Close (Window.GetActive)
                winID2 := Window.Open ("graphics:500;400;nobuttonbar,noecho,nocursor,title:Gallery,;position:top;left")

                Window.Select (winID3)
                Window.SetActive (winID3)
                Pic.Draw (picture5, 0, 0, 0)
                Font.Draw ("Maximum views reached. Returning to Menu.", 167, 360, font1, white)
                delay (1000)
                Window.Close (Window.GetActive)
                mainmenu
            elsif return2 = "1" then
                gallery
                cls
                Window.Close (Window.GetActive)
                winID2 := Window.Open ("graphics:500;400;nobuttonbar,noecho,nocursor,title:Gallery,;position:top;left")

                Window.Select (winID3)
                Window.SetActive (winID3)
                Pic.Draw (picture5, 0, 0, 0)
                Font.Draw ("Maximum views reached. Returning to Menu.", 135, 150, font1, white)
                delay (2000)
                Window.Close (Window.GetActive)
                mainmenu
            else
                Window.Close (Window.GetActive)
                mainmenu
            end if
        else
            Window.Close (Window.GetActive)
            mainmenu
        end if

    elsif selection = 4 then
        var x1, y1, x2, y2 : int
        winID4 := Window.Open ("graphics:500;400;nobuttonbar,noecho,nocursor,title:Quotes,;position:center")

        Window.Select (winID4)
        Window.SetActive (winID4)
        Pic.Draw (picture14, 0, 0, 0)

        get return1
        if return1 = "1" then

            Window.Close (Window.GetActive)
            mainmenu
        else
            Window.Close (Window.GetActive)
            mainmenu
        end if
    elsif selection = 5 then
        Window.Close (iWindow)
    end if
%Ends procedure. Procedure contains entire program for full access when called upon.
end mainmenu

%Mainmenu procedure called upon.
%This is the original main menu
%that the user sees.
mainmenu

Author:  Ultrahex [ Sun Jan 14, 2007 1:21 pm ]
Post subject:  Re: Culminating Project Helpage

What i would recommend you do so we can actually use the program, is include your Pictures that are required for the program to run.

Also its probably easier to just RAR or ZIP the file, im not sure how many people have ace, i know i can open .ace files but that is another story.

After you post that i might be able to give you some ideas, (Note, its probably easier just posting your source files inside a zip/rar file)

Author:  Cervantes [ Sun Jan 14, 2007 4:04 pm ]
Post subject:  RE:Culminating Project Helpage

Just a quick comment: I highly suggest you avoid using processes. To understand why, you should read this article.

Author:  Flying_Fajita [ Wed Jan 17, 2007 12:32 am ]
Post subject:  Re: Culminating Project Helpage

Okay, I'll read that article, and here's my zipped up version of everything in WinRAR. Someone please help me by Thursday evening Eastern!!


: