Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🪙 Flip a coin in Python!

This project is not frequently updated.

A basic coin flip game in Python that runs in the terminal. Play as many rounds of heads and tails against the computer as you'd like and then export your results to a text file.

Preview -

(£) Coin Flip (v1.1.2)
Type 'exit' at any time to exit.
------------------------------------------------------------
Round 1 - Heads or tails? Heads
Correct! It was heads
------------------------------------------------------------
Round 2 - Heads or tails? idk
(!) Please enter 'heads' or 'tails'. Type 'exit' if you want to end the game now.
Round 2 - Heads or tails? tails
Correct! It was tails
------------------------------------------------------------
Round 3 - Heads or tails? exit
------------------------------------------------------------
RESULTS
Won:   2
Lost:  0
Total: 2
Win%:  100.0%
------------------------------------------------------------
SAVE YOUR RESULTS
Save results? (yes/no): yes
Filename: results
Player Name: Luke
Your results have been saved!
------------------------------------------------------------
Press ENTER to exit......

Saving results

You can export your results to a .txt file. .csv file support will be added in the near future - for now, you can edit the source code in an IDE once you download it.


Customising the UI

Remember, the game runs in the terminal. You can change the colour schemes and fonts in your terminal settings.


Running the code

The code is published as open source under the MIT License. This means that it has not been compiled into a binary format. To run the code, you will need to download Python.


Debug Mode (advanced)

Debug mode generates a log tracing variables after each round to help you debug logic errors. To enter this mode, you need to set the debug constant to True. The log is saved to debuglog.txt - ensure you don't already have a file with this name in the working directory.


Testing new features (advanced)

If you want to test new features, download the Coin-Flip.py file in the main branch (above). Warning - these features may not be stable.

About

🪙 Flip a coin in Python!

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages