Fortran How Can I Integrate Two Fortran Programs for a Game of Hangman?

  • Thread starter Thread starter w3390
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
The discussion centers around integrating two separate Fortran programs for a hangman game. One program constructs the visual representation of the hangman, while the other reads a list of random 8-letter words and reveals them as the player guesses letters. The main challenge is effectively combining these programs using subroutines. The user seeks guidance on how to reference one subroutine without executing the entire code of the other. A suggestion is made to utilize Fortran90's masking feature for managing known and unknown letters, which could streamline the integration process. The focus is on achieving a seamless interaction between the visual and word components of the game.
w3390
Messages
341
Reaction score
0
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.
 
Technology news on Phys.org
w3390 said:
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.

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.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...

Similar threads

Replies
59
Views
11K
Replies
8
Views
4K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
6
Views
7K
Replies
20
Views
9K
Back
Top