Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Hangman in fortran

  1. Apr 7, 2010 #1
    Hello all,

    I am attempting to make a fortran program that allows the user to play a game of hangman. So far I have written a complete program that assembles piece by piece the base, gallows, rope, body parts, etc.. I have another completely separate program that reads from a file 264 random 8-letter words. The user inputs a number that corresponds to the word on that line in the file and the program slowly reveals the word as letters are guessed. Initially I have the word show up as eight stars (********). As the user guesses correctly, the appropriate letters are revealed.

    The part I am having trouble with is combining these two programs to work in tandem. I have been told that I should be using two subroutines, where one of the subroutines is the program that develops the picture and the other subroutine is used to analyze the players letter guess and only call the first subroutine if the users guess is incorrect.

    My biggest issue is not knowing how to reference one of the subroutines without the CALL statement going through all the picture code or all of the word code.

    Any help on how to integrate these two programs would be greatly appreciated.
  2. jcsd
  3. Apr 7, 2010 #2
    If I understand it right, then I think you will have to go through both subroutines.
    In fortran90 there is a mask which is used for array and vector functions.
    Maybe you could apply a mask to known or unknown letters.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook