[python游戏开发]用Python代码制作中国象棋游戏,适合新手小白练手

Pygame 做的中国象棋,一直以来喜欢下象棋,写了 python 就拿来做一个试试,水平有限,希望源码能帮助大家更好的学习 python。总共分为四个文件,chinachess.py 为主文件,constants.py 数据常量,pieces.py 棋子类,走法,computer.py 电脑走法计算。 源码:在这里插入图片描述

在这里插入图片描述

chinachess.py 为主文件

import pygame
import time
import constants
import pieces
import computerclass MainGame():window \= NoneStart\_X \= constants.Start\_XStart\_Y \= constants.Start\_YLine\_Span \= constants.Line\_SpanMax\_X \= Start\_X + 8 \* Line\_SpanMax\_Y \= Start\_Y + 9 \* Line\_Spanplayer1Color \= constants.player1Colorplayer2Color \= constants.player2ColorPutdownflag \= player1ColorpiecesSelected \= Nonebutton\_go \= NonepiecesList \= \[\]def start\_game(self):MainGame.window \= pygame.display.set\_mode(\[constants.SCREEN\_WIDTH, constants.SCREEN\_HEIGHT\])pygame.display.set\_caption("天青-中国象棋")MainGame.button\_go \= Button(MainGame.window, "重新开始", constants.SCREEN\_WIDTH - 100, 300)  # 创建开始按钮self.piecesInit()while True:time.sleep(0.1)# 获取事件MainGame.window.fill(constants.BG\_COLOR)self.drawChessboard()#MainGame.button\_go.draw\_button()self.piecesDisplay()self.VictoryOrDefeat()self.Computerplay()self.getEvent()pygame.display.update()pygame.display.flip()def drawChessboard(self):mid\_end\_y \= MainGame.Start\_Y + 4 \* MainGame.Line\_Spanmin\_start\_y \= MainGame.Start\_Y + 5 \* MainGame.Line\_Spanfor i in range(0, 9):x \= MainGame.Start\_X + i \* MainGame.Line\_Spanif i==0 or i ==8:y \= MainGame.Start\_Y + i \* MainGame.Line\_Spanpygame.draw.line(MainGame.window, constants.BLACK, \[x, MainGame.Start\_Y\], \[x, MainGame.Max\_Y\], 1)else:pygame.draw.line(MainGame.window, constants.BLACK, \[x, MainGame.Start\_Y\], \[x, mid\_end\_y\], 1)pygame.draw.line(MainGame.window, constants.BLACK, \[x, min\_start\_y\], \[x, MainGame.Max\_Y\], 1)for i in range(0, 10):x \= MainGame.Start\_X + i \* MainGame.Line\_Spany \= MainGame.Start\_Y + i \* MainGame.Line\_Spanpygame.draw.line(MainGame.window, constants.BLACK, \[MainGame.Start\_X, y\], \[MainGame.Max\_X, y\], 1)speed\_dial\_start\_x \=  MainGame.Start\_X + 3 \* MainGame.Line\_Spanspeed\_dial\_end\_x \=  MainGame.Start\_X + 5 \* MainGame.Line\_Spanspeed\_dial\_y1 \= MainGame.Start\_Y + 0 \* MainGame.Line\_Spanspeed\_dial\_y2 \= MainGame.Start\_Y + 2 \* MainGame.Line\_Spanspeed\_dial\_y3 \= MainGame.Start\_Y + 7 \* MainGame.Line\_Spanspeed\_dial\_y4 \= MainGame.Start\_Y + 9 \* MainGame.Line\_Spanpygame.draw.line(MainGame.window, constants.BLACK, \[speed\_dial\_start\_x, speed\_dial\_y1\], \[speed\_dial\_end\_x, speed\_dial\_y2\], 1)pygame.draw.line(MainGame.window, constants.BLACK, \[speed\_dial\_start\_x, speed\_dial\_y2\],\[speed\_dial\_end\_x, speed\_dial\_y1\], 1)pygame.draw.line(MainGame.window, constants.BLACK, \[speed\_dial\_start\_x, speed\_dial\_y3\],\[speed\_dial\_end\_x, speed\_dial\_y4\], 1)pygame.draw.line(MainGame.window, constants.BLACK, \[speed\_dial\_start\_x, speed\_dial\_y4\],\[speed\_dial\_end\_x, speed\_dial\_y3\], 1)def piecesInit(self):MainGame.piecesList.append(pieces.Rooks(MainGame.player2Color, 0,0))MainGame.piecesList.append(pieces.Rooks(MainGame.player2Color,  8, 0))MainGame.piecesList.append(pieces.Elephants(MainGame.player2Color,  2, 0))MainGame.piecesList.append(pieces.Elephants(MainGame.player2Color,  6, 0))MainGame.piecesList.append(pieces.King(MainGame.player2Color, 4, 0))MainGame.piecesList.append(pieces.Knighs(MainGame.player2Color,  1, 0))MainGame.piecesList.append(pieces.Knighs(MainGame.player2Color,  7, 0))MainGame.piecesList.append(pieces.Cannons(MainGame.player2Color,  1, 2))MainGame.piecesList.append(pieces.Cannons(MainGame.player2Color, 7, 2))MainGame.piecesList.append(pieces.Mandarins(MainGame.player2Color,  3, 0))MainGame.piecesList.append(pieces.Mandarins(MainGame.player2Color, 5, 0))MainGame.piecesList.append(pieces.Pawns(MainGame.player2Color, 0, 3))MainGame.piecesList.append(pieces.Pawns(MainGame.player2Color, 2, 3))MainGame.piecesList.append(pieces.Pawns(MainGame.player2Color, 4, 3))MainGame.piecesList.append(pieces.Pawns(MainGame.player2Color, 6, 3))MainGame.piecesList.append(pieces.Pawns(MainGame.player2Color, 8, 3))MainGame.piecesList.append(pieces.Rooks(MainGame.player1Color,  0, 9))MainGame.piecesList.append(pieces.Rooks(MainGame.player1Color,  8, 9))MainGame.piecesList.append(pieces.Elephants(MainGame.player1Color, 2, 9))MainGame.piecesList.append(pieces.Elephants(MainGame.player1Color, 6, 9))MainGame.piecesList.append(pieces.King(MainGame.player1Color,  4, 9))MainGame.piecesList.append(pieces.Knighs(MainGame.player1Color, 1, 9))MainGame.piecesList.append(pieces.Knighs(MainGame.player1Color, 7, 9))MainGame.piecesList.append(pieces.Cannons(MainGame.player1Color,  1, 7))MainGame.piecesList.append(pieces.Cannons(MainGame.player1Color,  7, 7))MainGame.piecesList.append(pieces.Mandarins(MainGame.player1Color,  3, 9))MainGame.piecesList.append(pieces.Mandarins(MainGame.player1Color,  5, 9))MainGame.piecesList.append(pieces.Pawns(MainGame.player1Color, 0, 6))MainGame.piecesList.append(pieces.Pawns(MainGame.player1Color, 2, 6))MainGame.piecesList.append(pieces.Pawns(MainGame.player1Color, 4, 6))MainGame.piecesList.append(pieces.Pawns(MainGame.player1Color, 6, 6))MainGame.piecesList.append(pieces.Pawns(MainGame.player1Color, 8, 6))def piecesDisplay(self):for item in MainGame.piecesList:item.displaypieces(MainGame.window)#MainGame.window.blit(item.image, item.rect)def getEvent(self):# 获取所有的事件eventList \= pygame.event.get()for event in eventList:if event.type == pygame.QUIT:self.endGame()elif event.type == pygame.MOUSEBUTTONDOWN:pos \= pygame.mouse.get\_pos()mouse\_x \= pos\[0\]mouse\_y \= pos\[1\]if (mouse\_x \> MainGame.Start\_X - MainGame.Line\_Span / 2 and mouse\_x < MainGame.Max\_X + MainGame.Line\_Span / 2) and (mouse\_y \> MainGame.Start\_Y - MainGame.Line\_Span / 2 and mouse\_y < MainGame.Max\_Y + MainGame.Line\_Span / 2):# print( str(mouse\_x) \+ "" + str(mouse\_y))# print(str(MainGame.Putdownflag))if MainGame.Putdownflag != MainGame.player1Color:returnclick\_x \= round((mouse\_x - MainGame.Start\_X) / MainGame.Line\_Span)click\_y \= round((mouse\_y - MainGame.Start\_Y) / MainGame.Line\_Span)click\_mod\_x \= (mouse\_x - MainGame.Start\_X) % MainGame.Line\_Spanclick\_mod\_y \= (mouse\_y - MainGame.Start\_Y) % MainGame.Line\_Spanif abs(click\_mod\_x - MainGame.Line\_Span / 2) >= 5 and abs(click\_mod\_y \- MainGame.Line\_Span / 2) >= 5:# print("有效点:x="+str(click\_x)+" y="+str(click\_y))# 有效点击点self.PutdownPieces(MainGame.player1Color, click\_x, click\_y)else:print("out")if MainGame.button\_go.is\_click():#self.restart()print("button\_go click")else:print("button\_go click out")def PutdownPieces(self, t, x, y):selectfilter\=list(filter(lambda cm: cm.x == x and cm.y == y and cm.player == MainGame.player1Color,MainGame.piecesList))if len(selectfilter):MainGame.piecesSelected \= selectfilter\[0\]returnif MainGame.piecesSelected :#print("1111")arr \= pieces.listPiecestoArr(MainGame.piecesList)if MainGame.piecesSelected.canmove(arr, x, y):self.PiecesMove(MainGame.piecesSelected, x, y)MainGame.Putdownflag \= MainGame.player2Colorelse:fi \= filter(lambda p: p.x == x and p.y == y, MainGame.piecesList)listfi \= list(fi)if len(listfi) != 0:MainGame.piecesSelected \= listfi\[0\]def PiecesMove(self,pieces,  x , y):for item in  MainGame.piecesList:if item.x ==x and item.y == y:MainGame.piecesList.remove(item)pieces.x \= xpieces.y \= yprint("move to " +str(x) +" "+str(y))return Truedef Computerplay(self):if MainGame.Putdownflag == MainGame.player2Color:print("轮到电脑了")computermove \= computer.getPlayInfo(MainGame.piecesList)#if computer==None:#returnpiecemove \= Nonefor item in MainGame.piecesList:if item.x == computermove\[0\] and item.y == computermove\[1\]:piecemove\= itemself.PiecesMove(piecemove, computermove\[2\], computermove\[3\])MainGame.Putdownflag \= MainGame.player1Color#判断游戏胜利def VictoryOrDefeat(self):txt \=""result \= \[MainGame.player1Color,MainGame.player2Color\]for item in MainGame.piecesList:if type(item) ==pieces.King:if item.player == MainGame.player1Color:result.remove(MainGame.player1Color)if item.player == MainGame.player2Color:result.remove(MainGame.player2Color)if len(result)==0:returnif result\[0\] == MainGame.player1Color :txt \= "失败!"else:txt \= "胜利!"MainGame.window.blit(self.getTextSuface("%s" % txt), (constants.SCREEN\_WIDTH - 100, 200))MainGame.Putdownflag \= constants.overColordef getTextSuface(self, text):pygame.font.init()# print(pygame.font.get\_fonts())font \= pygame.font.SysFont('kaiti', 18)txt \= font.render(text, True, constants.TEXT\_COLOR)return txtdef endGame(self):print("exit")exit()if \_\_name\_\_ == '\_\_main\_\_':MainGame().start\_game()

constants.py 数据常量

import pygameSCREEN\_WIDTH\=900
SCREEN\_HEIGHT\=650
Start\_X \= 50
Start\_Y \= 50
Line\_Span \= 60player1Color \= 1
player2Color \= 2
overColor \= 3BG\_COLOR\=pygame.Color(200, 200, 200)
Line\_COLOR\=pygame.Color(255, 255, 200)
TEXT\_COLOR\=pygame.Color(255, 0, 0)# 定义颜色
BLACK \= ( 0, 0, 0)
WHITE \= (255, 255, 255)
RED \= (255, 0, 0)
GREEN \= ( 0, 255, 0)
BLUE \= ( 0, 0, 255)repeat \= 0pieces\_images \= {'b\_rook': pygame.image.load("imgs/s2/b\_c.gif"),'b\_elephant': pygame.image.load("imgs/s2/b\_x.gif"),'b\_king': pygame.image.load("imgs/s2/b\_j.gif"),'b\_knigh': pygame.image.load("imgs/s2/b\_m.gif"),'b\_mandarin': pygame.image.load("imgs/s2/b\_s.gif"),'b\_cannon': pygame.image.load("imgs/s2/b\_p.gif"),'b\_pawn': pygame.image.load("imgs/s2/b\_z.gif"),'r\_rook': pygame.image.load("imgs/s2/r\_c.gif"),'r\_elephant': pygame.image.load("imgs/s2/r\_x.gif"),'r\_king': pygame.image.load("imgs/s2/r\_j.gif"),'r\_knigh': pygame.image.load("imgs/s2/r\_m.gif"),'r\_mandarin': pygame.image.load("imgs/s2/r\_s.gif"),'r\_cannon': pygame.image.load("imgs/s2/r\_p.gif"),'r\_pawn': pygame.image.load("imgs/s2/r\_z.gif"),
}

pieces.py 棋子类,走法,

import pygame
import constantsclass  Pieces():def \_\_init\_\_(self, player,  x, y):self.imagskey \= self.getImagekey()self.image \= constants.pieces\_images\[self.imagskey\]self.x \= xself.y \= yself.player \= playerself.rect \= self.image.get\_rect()self.rect.left \= constants.Start\_X + x \* constants.Line\_Span - self.image.get\_rect().width / 2self.rect.top \= constants.Start\_Y + y \* constants.Line\_Span - self.image.get\_rect().height / 2def displaypieces(self,screen):#print(str(self.rect.left))self.rect.left \= constants.Start\_X + self.x \* constants.Line\_Span - self.image.get\_rect().width / 2self.rect.top \= constants.Start\_Y + self.y \* constants.Line\_Span - self.image.get\_rect().height / 2screen.blit(self.image,self.rect);#self.image \= self.images#MainGame.window.blit(self.image,self.rect)def canmove(self, arr, moveto\_x, moveto\_y):passdef getImagekey(self):return Nonedef getScoreWeight(self,listpieces):return  Noneclass Rooks(Pieces):def \_\_init\_\_(self, player,  x, y):self.player \= playersuper().\_\_init\_\_(player,  x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_rook"else:return "b\_rook"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] ==self.player :return  Falseif self.x == moveto\_x:step \= -1 if self.y > moveto\_y else 1for i in range(self.y +step, moveto\_y, step):if arr\[self.x\]\[i\] !=0 :return False#print(" move y")return Trueif self.y == moveto\_y:step \= -1 if self.x > moveto\_x else 1for i in range(self.x + step, moveto\_x, step):if arr\[i\]\[self.y\] != 0:return Falsereturn Truedef getScoreWeight(self, listpieces):score \= 11return scoreclass Knighs(Pieces):def \_\_init\_\_(self, player,  x, y):self.player \= playersuper().\_\_init\_\_(player,  x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_knigh"else:return "b\_knigh"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] == self.player:return False#print(str(self.x) +""+str(self.y))move\_x \= moveto\_x-self.xmove\_y \= moveto\_y - self.yif abs(move\_x) == 1 and abs(move\_y) == 2:step \= 1 if move\_y > 0 else -1if arr\[self.x\]\[self.y + step\] == 0:return Trueif abs(move\_x) == 2 and abs(move\_y) == 1:step \= 1 if move\_x >0 else -1if arr\[self.x +step\]\[self.y\] ==0 :return  Truedef getScoreWeight(self, listpieces):score \= 5return scoreclass Elephants(Pieces):def \_\_init\_\_(self, player, x, y):self.player \= playersuper().\_\_init\_\_(player, x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_elephant"else:return "b\_elephant"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] == self.player:return Falseif self.y <=4 and moveto\_y >=5 or self.y >=5 and moveto\_y <=4:return  Falsemove\_x \= moveto\_x - self.xmove\_y \= moveto\_y - self.yif abs(move\_x) == 2 and abs(move\_y) == 2:step\_x \= 1 if move\_x > 0 else -1step\_y \= 1 if move\_y > 0 else -1if arr\[self.x + step\_x\]\[self.y + step\_y\] == 0:return Truedef getScoreWeight(self, listpieces):score \= 2return score
class Mandarins(Pieces):def \_\_init\_\_(self, player,  x, y):self.player \= playersuper().\_\_init\_\_(player,  x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_mandarin"else:return "b\_mandarin"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] == self.player:return Falseif moveto\_x <3 or moveto\_x >5:return Falseif moveto\_y > 2 and moveto\_y < 7:return Falsemove\_x \= moveto\_x - self.xmove\_y \= moveto\_y - self.yif abs(move\_x) == 1 and abs(move\_y) == 1:return Truedef getScoreWeight(self, listpieces):score \= 2return scoreclass King(Pieces):def \_\_init\_\_(self, player, x, y):self.player \= playersuper().\_\_init\_\_(player, x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_king"else:return "b\_king"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] == self.player:return Falseif moveto\_x < 3 or moveto\_x > 5:return Falseif moveto\_y > 2 and moveto\_y < 7:return Falsemove\_x \= moveto\_x - self.xmove\_y \= moveto\_y - self.yif abs(move\_x) + abs(move\_y) == 1:return Truedef getScoreWeight(self, listpieces):score \= 150return score
class Cannons(Pieces):def \_\_init\_\_(self, player,  x, y):self.player \= playersuper().\_\_init\_\_(player, x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_cannon"else:return "b\_cannon"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] == self.player:return Falseoverflag \= Falseif self.x == moveto\_x:step \= -1 if self.y > moveto\_y else 1for i in range(self.y + step, moveto\_y, step):if arr\[self.x\]\[i\] != 0:if overflag:return Falseelse:overflag \= Trueif overflag and arr\[moveto\_x\]\[moveto\_y\] == 0:return Falseif not overflag and arr\[self.x\]\[moveto\_y\] != 0:return Falsereturn Trueif self.y == moveto\_y:step \= -1 if self.x > moveto\_x else 1for i in range(self.x + step, moveto\_x, step):if arr\[i\]\[self.y\] != 0:if overflag:return Falseelse:overflag \= Trueif overflag and arr\[moveto\_x\]\[moveto\_y\] == 0:return Falseif not overflag and arr\[moveto\_x\]\[self.y\] != 0:return Falsereturn Truedef getScoreWeight(self, listpieces):score \= 6return scoreclass Pawns(Pieces):def \_\_init\_\_(self, player, x, y):self.player \= playersuper().\_\_init\_\_(player,  x, y)def getImagekey(self):if self.player == constants.player1Color:return "r\_pawn"else:return "b\_pawn"def canmove(self, arr, moveto\_x, moveto\_y):if self.x == moveto\_x and self.y == moveto\_y:return Falseif arr\[moveto\_x\]\[moveto\_y\] == self.player:return Falsemove\_x \= moveto\_x - self.xmove\_y \= moveto\_y - self.yif self.player == constants.player1Color:if self.y > 4  and move\_x != 0 :return  Falseif move\_y > 0:return  Falseelif self.player \== constants.player2Color:if self.y <= 4  and move\_x != 0 :return  Falseif move\_y < 0:return Falseif abs(move\_x) + abs(move\_y) == 1:return Truedef getScoreWeight(self, listpieces):score \= 2return scoredef listPiecestoArr(piecesList):arr \= \[\[0 for i in range(10)\] for j in range(9)\]for i in range(0, 9):for j in range(0, 10):if len(list(filter(lambda cm: cm.x == i and cm.y == j and cm.player == constants.player1Color,piecesList))):arr\[i\]\[j\] \= constants.player1Colorelif len(list(filter(lambda cm: cm.x \== i and cm.y == j and cm.player == constants.player2Color,piecesList))):arr\[i\]\[j\] \= constants.player2Colorreturn arr

computer.py 电脑走法计算

import constants
#import time
from pieces import listPiecestoArrdef getPlayInfo(listpieces):pieces \= movedeep(listpieces ,1 ,constants.player2Color)return \[pieces\[0\].x,pieces\[0\].y, pieces\[1\], pieces\[2\]\]def movedeep(listpieces, deepstep, player):arr \= listPiecestoArr(listpieces)listMoveEnabel \= \[\]for i in range(0, 9):for j in range(0, 10):for item in listpieces:if item.player == player and item.canmove(arr, i, j):#标记是否有子被吃 如果被吃 在下次循环时需要补会piecesremove \= Nonefor itembefore in listpieces:if itembefore.x == i and itembefore.y == j:piecesremove\= itembeforebreakif piecesremove != None:listpieces.remove(piecesremove)#记录移动之前的位置move\_x \= item.xmove\_y \= item.yitem.x \= iitem.y \= j#print(str(move\_x) \+ "," + str(move\_y) + "," + str(item.x) + "  ,  " + str(item.y))scoreplayer1 \= 0scoreplayer2 \= 0for itemafter in listpieces:if itemafter.player == constants.player1Color:scoreplayer1 += itemafter.getScoreWeight(listpieces)elif  itemafter.player \== constants.player2Color:scoreplayer2 += itemafter.getScoreWeight(listpieces)#print("得分:"+item.imagskey +", "+str(len(moveAfterListpieces))+","+str(i)+","+str(j)+"," +str(scoreplayer1) +"  ,  "+ str(scoreplayer2) )#print(str(deepstep))#如果得子 判断对面是否可以杀过来,如果又被杀,而且子力评分低,则不干arrkill \= listPiecestoArr(listpieces)if scoreplayer2 > scoreplayer1 :for itemkill in listpieces:if itemkill.player == constants.player1Color and itemkill.canmove(arrkill, i, j):scoreplayer2\=scoreplayer1if deepstep > 0 :nextplayer \= constants.player1Color if player == constants.player2Color else constants.player2Colornextpiecesbest\= movedeep(listpieces, deepstep -1, nextplayer)listMoveEnabel.append(\[item, i, j, nextpiecesbest\[3\], nextpiecesbest\[4\], nextpiecesbest\[5\]\])else:#print(str(len(listpieces)))#print("得分:" + item.imagskey + ", " + str(len(listpieces)) + "," + str(move\_x) + "," + str(move\_y) + "," + str(i) + "  ,  " + str(j))if player == constants.player2Color:listMoveEnabel.append(\[item, i, j, scoreplayer1, scoreplayer2, scoreplayer1 \- scoreplayer2\])else:listMoveEnabel.append(\[item, i, j, scoreplayer1, scoreplayer2, scoreplayer2 \- scoreplayer1\])#print("得分:"+str(scoreplayer1))item.x \= move\_xitem.y \= move\_yif piecesremove != None:listpieces.append(piecesremove)list\_scorepalyer1 \= sorted(listMoveEnabel, key=lambda tm: tm\[5\], reverse=True)piecesbest \= list\_scorepalyer1\[0\]if deepstep ==1 :print(list\_scorepalyer1)return piecesbest

源码在下方获取

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/385406.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

新版海螺影视主题模板M3.1全解密版本多功能苹果CMSv10后台自适应主题

苹果CMS2022新版海螺影视主题M3.1版本&#xff0c;这个主题我挺喜欢的&#xff0c;之前也有朋友给我提供过原版主题&#xff0c;一直想要破解但是后来找了几个SG11解密的大哥都表示解密需要大几百大洋&#xff0c;所以一直被搁置了。这个版本是完全解密的&#xff0c;无需SG11加…

前端模块化CommonJS、AMD、CMD、ES6

在前端开发中&#xff0c;模块化是一种重要的代码组织方式&#xff0c;它有助于将复杂的代码拆分成可管理的小块&#xff0c;提高代码的可维护性和可重用性。CommonJS、AMD&#xff08;异步模块定义&#xff09;和CMD&#xff08;通用模块定义&#xff09;是三种不同的模块规范…

1、hadoop环境搭建

1、环境配置 ip(/etc/sysconfig/network-scripts) # 网卡1 DEVICEeht0 TYPEEthernet ONBOOTyes NM_CONTROLLEDyes BOOTPROTOstatic IPADDR192.168.59.11 GATEWAY192.168.59.1 NETMASK 255.255.255.0 # 网卡2 DEVICEeht0 TYPEEthernet ONBOOTyes NM_CONTROLLEDyes BOOTPROTOdh…

【React1】React概述、基本使用、脚手架、JSX、组件

文章目录 1. React基础1.1 React 概述1.1.1 什么是React1.1.2 React 的特点声明式基于组件学习一次,随处使用1.2 React 的基本使用1.2.1 React的安装1.2.2 React的使用1.2.3 React常用方法说明React.createElement()ReactDOM.render()1.3 React 脚手架的使用1.3.1 React 脚手架…

基于tkinter的学生信息管理系统之登录界面和主界面菜单设计

目录 一、tkinter的介绍 二、登陆界面的设计 1、登陆界面完整代码 2、部分代码讲解 3、登录的数据模型设计 4、效果展示 三、学生主界面菜单设计 1、学生主界面菜单设计完整代码 2、 部分代码讲解 3、效果展示 四、数据库的模型设计 欢迎大家进来学习和支持&#xff01…

从食堂采购系统源码到成品:打造供应链采购管理平台实战详解

本篇文章&#xff0c;笔者将详细介绍如何从食堂采购系统的源码开始&#xff0c;逐步打造一个完备的供应链采购管理平台&#xff0c;帮助企业实现采购流程的智能化和高效化。 一、需求分析与规划 一般来说&#xff0c;食堂采购系统需要具备以下基本功能&#xff1a; 1.供应商…

第15周 Zookeeper分布式锁与变种多级缓存

1. Zookeeper介绍 1.1 介绍 1.2 应用场景简介 1.3 zookeeper工作原理 1.4 zookeeper特点

AI的欺骗游戏:揭示多模态大型语言模型的易受骗性

人工智能咨询培训老师叶梓 转载标明出处 多模态大型语言模型&#xff08;MLLMs&#xff09;在处理包含欺骗性信息的提示时容易生成幻觉式响应。尤其是在生成长响应时&#xff0c;仍然是一个未被充分研究的问题。来自 Apple 公司的研究团队提出了MAD-Bench&#xff0c;一个包含8…

DLMS/COSEM中公开密钥算法的使用_椭圆曲线加密法

1.概述 椭圆曲线密码涉及有限域上的椭圆曲线上的算术运算。椭圆曲线可以定义在任何数字域上(实数、整数、复数)&#xff0c;但在密码学中&#xff0c;椭圆曲线最常用于有限素数域。 素数域上的椭圆曲线由一组实数(x, y)组成&#xff0c;满足以下等式: 方程的所有解的集合构成…

内网漏扫工具fscan

一、介绍&#xff1a; fscan是一款内网综合扫描工具&#xff0c;方便一键自动化、全方位漏扫扫描。支持主机存活探测、端口扫描、常见服务的爆破、ms17010、redis批量写公钥、计划任务反弹shell、读取win网卡信息、web指纹识别、web漏洞扫描、netbios探测、域控识别等功能。 …

Pytorch使用教学8-张量的科学运算

在介绍完PyTorch中的广播运算后&#xff0c;继续为大家介绍PyTorch的内置数学运算&#xff1a; 首先对内置函数有一个功能印象&#xff0c;知道它的存在&#xff0c;使用时再查具体怎么用其次&#xff0c;我还会介绍PyTorch科学运算的注意事项与一些实用小技巧 1 基本数学运算…

【高中数学/反比例函数/增减区间】从熟悉的y=1/x到陌生的y=x/(1-x)的演变

【题目】 求yx/(1-x)的递增区间&#xff1f; 【解答】 此问题只要能画出yx/(1-x)的大致图像就能解答&#xff0c;首先我们需要将分式化简&#xff1a; yx/(1-x)(x-11)/(1-x)-11/(1-x) 从新的函数式中我们可以判断这也是一个反比例函数&#xff0c;可以从y1/x演变过来。 下…

vue2和el-input无法修改和写入,并且不报错

文章目录 一. 业务场景描述二. 原因分析三.解决方案3.1 方案一 原生标签&#xff08;不建议&#xff09;3.2 方案二 父子传递&#xff08;不建议&#xff09;3.3 方案三 vuex&#xff0c;pinia 状态传值&#xff08;不建议&#xff09;3.4 方案四 vue初始化属性 &#xff08;建…

PyCharm2024 专业版激活设置中文

PyCharm2024 专业版激活设置中文 官网下载最新版&#xff1a;https://www.jetbrains.com/zh-cn/pycharm/download 「hack-jet激活idea家族.zip」链接&#xff1a;https://pan.quark.cn/s/4929a884d8fe 激活步骤&#xff1a; 官网下载安装PyCharm &#xff1b;测试使用的202…

javaEE-01-tomcat

文章目录 javaWebTomcat启动 Tomcat 服务器测试服务器是否成功停止tomcat服务器修改服务器的端口号 Idea整合tomcat服务器 javaWeb 所有通过 Java 语言编写可以通过浏览器访问的程序的总称,是基于请求和响应来开发的。 请求: 客户端给服务器发送数据(Request)响应: 服务器给客…

[极客大挑战 2019]BabySQL1

这是上一个SQL注入的升级版&#xff0c;首先打开靶机 有了上次的经验&#xff0c;我们直接联合查询&#xff1a;?usernameaaaunion select null,null,null#&password1234 看报错信息&#xff0c;null&#xff0c;null&#xff0c;null#有错误&#xff0c;猜测select被过滤…

spring常用注解有哪些

Spring框架使用了大量的注解来简化配置和开发&#xff0c;以下是一些常用的Spring注解&#xff1a; 1.Component&#xff1a;通用的构造型注解&#xff0c;用于标记一个类作为Spring管理的组件&#xff0c;通常用于自定义组件。 2.Autowired&#xff1a;用于自动装配Bean&#…

OCCT使用指南:Foundation Classes

1、介绍 本手册解释了如何使用Open CASCADE Technology (OCCT) Foundation Classes。它提供了关于基础类的基础文档。有关基础类及其应用的高级信息&#xff0c;请参阅我们的电子学习和培训产品。 基础类提供各种通用服务&#xff0c;如自动动态内存管理&#xff08;通过句柄操…

RT-Thread debug 卡死在Stm32_putc问题分析解决

问题和解决方法 找了块开发板玩RT-Thread&#xff0c;一顿骚操作之后&#xff0c;发现debug就卡死在Stm32_putc(不稳定&#xff0c;反复重新上下电&#xff0c;重来有时候卡死有时候不卡死)&#xff0c;卡死情况如下图&#xff1a; 先最后的解决方法&#xff1a;取消调默认的内…

MySQL数据库-备份恢复

一、MySQL日志管理 1.为什么需要日志 用于排错用来做数据分析了解程序的运行情况&#xff0c;了解MySQL的性能 2.日志作用 在数据库保存数据时&#xff0c;有时候不可避免会出现数据丢失或者被破坏&#xff0c;这样情况下&#xff0c;就必须保证数据的安全性和完整性&#…