hashkunz / hashkunzgame Goto Github PK
View Code? Open in Web Editor NEW.py game
.py game
Can Be Contacted At Gmail | [email protected] Facebook | Ana Afdon Selamae ID Line | afdan-00 -Blowing-smiley-games- สวัสดีครับนี้เกมเป่ายิ้งฉุบที่ผมทำขึ้นมาด้วยตัวเอง ยังแก้ไม่หมดครับมันติดตรงที่การใช้ if elif ให้ถูกต้องผมยังเรียนรู้ไม่ค่อยเยอะ และโค้ดมันยาวไป ซึ่งผมรู้ว่าการที่โค้ดยาวมันไม่ดี แต่ว่าผมจะพยายามฝึกฝนให้มากกว่านี้ครับ โค้ดตัวนี้สามารถเอาไปเล่น และศึกษาได้ สำหรับคนที่กำลังฝึกเขียนเหมือนผม และผมหวังว่ามันจะเป็นประโยชน์ด้วยครับ การทำงาน คือ ให้ bot ramdom คำ 3 คำ นั้นคือ paper / scissors / hammer โดยที่ paper = 3 / scissors = 2 / hammer = 6 แล้วให้ person input ค่าจากแป้นพิมพ์มา 1 ค่า โดยมีตัวเลือก 3 ตัวเลือก 1,2,3 1 คือ paper 2 คือ scissors 3 คือ hammer จากนั้น เอาค่าของ bot+person มีความเป็นไปได้ที่จะออก 6 ค่าด้วยกัน นั้นคือ 5,9,8 ( 3 ค่านี้จะมีฝ่าย ชนะกับแพ้ ) ซึ่งค่านี้จะมีความเป็นไปได้สองแบบนั้นคือ bot=3 + person=2 หรือ bot=2 + person=3 จะได้ 5 เหมือนกัน และ 6,4,12 ( 3 ค่านี้จะมีผลคือ เสมอกัน) จากนั้นจะไปแยกและคำนวณ bot+person เช่น bot = 3 / person = 2 / บวกกันเท่ากับ 5 แล้วให้โปรแกรมดูว่า bot กับ person อันไหนมีค่าน้อยกว่า ซึ่ง ตัวที่น้อยกว่าจะชนะ เพราะว่า 3=paper(กระดาษ) 2=scissors(กรรไกร) กรรไกรตัดกระดาษ และถ้า bot+person = 9,8 ก็จะทำงานคลายๆครับ แค่เปลี่ยนตรงที่ เครื่องหมายมากกว่าและน้อยกว่า ทั้งหมดนี้เป็นการใช้ if elif หลายบรรทัดซึ่งอาจจะทำให้สับสนว่า แต่ละเงือนไข สิ้นสุดตรงบรรทัดไหน
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.