91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

最新東北大學(xué)Python程序設(shè)計實驗代碼(含報告,不含綜合作業(yè)),項目包括:井字棋、人口數(shù)據(jù)特征間的關(guān)系、 P2P網(wǎng)絡(luò)貸款數(shù)據(jù)、插補用戶用電量數(shù)據(jù)缺失值、wine和wine_quality 數(shù)據(jù)集分類及回歸分析。僅供學(xué)習(xí)交流和參考 綜合作業(yè)鏈接:https://blog.csdn.net/momentni/article/details/109262120

資源截圖

代碼片段和文件信息

import?tkinter?as?tk
import?random

#?勝利的走法
win_chess?=?[[0?4?8]?[2?4?6]?[0?1?2]?[3?4?5]?[6?7?8]?[0?3?6]?[1?4?7]?[2?5?8]]
#?最佳下棋順序
best_way?=?[4?0?2?6?8?1?3?5?7]
#?棋盤
chess?=?[0?0?0?0?0?0?0?0?0]
the_chess?=?[0?0?0?0?0?0?0?0?0]??#?記錄棋盤
show_chess?=?‘‘
flag?=?True
who?=?1
count_x?=?0
count_y?=?0
count_z?=?0

top?=?tk.Tk()
top.title(‘人機井字棋‘)
top.geometry(“300x300“)
top.resizable()
show_str?=?tk.StringVar(top)
tips?=?tk.StringVar(top)??#?提示信息


def?init_ch():
????#?初始化棋盤
????for?j?in?range(9):
????????the_chess[j]?=?0
????update_chess()
????return?the_chess


def?update_chess():
????#?更新棋盤
????for?k?in?range(9):
????????if?the_chess[k]?==?1:
????????????ch[k].set(‘[X]‘)
????????elif?the_chess[k]?==?-1:
????????????ch[k].set(‘[O]‘)
????????else:
????????????ch[k].set(‘[?]‘)


def?ai_go_first():
????if?count_zero(the_chess)?==?9:
????????the_chess[random.randint(0?8)]?=?-1
????update_chess()
????ai_go_fir_b.pack_forget()


def?but1():
????#?人機對戰(zhàn)
????init_ch()
????tips.set(““)
????l0.bind(““?touch_l0)
????l1.bind(““?touch_l1)
????l2.bind(““?touch_l2)
????l3.bind(““?touch_l3)
????l4.bind(““?touch_l4)
????l5.bind(““?touch_l5)
????l6.bind(““?touch_l6)
????l7.bind(““?touch_l7)
????l8.bind(““?touch_l8)
????ai_go_fir_b.pack(side=tk.RIGHT)


def?ai_go(w):
????#?機器走棋
????if?count_zero(the_chess)?????????po?=?is_danger(the_chess?1)
????????if?po?!=?-1:
????????????the_chess[po]?=?w
????????????update_chess()
????????elif?not?constraint(w):
????????????pass
????????else:
????????????the_chess[get_next_o(the_chess?-1)]?=?w
????????????update_chess()
????????if?is_win(the_chess?-1)?==?-1:
????????????tips.set(“你輸了!“)
????if?count_zero(the_chess)?==?0:
????????tips.set(“平局!“)


def?constraint(w):
????#?判斷是否處于危險狀態(tài)
????po?=?is_danger(the_chess?-1)
????if?po?!=?-1:
????????the_chess[po]?=?w
????????update_chess()
????????return?False
????return?True


def?peo_go(po):
????#?獲取按鍵并下棋
????if?the_chess[po]?==?0:
????????the_chess[po]?=?who
????????update_chess()
????????if?is_win(the_chess?who)?==?who:
????????????tips.set(‘你贏了!‘)
????????elif?count_zero(the_chess)?==?0:
????????????tips.set(“平局!“)
????????else:
????????????ai_go(who?*?-1)


def?is_win(now_chess?who):
????“““
????判斷游戲方(who)是否贏局
????“““
????temp?=?now_chess[:]
????for?chess?in?win_chess:
????????if?(temp[chess[0]]?==?who)?and?(temp[chess[1]]?==?who)?and?(temp[chess[2]]?==?who):
????????????return?who
????return?0


def?count_zero(now_chess):
????“““
????統(tǒng)計剩余格子
????“““
????temp?=?now_chess[:]
????count?=?0
????for?te?in?temp:
????????if?te?==?0:
????????????count?=?count?+?1
????return?count


def?evaluation(now_chess):
????“““
????估價函數(shù)(以X為對象)
????可以贏的行數(shù)?+1
????可以贏的行數(shù)上有自己的棋子?+2
????可導(dǎo)致自己贏?+2
????可導(dǎo)致對手贏?-2
????“““
????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-10-23?19:34??Python程序設(shè)計實驗\
?????目錄???????????0??2020-10-23?19:22??Python程序設(shè)計實驗\1\
?????文件????????8062??2019-12-05?18:42??Python程序設(shè)計實驗\1\人機井字棋.py
?????目錄???????????0??2020-10-23?19:22??Python程序設(shè)計實驗\2.1\
?????文件???????35345??2019-12-25?15:43??Python程序設(shè)計實驗\2.1\1996-2015年各特征人口箱線圖.png
?????文件???????77656??2019-12-25?15:43??Python程序設(shè)計實驗\2.1\1996~2015年人口數(shù)據(jù)特征間關(guān)系散點圖和折線圖.png
?????文件???????44166??2019-12-25?15:43??Python程序設(shè)計實驗\2.1\1996年和2015年各類人口直方圖.png
?????文件???????56466??2019-12-25?15:43??Python程序設(shè)計實驗\2.1\1996年和2015年各類人口餅圖.png
?????文件????????4011??2019-12-25?15:43??Python程序設(shè)計實驗\2.1\2.1代碼.py
?????文件????????2313??2018-03-20?22:37??Python程序設(shè)計實驗\2.1\populations.npz
?????目錄???????????0??2020-10-23?19:22??Python程序設(shè)計實驗\2.2\
?????文件????????3597??2019-12-25?16:21??Python程序設(shè)計實驗\2.2\2.2代碼.py
?????文件????18962271??2019-12-25?16:24??Python程序設(shè)計實驗\2.2\Training_LogInfo.csv
?????文件????20322725??2016-03-02?19:10??Python程序設(shè)計實驗\2.2\Training_Master.csv
?????文件????15323941??2016-02-23?18:35??Python程序設(shè)計實驗\2.2\Training_Userupdate.csv
?????文件????????9152??2018-03-21?14:25??Python程序設(shè)計實驗\2.2\文件說明.xlsx
?????目錄???????????0??2020-10-23?19:22??Python程序設(shè)計實驗\2.3\
?????文件????????3033??2019-12-26?16:18??Python程序設(shè)計實驗\2.3\2.3代碼.py
?????文件?????????809??2016-08-18?14:32??Python程序設(shè)計實驗\2.3\alarm.csv
?????文件????????1846??2018-03-21?13:45??Python程序設(shè)計實驗\2.3\ele_loss.csv
?????文件?????????586??2019-12-26?16:31??Python程序設(shè)計實驗\2.3\missLagrange.csv
?????文件?????????493??2019-12-22?20:34??Python程序設(shè)計實驗\2.3\missing_data.csv
?????文件????????3006??2019-12-22?21:25??Python程序設(shè)計實驗\2.3\model.csv
?????目錄???????????0??2020-10-23?19:22??Python程序設(shè)計實驗\2.4\
?????文件???????11634??2019-12-26?22:53??Python程序設(shè)計實驗\2.4\2.4代碼.py
?????文件???????20012??2019-12-26?22:54??Python程序設(shè)計實驗\2.4\ROC曲線.png
?????文件???????10958??2018-03-20?21:05??Python程序設(shè)計實驗\2.4\wine.csv
?????文件???????84199??2018-03-20?20:56??Python程序設(shè)計實驗\2.4\winequality.csv
?????文件??????109420??2019-12-26?22:54??Python程序設(shè)計實驗\2.4\梯度提升回歸樹模型預(yù)測結(jié)果.png
?????文件??????106068??2019-12-26?22:54??Python程序設(shè)計實驗\2.4\線性回歸模型預(yù)測結(jié)果.png
?????文件???????51712??2019-12-26?22:54??Python程序設(shè)計實驗\2.4\輪廓系數(shù)折線圖.png
............此處省略1個文件信息

評論

共有 條評論