Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
機率統計_期末報告_.pdf
Search
tiffany1994
June 19, 2014
0
220
機率統計_期末報告_.pdf
tiffany1994
June 19, 2014
Tweet
Share
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
We Are The Robots
honzajavorek
0
160
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
How to Talk to Developers About Accessibility
jct
2
130
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
A Soul's Torment
seathinner
5
2.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
Odyssey Design
rkendrick25
PRO
1
490
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
The Language of Interfaces
destraynor
162
26k
Transcript
機率統計 (期末報告) B0129019 許婷雅
黑白棋規則 1. 兩人對奕,以輪流方式持黑子與白子。 開闢新 局者持黑子,加入者持白子。 2. 接著以輪流方式將棋子置於棋盤「」中。若無地 方可下子,則跳過一回,由對方下子。 3. 在提示的「」中,選擇一個「」下子,
當下子 的位子與離最近的同色旗子中, 若有其他棋子 則中間的棋子變為與我方一樣顏色。 4. 當下滿64個棋子,棋子多者為勝。
使用函式 • def 主程式() • def 執行程式() • def 轉換棋盤(x,
y) • def 顏色轉換(棋子替換, 棋子顏色, 附加棋子) • def 畫棋盤(棋盤) • def 取得點擊(滑鼠x, 滑鼠y) • def 畫記分板(棋盤, 玩家的顏色, 電腦的顏色, 輪到) • def 重設棋盤(棋盤)
• def 取得新棋盤() • def 是有效移動(棋盤, 棋, x開始位置, y開始位置) •
def 在棋盤上(x, y) • def 由有效移動取得棋盤(棋盤, 棋) • def 取得有效移動(棋盤, 棋) • def 取得記分板(棋盤) • def 玩家選色() • def 移動(棋盤, 棋, x開始位置, y開始位置, realMove=False)
• def 在角落(x, y) • def 取得電腦移動(棋盤, 電腦的顏色) • def
離開()
程式解釋 首先要先下載Pygame Library ,才可執行pygame遊戲 程式 1.在pygame中加上自己喜歡的音樂
2.設定螢幕大小、棋 盤、字體顏色
3.主程式 : 設定背景、棋盤、字體
4.執行程式 : 負責將所有函式 彙整過後執行
5.白棋轉黑棋、黑棋轉白棋
6.設定黑棋、白棋在棋盤上的起始位置
7. 取得點擊: 找出滑鼠點擊位置 畫記分板: 電腦、玩家分數 重設棋盤: 預設黑棋、白棋 的起始位置
8. 在移動期間,要判斷該位置是否可以走
9. 若是”有效移動” 則取得該位置 取得記分板: 設定計分方式
10.讓玩家選擇黑棋或白棋 11.玩家下棋(判斷是否有效,若有效則移動)
12.電腦移動
如何操作遊戲?
遊戲開始: 可選擇玩家為黑棋、白棋
點下Hints後可走的位置都多了咖啡色點點
遊戲結束: 顯示贏了幾分、輸了幾分
END