Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
B9921218
Search
andyykchen923
June 25, 2014
15
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
B9921218
andyykchen923
June 25, 2014
Featured
See All Featured
Crafting Experiences
bethany
1
380
Product Roadmaps are Hard
iamctodd
55
13k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
Thoughts on Productivity
jonyablonski
76
5.4k
Transcript
電機系統組四年級 B9921218 程彥凱 機率與統計期末報告
程式碼: import random import time def 遊戲介紹():
print('您在全龍之地。在你面前,') print('你看到兩個洞。在一個山洞裡,龍是友好的') print('並且將與您分享他的財富。其他的龍') print('是貪婪和飢餓,並會吃了你.') print() def 選擇巢穴(): cave = '' while cave != '1' and cave != '2': print('哪個洞穴你會進入? (1 or 2)') cave = input() return cave
def checkCave(chosenCave): print('你正接近洞穴') time.sleep(2) print('它很黑暗和怪異...')
time.sleep(2) print('大龍跳出在你的面前!他打開他的下巴和...') print() time.sleep(2) friendlyCave = random.randint(1, 2) if chosenCave == str(friendlyCave): print('給你他的寶藏!') else: print('吞了你!')
playAgain = 'yes' while playAgain == 'yes' or
playAgain == 'y': 遊戲介紹() caveNumber = 選擇巢穴() checkCave(caveNumber)
心得: 感謝老師花那麼多心思教我們使用python,讓我了 解到要寫一個小程式是多麼的簡單,而且這個語言 貼心的結合了中文,在閱讀和撰寫程式碼的工作上 容易很多,不需要什麼太多額外的解釋,就能夠讓小 朋友也理解,因為要畢業了,系上太多活動,只能夠做 出簡單的小遊戲,裡面用到隨機塞選(二選一),還有劇 情呈現會有時間差,最後有是否重複玩的選項,選yes 則再跑一次程式碼,no則跳出視窗,身為電機系很少
碰程式的我,很高興能夠親自寫出這樣一個小遊戲, 相信這種基本架構夠熟練,很快就能夠寫出更大的 程式 !
END 謝謝教授