Re: Can someone help me?

 BBS: Inland Empire Archive
Date: 12-27-92 (11:47)             Number: 197
From: BOB PERKINS                  Refer#: NONE
  To: JAMES FRAZEE                  Recvd: NO  
Subj: Re: Can someone help me?       Conf: (2) Quik_Bas
 JF> I looking for code that will 213 words as data statements
 JF> and then have the program randomly choose a word. This is
 JF> for my HangMan game.

  Here's a quick example of how to do it with 25 words.  If
I were you though, I'd put the words into a data file and
then read them into a string array instead of using DATA
statements.  Makes it worlds easier to add new words to the
game in the future!  :-)

 PRINT "Each keypress should select a random word from our list of 25 words."
 PRINT "ESC to exit."
 DO
   DO: a$ = INKEY$: LOOP UNTIL LEN(a$)
   GOSUB getnewword
   PRINT word$
 LOOP UNTIL a$ = CHR$(27)
 END

 getnewword:
 RANDOMIZE (TIMER)
 x% = INT(RND * 25) + 1
 FOR t% = 1 TO x%
   READ word$
 NEXT t%
 RESTORE
 RETURN

 DATA "one","two","three","four","five","six","seven","eight","nine"
 DATA "nine","ten","eleven","twelve","thirteen","fourteen","fifteen"
 DATA "sixteen","seventeen","eighteen","nineteen","twenty","twenty-one"
 DATA "twenty-two","twenty-three","twenty-four","twenty-five"


--- Msg V4.5
 * Origin: Reciprocity Failure  (1:124/4115.236)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET