How to make a Python game only using your iPhone.
Have you ever wanted to code your own game but you do not have a good computer? Now you can code straight from your iPhone without jailbreaking or anything. There is a covert app on the AppStore that let’s you access your iPhone command line. Keep reading to learn how to harness hacking-like abilities from your phone!
Odds are you friends will not understand and will be impressed with your new black hat skills. Little do they know, this is not hacking but merely a covert trick. Actually this is nothing special at all because all computers even smart fridges have the ability to run code.
How to install iSH on iPhone
Step 1 Navigate to the AppStore and hit the “Get” button. You may need to sign in to your Apple ID for the app to download -> https://apps.apple.com/us/app/ish-shell/id1436902243
Step 2 Now you have full access to your iPhone from the command line. Anything is possible such as coding your own game or web server. Read more to learn how to make a game.
Make Rock Paper Scissors on iPhone
Step 1 Install python code libraries so you can run your game. apk add python3
Step 2 Create a new file by using the following command. vi game.py
. This command will open up a file editor so you can type python code. Keep reading to learn how to write the python code.
Step 3 Type in the following code to ask the player for their name. Then line 2 will print their name to make the game personal. After, the code is typed in, press the 3rd icon button on the keyboard. Then type :wq
and press return
on your keyboard.
Step 4 Test your game works before coding too much. Run your game by typing python3 game.py
into the terminal. If it works, you will see the question you wrote in step 3. Type your name in and press return
on your keyboard. Now, watch you name appear on the screen!
Step 5 Add the rest of the code. Make sure you copy the code perfectly or it will not work. First you need to reopen your text editor by running vi game.py
again.
name = input("What is you name?: ")
print(f"Hello, {name} let's play rock, paper, scissors!")
import random
rps = ["rock", "paper", "scissors"]
ai_score = 0
user_score = 0
while (True):
user = (input("Rock, Paper, or Scissors?: ")).strip().lower()
ai = random.choice(rps)
if user == "rock":
if ai == "paper":
print("Paper beats rock, you lose!")
ai_score += 1
else:
print(f"Rock beats {ai}, you win!")
user_score += 1
elif user == "paper":
if ai == "scissors":
print("Scissors beats paper, you lose!")
ai_score += 1
else:
print(f"Paper beats {ai}, you win!")
user_score += 1
elif user == "scissors":
if ai == "rock":
print("Rock beats scissors, you lose!")
ai_score += 1
else:
print(f"Scissors beats {ai}, you win!")
user_score += 1
elif user == "quit":
print(f"Total score: ai={ai_score}, user={user_score}")
print("Bye!")
exit()
else:
print("You lose! Choose rock, paper, or scissors.")
Step 6 Play the game and share your results on Twitter or YouTube! I beat the AI on my phone 12:3. Who can hack the best game of rock, paper, scissors on iPhone?
Conclusion
Covert apps on the app store let you write hacks and games using Python. What can you make? If you made a better game, you are on your way to becoming a black hat hacker!
Read more: Check out other posts.
What do you think?Cancel reply