This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Number Guessing Game in Julia | |
| # Source: https://github.com/logankilpatrick/10-Julia-Projects-for-Beginners | |
| function play_number_guess_human() | |
| total_numbers = 25 # | |
| # Generate a random number within a certain range | |
| target_number = rand(1:total_numbers) | |
| guess = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Computer Number Guessing Game in Julia | |
| # Source: https://github.com/logankilpatrick/10-Julia-Projects-for-Beginners | |
| using Random | |
| function play_number_guess_computer() | |
| print("Please enter a number between 1 and 50 for the computer to try and guess: ") | |
| # Take in the user input and convert it to a number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Rock 🗿, Paper 📃, Scissors ✂️ Game in Julia | |
| function play_rock_paper_scissors() | |
| moves = ["🗿", "📃", "✂️"] | |
| computer_move = moves[rand(1:3)] | |
| # Base.prompt is similar to readline which we used before | |
| human_move = Base.prompt("Please enter 🗿, 📃, or ✂️") | |
| # Appends a ": " to the end of the line by default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generate Passwords in Julia | |
| # Source: https://github.com/logankilpatrick/10-Julia-Projects-for-Beginners | |
| using ProgressBars | |
| using Random | |
| # WARNING: Do not use this code to generate actual passwords! | |
| function generate_passwords() | |
| num_passwords = parse(Int64, Base.prompt("How many passwords do you want to generate?")) | |
| password_length = parse(Int64, Base.prompt("How long should each password be?")) |
OlderNewer