I made a bin picking game with Python

I made a game called a bin-picking game in Python. However, it is very weak because it only randomly decides how many to take ...

code

BottlePickingGame.py


import random
import time
import sys

print("""
Start the bin picking game. What is a bottle-picking game?
Decide the number of bottles and take the bottles alternately,
The person who took the last bottle loses.
The minimum number of bottles is 15
You can take one, two, or three at a time.
""")

time.sleep(2)
Number=0
while 15>Number:
    try:
        Number=int(input("How many bottles do you want?\n"))

        if 15>Number: 
            print("The minimum number of bottles is 15")
    except ValueError:
        print("Please enter an integer in half-width numbers")
remaining=0
remaining=int(remaining)
turn=0
take=0
take=int(take)
print("\n\n start the game")
time.sleep(1)
while Number>=remaining:
    print("\n The remaining number is",Number-remaining,"It's a book",sep="")
    time.sleep(0.5)
    print("\n It's your turn")
    turn=0
    take=0
    time.sleep(0.5)
    while take>3 or 0>=take:
        try:
            take=int(input("How many bottles do you take?\n"))
            if take>3 or 0>=take:
                print("The number that can be taken is 1 to 3")
        except ValueError:
            print("Please enter an integer in half-width numbers")
    remaining=remaining+take
    print("\n The remaining number is",Number-remaining,"It's a book",sep="")
    if remaining>=Number:
        break
    time.sleep(0.8)
    print("\It's nCP's turn")
    turn=1
    if Number>remaining+3:
        take=random.randint(1,3)
        take=int(take)
    elif Number>remaining+2:
        take=2
        take=int(take)
    elif Number>remaining+1:
        take=1
        take=int(take)
    else:
        take=1
        take=int(take)
    remaining=remaining+take
    time.sleep(0.5)
    print(take, "I took the book",sep="")
    if remaining>=Number:
        break
if turn==0:
    time.sleep(0.5)
    print("\n\n you lose...")
else:
    time.sleep(0.5)
    print("\n\n you win!!")
time.sleep(1)
print("End the game")
time.sleep(5)
sys.exit(0)

Recommended Posts

I made a bin picking game with Python
I made a roguelike game with Python
I made a fortune with Python.
I made a daemon with Python
I made a Christmas tree lighting game with Python
I made a simple typing game with tkinter in Python
〇✕ I made a game
I made a character counter with Python
I made a puzzle game (like) with Tkinter in Python
I made a Hex map with Python
I made a life game with Numpy
I made a simple blackjack with Python
I made a configuration file with Python
I made a neuron simulator with Python
I made a competitive programming glossary with Python
I made a weather forecast bot-like with Python.
I made a GUI application with Python + PyQt5
I made a Twitter fujoshi blocker with Python ①
I want to make a game with Python
[Python] I made a Youtube Downloader with Tkinter.
I made a Mattermost bot with Python (+ Flask)
I made blackjack with python!
I made a python text
I made wordcloud with Python.
I made a Twitter BOT with GAE (python) (with a reference)
I made a vim learning game "PacVim" with Go
I made a net news notification app with Python
I made a LINE BOT with Python and Heroku
I made a falling block game with Sense HAT
I made a Line-bot using Python!
I made a package to filter time series with python
I made a simple book application with python + Flask ~ Introduction ~
I tried a stochastic simulation of a bingo game with Python
Let's make a shiritori game with Python
I made a payroll program in Python!
I drew a heatmap with seaborn [Python]
I tried a functional language with Python
What I did with a Python array
I made a stamp generator with GAN
After studying Python3, I made a Slackbot
I made a WEB application with Django
Life game with Python [I made it] (on the terminal & Tkinter)
I made a simple circuit with Python (AND, OR, NOR, etc.)
I made a library to easily read config files with Python
I made a package that can compare morphological analyzers with Python
I made a Nyanko tweet form with Python, Flask and Heroku
I made a lot of files for RDP connection with Python
I made a shuffle that can be reset (reverted) with Python
I made a segment tree with python, so I will introduce it
I made a stamp substitute bot with line
I made a python dictionary file for Neocomplete
[Python] Make a game with Pyxel-Use an editor-
I made a tool to automatically browse multiple sites with Selenium (Python)
I tried playing a typing game in Python
Procedure for creating a LineBot made with Python
[Python] Make a simple maze game with Pyxel
I made a simple Bitcoin wallet with pycoin
I made a LINE Bot with Serverless Framework!
I tried to discriminate a 6-digit number with a number discrimination application made with python
I made a tool that makes decompression a little easier with CLI (Python3)
I made a random number graph with Numpy