導航:首頁 > 編程語言 > 基於Python的黑白棋設計

基於Python的黑白棋設計

發布時間:2022-10-20 08:50:42

1. 用VB編一個黑白棋

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim X As String
Dim Y As String
Dim m As Integer
Dim n As Integer
Private Sub Command1_Click()
Label1.Caption = "該黑棋" & gamer1 & "走"
blackwhite = True
heiqi = True
Picture1.Cls
For i = 5 To -5 Step -1
Picture1.Line (-4.5, i - 0.5)-(4.5, i - 0.5)
QBColor (0)
Picture1.Line (i - 0.5, -4.5)-(i - 0.5, 4.5)
QBColor (0)
Next
For j = -4 To 4 Step -1
For k = -4 To 4 Step -1
a(j, k) = 0
Next
Next
a(j, k) = 0
Picture1.FillStyle = 0
Picture1.FillColor = QBColor(0)
Picture1.Circle (0, 0), 0.3, QBColor(0)
Picture1.Circle (1, 1), 0.3, QBColor(0)
Picture1.FillColor = QBColor(15)
Picture1.Circle (0, 1), 0.3, QBColor(15)
Picture1.Circle (1, 0), 0.3, QBColor(15)
End Sub

Private Sub Form_Load()
Form2.Picture1.Scale (-5, 5)-(5, -5)
Text1.Text = ""
End Sub

Private Sub kaishi_Click()
Label1.Caption = "該黑棋" + gamer1 + "走"
blackwhite = True
heiqi = True
Picture1.Cls
For i = 5 To -5 Step -1
Picture1.Line (-4.5, i - 0.5)-(4.5, i - 0.5)
QBColor (0)
Picture1.Line (i - 0.5, -4.5)-(i - 0.5, 4.5)
QBColor (0)
Next
For j = -4 To 4 Step -1
For k = -4 To 4 Step -1
a(j, k) = 0
Next
Next
a(j, k) = 0
Picture1.FillStyle = 0
Picture1.FillColor = QBColor(0)
Picture1.Circle (0, 0), 0.3, QBColor(0)
Picture1.Circle (1, 1), 0.3, QBColor(0)
Picture1.FillColor = QBColor(15)
Picture1.Circle (0, 1), 0.3, QBColor(15)
Picture1.Circle (1, 0), 0.3, QBColor(15)
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If CInt(X) >= -4 And CInt(Y) >= -4 And heiqi = True Then
m = CInt(X)
n = CInt(Y)
Picture1.FillStyle = 0
If blackwhite = True And a(CInt(X), CInt(Y)) = 0 Then
Picture1.FillColor = QBColor(0)
Picture1.Circle (CInt(X), CInt(Y)), 0.3, QBColor(0)
a(CInt(X), CInt(Y)) = 1
Label1.Caption = "該白棋" & gamer2 & "走"
blackwhite = Not blackwhite
End If
If blackwhite = False And a(CInt(X), CInt(Y)) = 0 Then
Picture1.FillColor = QBColor(15)
Picture1.Circle (CInt(X), CInt(Y)), 0.3, QBColor(15)
a(CInt(X), CInt(Y)) = 2
Label1.Caption = "該黑棋" & gamer1 & "走"
blackwhite = Not blackwhite
End If
End If
'反轉棋子
For i = 1 To 7
For j = 0 To i - 1
If a(CInt(X), CInt(Y)) = 1 And a(CInt(X) - i, CInt(Y)) = 1 And a(CInt(X) - i + j, CInt(Y)) = 2 Then
a(CInt(X) - i + j, CInt(Y)) = 1
End If
If a(CInt(X), CInt(Y)) = 1 And a(CInt(X), CInt(Y) - i) = 1 And a(CInt(X), CInt(Y) - i + j) = 2 Then
a(CInt(X), CInt(Y) - i + j) = 1
End If
If a(CInt(X), CInt(Y)) = 2 And a(CInt(X) - i, CInt(Y)) = 2 And a(CInt(X) - i + j, CInt(Y)) = 1 Then
a(CInt(X) - i + j, CInt(Y)) = 2
End If
If a(CInt(X), CInt(Y)) = 2 And a(CInt(X), CInt(Y) - i) = 2 And a(CInt(X), CInt(Y) - i + j) = 1 Then
a(CInt(X), CInt(Y) - i + j) = 2
End If
Next
Next

2. 我最近對游戲編程很有意思我想問一下用python與pygame可以做到什麼程度,是只能做那種比較低端的游戲么。

pygame不是做頁游的,要做網游也不能只用pygame。
pygame可以用來做2d的游戲。

要用python做3d的游戲的話,有panda和blender,另外ogre也有python的api。
至於游戲低端不低端,我感覺主要是游戲設計決定的,不論用多麼好的引擎、多麼好的材質做一個shoot'em up的游戲,都不會給人高端的感覺吧。

3. python 編程的順序問題

不知你有沒有其他的編程語言的經驗。
Python的語言靈活性很強,你可以選擇一本Python入門教材,安裝好Python後,按著教材的順序邊學邊練習。
當有一定程度的了解後,你可以試著給自己出個題,比如「猜數字游戲」這類的題目。
或者可以嘗試多寫一些小工具。

對於任何語言,邊學變練才是最重要的

4. python 小白覺得很迷茫 怎樣才能實現下棋的步驟 即怎樣實現讓『X』和『0』出現在『』棋盤『』里

如果是針對android的話,需要安裝安卓環境,使用monkeyrunner,可以做一些 點擊 輸入 拖拽等模擬測試動作

5. 我想用python做一個飛行棋的游戲,用graphics作界面,然後我要把一張飛行棋的棋盤的圖片做背景,要怎麼辦

建議你用pygame,封裝好了很多功能。就不用重寫了。

6. 基於python的畢業設計題目是什麼

如下:

1基於MapRece的氣候數據的分析

2基於關鍵詞的文本知識的挖掘系統的設計與實現

3基於概率圖模型的蛋白質功能預測

4基於第三方庫的人臉識別系統的設計與實現

5基於hbase搜索引擎的設計與實現

6基於Spark-Streaming的黑名單實時過濾系統的設計與實現

7客戶潛在價值評估系統的設計與實現

8基於神經網路的文本分類的設計與實現

9基於Apriori的商品關聯關系分析與挖掘

10基於詞頻統計的中文分詞系統的設計與實現

11 K-means演算法在微博數據挖掘中的應用

12圖像對象檢測分析系統的研究和應用

13基於Apriori關聯規則的電子商務潛在客戶的數據挖掘

14基於Spark的電商用戶行為分析系統的設計與實現

15音樂推薦系統的研究與應用

16基於大數據的高校網路輿情監控引導系統的研究與應用

17基於醫療大數據的腫瘤疾病模式分析與研究

18基於支持向量機的空間數據挖掘及其在旅遊地理經濟中的應用

19基於深度殘差網路的糖尿病視網膜病變分類檢測研究

20基於大數據分析的門戶信息推薦系統

21 Web數據挖掘及其在電子商務中的研究與應用

7. 如何用python turtle畫一個中國象棋的棋盤

#繪制棋盤,每個格子50
importturtle
t=turtle.Pen()
bs=50
#畫直線
defline(x,y,z):
t.penup()
t.goto(x,y)
t.pendown()
t.fd(z)

#兩點直線
defany(a,b,c,d):
t.penup()
t.goto(a,b)
t.pendown()
t.goto(c,d)

#畫L型
deftypeL(x,y):


t.penup()
t.goto(x-bs*0.25,y+bs*0.075)
t.pendown()
t.goto(x-bs*0.075,y+bs*0.075)
t.goto(x-bs*0.075,y+bs*0.25)
t.penup()
t.goto(x-bs*0.25,y-bs*0.075)
t.pendown()
t.goto(x-bs*0.075,y-bs*0.075)
t.goto(x-bs*0.075,y-bs*0.25)

t.penup()
t.goto(x+bs*0.25,y+bs*0.075)
t.pendown()
t.goto(x+bs*0.075,y+bs*0.075)
t.goto(x+bs*0.075,y+bs*0.25)
t.penup()
t.goto(x+bs*0.25,y-bs*0.075)
t.pendown()
t.goto(x+bs*0.075,y-bs*0.075)
t.goto(x+bs*0.075,y-bs*0.25)

#畫半L型
deftypehL(x,y,z):
if(z=='l'):
t.penup()
t.goto(x-bs*0.25,y+bs*0.075)
t.pendown()
t.goto(x-bs*0.075,y+bs*0.075)
t.goto(x-bs*0.075,y+bs*0.25)
t.penup()
t.goto(x-bs*0.25,y-bs*0.075)
t.pendown()
t.goto(x-bs*0.075,y-bs*0.075)
t.goto(x-bs*0.075,y-bs*0.25)
if(z=='r'):
t.penup()
t.goto(x+bs*0.25,y+bs*0.075)
t.pendown()
t.goto(x+bs*0.075,y+bs*0.075)
t.goto(x+bs*0.075,y+bs*0.25)
t.penup()
t.goto(x+bs*0.25,y-bs*0.075)
t.pendown()
t.goto(x+bs*0.075,y-bs*0.075)
t.goto(x+bs*0.075,y-bs*0.25)

#畫橫線


p=bs*4.5
while(p>=-bs*4.5):
line(-bs*4,p,bs*8)
p=p-bs
any(bs*4,bs*4.5,bs*4,-bs*4.5)
any(-bs*4,bs*4.5,-bs*4,-bs*4.5)
t.right(90)
q=-bs*3
while(q<bs*4):
line(q,bs*4.5,bs*4)
q=q+bs

q=-bs*3
while(q<bs*4):
line(q,-bs*0.5,bs*4)
q=q+bs

#畫斜線
any(-bs,-bs*4.5,bs,-bs*2.5)
any(bs,-bs*4.5,-bs,-bs*2.5)
any(-bs,bs*4.5,bs,bs*2.5)
any(bs,bs*4.5,-bs,bs*2.5)
#畫L型
typeL(-bs*2,-bs*1.5)
typeL(0,-bs*1.5)
typeL(bs*2,-bs*1.5)
typeL(-bs*2,bs*1.5)
typeL(0,bs*1.5)
typeL(bs*2,bs*1.5)
typeL(-bs*3,-bs*2.5)
typeL(bs*3,-bs*2.5)
typeL(-bs*3,bs*2.5)
typeL(bs*3,bs*2.5)
typehL(-bs*4,-bs*1.5,'r')
typehL(bs*4,-bs*1.5,'l')
typehL(-bs*4,bs*1.5,'r')
typehL(bs*4,bs*1.5,'l')
turtle.done()

8. 用python 語言就能開發游戲嗎

當然,不用庫就可以開發各種控制台小游戲,比如黑白棋,五子棋之類的。
用pygame庫就能開發更復雜的游戲。

9. 除了Pygame外,還有哪些適合Python的游戲引擎

如果游戲的中心是一個邏輯,比如戰斗類型的,牽扯到拓撲人物,以及人物數據,環境數據。
然後就是其中的演算法
游戲還得有個故事。當然主要看你的目的。
其次還有些配音。文字。之類的。
理論上pygame不能做rpg這種貨色,如果對畫質要求高的 話。
黑白棋五子棋。這也是游戲啊。主要是邏輯。和規則。

10. 求 Python 3.3 黑白棋源代碼 郵箱:lkntck16@ gmail.com 萬分感謝

這個頁面上可以下載的,
Python 黑白棋源代碼
http://down.51cto.com/data/139878

閱讀全文

與基於Python的黑白棋設計相關的資料

熱點內容
皓強工具解壓步驟 瀏覽:688
部隊抗洪搶險命令範文 瀏覽:886
歐姆龍plc編程軟體使用教程 瀏覽:592
ai文件pdf 瀏覽:911
騰訊雲伺服器掛載混合雲 瀏覽:758
智能小車用什麼單片機 瀏覽:463
java怎麼給窗口關閉 瀏覽:940
列舉51單片機的定址方式 瀏覽:706
剪輯app怎麼寫長篇文字 瀏覽:400
app專屬流量過月租怎麼不更新 瀏覽:654
王者程序員都有誰 瀏覽:76
給牛換腳掌解壓 瀏覽:387
圍棋有多少種演算法 瀏覽:602
unity資源包在哪個文件夾 瀏覽:704
阿里雲伺服器遠程鏈接不成功 瀏覽:482
文件系統pdf 瀏覽:767
原神安卓區服什麼意思 瀏覽:37
貝殼app怎麼線上發布 瀏覽:161
如何挑選安卓系統機頂盒 瀏覽:55
安卓快充使用有什麼注意事項 瀏覽:911