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
B0129034_方湛恩_PYTHON
Search
Samuel Fang
June 19, 2014
82
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
B0129034_方湛恩_PYTHON
Samuel Fang
June 19, 2014
Featured
See All Featured
Building an army of robots
kneath
307
47k
Visualization
eitanlees
153
17k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Navigating Weather and Climate Data
rabernat
0
560
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
520
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Automating Front-end Workflow
addyosmani
1369
210k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
67k
Transcript
B0129034 方湛恩 fourinarow
這是把英文轉 成中文的部分 不然程式會認 不出來 還有設定一些背景, 啟動函式,事件取得函式, …等等
這是main函式 裡面宣告了硬幣 的圖片來源, 一 開始的箭頭方向
遊戲開始, 先用亂 數決定誰先開始, 0是電腦,1是玩家 再引入贏家的函式, 設定贏的一方的美術圖 下面的while迴圈是 持續迴圈直到玩家 操控滑鼠點擊, 放開
利用板[ ][ ]的2維array 去裝玩家指定的值 If迴圈用來假設 沒有額外棋子的狀況 還有用取得新面板 這個函式來刷新面板
讓玩家移動函式 利用X,Y來抓位子 然後用if迴圈來做 後續的判斷
這裡可以調整 棋子的落下 動畫速度 跟電腦棋子的 移動速度
取得電腦移動的函式 跟設定其AI保證 有最佳移動法 潛在的移動這個函式 就是表示還可以動的空間
If板[欄][y]==空 則回傳到y 否則回傳-1 確認是否是有效移動 回傳T, F(類似bool) 確認是否版面滿了 回傳T, F (類似bool)
這裡的瓦就是 有占有空間的意思 原諒我用google翻譯 還懶得改哈哈 檢查所有的格子 是否已經有棋子