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

Username:   Password: 
 RegisterRegister   
 Help needed for my game hangman!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MysticVegeta




PostPosted: Sat Jan 15, 2005 9:08 am   Post subject: Help needed for my game hangman!!!

Hi, I am making a hangman game for my isp and i need help with it. Like i did everything like made the dashes and other code but then theres this little problem after, how can i organise the array so that the space in the guessing word doesn't appear and you dont hab to fill that in. here's my code:

code:
var letter, word : string
var chars, q : int := 0
var words : array 1 .. 5 of string := init ("One", "Two", "Three", "Four", "Five")
word := words (Rand.Int (1, 5))
locate (6, 1)
put word

var WordArray : array 1 .. length (word) of string
for a : 1 .. length (word)
    WordArray (a) := "_"
end for

loop
    for a : 1 .. length (word)
        locate (3, a * 5)
        put WordArray (a) ..
    end for

    locate (1, 1)
    get letter

    if index (word, letter) >= 0 then
        locate (6, 5 + chars)
        put letter
        chars := chars + 2
    end if

    % put letter

    for b : 1 .. length (word)
        if letter = word (b) then
            WordArray (b) := letter
        end if
    end for
end loop

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Jan 15, 2005 11:25 pm   Post subject: (No subject)

well since you're usually guessing a phrase, not a single word... (movie titles, etc) it might be a good idea to make each word to be guessed an array of its own (flexable arrays will make it really easy)
MysticVegeta




PostPosted: Sun Jan 16, 2005 9:40 am   Post subject: (No subject)

tony wrote:
well since you're usually guessing a phrase, not a single word... (movie titles, etc) it might be a good idea to make each word to be guessed an array of its own (flexable arrays will make it really easy)

Thanks, i will try it, i knew i saw somewhere saw a tut for Flexible Arrays, i will search for it. If i am able to master it till the isp is due then i will use them otherwise i will just use .. "harrypotter" lol. Oh can you give me an example pls.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: