Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions 1A2B/client-answerdatalog.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1234
76 changes: 76 additions & 0 deletions 1A2B/game(1A2B).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import random

low,high = 0000,9999
ans = str(random.randrange(low, high,4))
print("\n")
if len(ans) < 2:
ans = "0"*3 + ans
elif len(ans) < 3:
ans = "0"*2 + ans
elif len(ans) < 4:
ans = "0" + ans
print(list(str(ans)))
#print(ans)
count = 0
ia = 0
ib =0
a = 0
b = 0
c = 0



while True:

print("\n")
guess = input("請輸入一個四位數字:\n")
if len(guess) < 4:
print("請輸入正確的數字")
elif len(guess) > 4:
print("請輸入正確的數字")
else:

ib = 0
#print(list(guess))
for x in list(str(ans)):
print(x)
ia = 0


ib = ib + 1
print(ib,"ib")
for y in list(str(guess)):
print("\t" + y + "\n")
ia = ia + 1

if x == y:

print(ia,"ia")

if ib == ia:

a = a + 1
print(a,"A")
break
if not ib == ia:
b = b + 1
print(b,"B")


else:
print("C")

if a == 4:
break
elif a == 0:
print("C")
else:
if b == 0:
print(a,"A")
else:
print(a,"A",b,"B")
a = 0
b = 0
c = 0
count = count + 1
print("目前最高分(猜最少次):",count)
176 changes: 176 additions & 0 deletions 1A2B/game(1A2B)20210724-V12-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
import random
from 海龜模組 import *
回出發點()
設定方向(0)
速度('normal')
隱藏游標()
視窗設定(400, 600)
背景顏色(0,0,0)
畫筆顏色('white')
字型 = ('標楷體',15,'normal')

'''
low,high = 0000,9999
ans = str(random.randrange(low, high,4))
print("\n")
if len(ans) < 2:
ans = "0"*3 + ans
elif len(ans) < 3:
ans = "0"*2 + ans
elif len(ans) < 4:
ans = "0" + ans
print(list(str(ans)))
'''
low,high = 0,9

ans = ""
ans1_4 = ""
answers = ""
a = 0

password = [0,1,2,3,4,5,6,7,8,9]
#password = ["0","1","2","3","4","5","6","7","8","9"]

i = 0
while i < 4:
#ans = "".join(ans)
#print(ans,"aaaaaa")
#print(i,"i")
#z = int(random.randint(low, high)) - int(a)
'''
print("111")
print(low,high)
'''
z = random.randint(low, high)
#high = (z - 1)%9
if i >= 0:
#print(password)
ans1_4 = password[z]

ans1_4 = str(ans1_4)
password.remove(password[z])
high = high - 1
#elif i == 1:
#a = random.randint(0, 1)
#if not high-low <= 0:
#if a == 0:
#print(low,high)
#ans1_4 = str(random.randint(low, high))
#elif a == 1:
#print(low,high)
#ans1_4 = str(random.randint(int(high + 2), high))
#elif high-low <= 0:
i = i + 1
#ans1_4 = str(z)
ans = ans1_4 + str(ans)
#print(ans,"answer")
answer = list(str(ans))
#print(answer)
#print(ans)
count = 0
ia = 0
ib =0
a = 0
b = 0
c = 0



while True:
print("\n")
#guest = input("請輸入一個四位數字:\n")
guest = 輸入文字('提示','請輸入一個四位數字:\n')
筆跡清除()
if len(guest) < 4:
寫字('請輸入正確的數字', align='center', font=字型)
print("請輸入正確的數字")
elif len(guest) > 4:
寫字('請輸入正確的數字', align='center', font=字型)
print("請輸入正確的數字")

else:
try:
_guest = int(guest)
except:
continue
state = True
for i in list(guest):
if list(guest).count(i) > 1:
寫字('請輸入正確且不重複的數字', align='center', font=字型)
print("請輸入正確且不重複的數字")
#continue
state = False
break

if not state:
continue
ib = 0
#print(list(guess))
for x in list(str(ans)):
#print(x)
ia = 0


ib = ib + 1
#print(ib,"ib")
for y in list(str(guest)):
#print("\t" + y + "\n")
ia = ia + 1

if x == y:

#print(ia,"ia")

if ib == ia:

a = a + 1
#print(a,"A")
break
if not ib == ia:
b = b + 1
#print(b,"B")


else:
pass
#print("C")
if a == 4:
break
elif a > 0 and b == 0:
寫字('%dA'%(a), align='center', font=字型)
print(a,"A")
elif a == 0 and b > 0:
寫字('%dB'%(b), align='center', font=字型)
print(b,"B")
elif a == 0 and b == 0:
寫字('C', align='center', font=字型)
print("C")
else:
if b == 0:
寫字('%dA'%(a), align='center', font=字型)
print(a,"A")
else:
寫字('%dA%dB'%(a,b), align='center', font=字型)
print(a,"A",b,"B")
'''
if a == 4:
pass
#break
elif a == 0:
pass
#print("C")
else:
if b == 0:
print(a,"A")
else:
print(a,"A",b,"B")
'''
a = 0
b = 0
c = 0
count = count + 1
#背景顏色(0,0,0)

寫字('目前最高分(猜最少次):', align='center', font=字型)
print("目前最高分(猜最少次):",count)
完成()
Loading