关于棋牌游戏源代码开放

合集下载

五子棋游戏源代码

五子棋游戏源代码

import java.awt.*;import java.awt.event.*;import java.io.*;import .*;import java.util.*;class clientThread extends Thread {chessClient chessclient;clientThread(chessClient chessclient) {this.chessclient = chessclient;}public void acceptMessage(String recMessage) {if (recMessage.startsWith("/userlist ")) {StringTokenizer userToken = new StringTokenizer(recMessage, " ");int userNumber = 0;erList.removeAll();erChoice.removeAll();erChoice.addItem("所有人");while (userToken.hasMoreTokens()) {String user = (String) userToken.nextToken(" ");if (userNumber > 0 && !user.startsWith("[inchess]")) {erList.add(user);erChoice.addItem(user);}userNumber++;}erChoice.select("所有人");} else if (recMessage.startsWith("/yourname ")) {chessclient.chessClientName = recMessage.substring(10);chessclient.setTitle("Java五子棋客户端" + "用户名:"+ chessclient.chessClientName);} else if (recMessage.equals("/reject")) {try {chessclient.chesspad.statusText.setText("不能加入游戏");chessclient.controlpad.cancelGameButton.setEnabled(false);chessclient.controlpad.joinGameButton.setEnabled(true);chessclient.controlpad.creatGameButton.setEnabled(true);} catch (Exception ef) {chessclient.chatpad.chatLineArea.setText("chessclient.chesspad.chessSocket.close无法关闭");}chessclient.controlpad.joinGameButton.setEnabled(true);} else if (recMessage.startsWith("/peer ")) {chessclient.chesspad.chessPeerName = recMessage.substring(6);if (chessclient.isServer) {chessclient.chesspad.chessColor = 1;chessclient.chesspad.isMouseEnabled = true;chessclient.chesspad.statusText.setText("请黑棋下子");} else if (chessclient.isClient) {chessclient.chesspad.chessColor = -1;chessclient.chesspad.statusText.setText("已加入游戏,等待对方下子...");}} else if (recMessage.equals("/youwin")) {chessclient.isOnChess = false;chessclient.chesspad.chessVictory(chessclient.chesspad.chessColor);chessclient.chesspad.statusText.setText("对方退出,请点放弃游戏退出连接");chessclient.chesspad.isMouseEnabled = false;} else if (recMessage.equals("/OK")) {chessclient.chesspad.statusText.setText("创建游戏成功,等待别人加入...");} else if (recMessage.equals("/error")) {chessclient.chatpad.chatLineArea.append("传输错误:请退出程序,重新加入\n");} else {chessclient.chatpad.chatLineArea.append(recMessage + "\n");chessclient.chatpad.chatLineArea.setCaretPosition(chessclient.chatpad.chatLineArea.getText().length());}}public void run() {String message = "";try {while (true) {message = chessclient.in.readUTF();acceptMessage(message);}} catch (IOException es) {}}}public class chessClient extends Frame implements ActionListener, KeyListener { userPad userpad = new userPad();chatPad chatpad = new chatPad();controlPad controlpad = new controlPad();chessPad chesspad = new chessPad();inputPad inputpad = new inputPad();Socket chatSocket;DataInputStream in;DataOutputStream out;String chessClientName = null;String host = null;int port = 4331;boolean isOnChat = false; // 在聊天?boolean isOnChess = false; // 在下棋?boolean isGameConnected = false; // 下棋的客户端连接?boolean isServer = false; // 如果是下棋的主机boolean isClient = false; // 如果是下棋的客户端Panel southPanel = new Panel();Panel northPanel = new Panel();Panel centerPanel = new Panel();Panel westPanel = new Panel();Panel eastPanel = new Panel();chessClient() {super("Java五子棋客户端");setLayout(new BorderLayout());host = controlpad.inputIP.getText();westPanel.setLayout(new BorderLayout());westPanel.add(userpad, BorderLayout.NORTH);westPanel.add(chatpad, BorderLayout.CENTER);westPanel.setBackground(Color.pink);inputpad.inputWords.addKeyListener(this);chesspad.host = controlpad.inputIP.getText();centerPanel.add(chesspad, BorderLayout.CENTER);centerPanel.add(inputpad, BorderLayout.SOUTH);centerPanel.setBackground(Color.pink);controlpad.connectButton.addActionListener(this);controlpad.creatGameButton.addActionListener(this);controlpad.joinGameButton.addActionListener(this);controlpad.cancelGameButton.addActionListener(this);controlpad.exitGameButton.addActionListener(this);controlpad.creatGameButton.setEnabled(false);controlpad.joinGameButton.setEnabled(false);controlpad.cancelGameButton.setEnabled(false);southPanel.add(controlpad, BorderLayout.CENTER);southPanel.setBackground(Color.pink);addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {if (isOnChat) {try {chatSocket.close();} catch (Exception ed) {}}if (isOnChess || isGameConnected) {try {chesspad.chessSocket.close();} catch (Exception ee) {}}System.exit(0);}public void windowActivated(WindowEvent ea) {}});add(westPanel, BorderLayout.WEST);add(centerPanel, BorderLayout.CENTER);add(southPanel, BorderLayout.SOUTH);pack();setSize(670, 548);setVisible(true);setResizable(false);validate();}public boolean connectServer(String serverIP, int serverPort)throws Exception {try {chatSocket = new Socket(serverIP, serverPort);in = new DataInputStream(chatSocket.getInputStream());out = new DataOutputStream(chatSocket.getOutputStream());clientThread clientthread = new clientThread(this);clientthread.start();isOnChat = true;return true;} catch (IOException ex) {chatpad.chatLineArea.setText("chessClient:connectServer:无法连接,建议重新启动程序\n");}return false;}public void actionPerformed(ActionEvent e) {if (e.getSource() == controlpad.connectButton) {host = chesspad.host = controlpad.inputIP.getText();try {if (connectServer(host, port)) {chatpad.chatLineArea.setText("");controlpad.connectButton.setEnabled(false);controlpad.creatGameButton.setEnabled(true);controlpad.joinGameButton.setEnabled(true);chesspad.statusText.setText("连接成功,请创建游戏或加入游戏");}} catch (Exception ei) {chatpad.chatLineArea.setText("controlpad.connectButton:无法连接,建议重新启动程序\n");}}if (e.getSource() == controlpad.exitGameButton) {if (isOnChat) {try {chatSocket.close();} catch (Exception ed) {}}if (isOnChess || isGameConnected) {try {chesspad.chessSocket.close();} catch (Exception ee) {}}System.exit(0);}if (e.getSource() == controlpad.joinGameButton) {String selectedUser = erList.getSelectedItem();if (selectedUser == null || selectedUser.startsWith("[inchess]")|| selectedUser.equals(chessClientName)) {chesspad.statusText.setText("必须先选定一个有效用户");} else {try {if (!isGameConnected) {if (chesspad.connectServer(chesspad.host, chesspad.port)) {isGameConnected = true;isOnChess = true;isClient = true;controlpad.creatGameButton.setEnabled(false);controlpad.joinGameButton.setEnabled(false);controlpad.cancelGameButton.setEnabled(true);chesspad.chessthread.sendMessage("/joingame "+ erList.getSelectedItem() + " "+ chessClientName);}} else {isOnChess = true;isClient = true;controlpad.creatGameButton.setEnabled(false);controlpad.joinGameButton.setEnabled(false);controlpad.cancelGameButton.setEnabled(true);chesspad.chessthread.sendMessage("/joingame "+ erList.getSelectedItem() + " "+ chessClientName);}} catch (Exception ee) {isGameConnected = false;isOnChess = false;isClient = false;controlpad.creatGameButton.setEnabled(true);controlpad.joinGameButton.setEnabled(true);controlpad.cancelGameButton.setEnabled(false);chatpad.chatLineArea.setText("chesspad.connectServer无法连接\n" + ee);}}}if (e.getSource() == controlpad.creatGameButton) {try {if (!isGameConnected) {if (chesspad.connectServer(chesspad.host, chesspad.port)) {isGameConnected = true;isOnChess = true;isServer = true;controlpad.creatGameButton.setEnabled(false);controlpad.joinGameButton.setEnabled(false);controlpad.cancelGameButton.setEnabled(true);chesspad.chessthread.sendMessage("/creatgame "+ "[inchess]" + chessClientName);}} else {isOnChess = true;isServer = true;controlpad.creatGameButton.setEnabled(false);controlpad.joinGameButton.setEnabled(false);controlpad.cancelGameButton.setEnabled(true);chesspad.chessthread.sendMessage("/creatgame "+ "[inchess]" + chessClientName);}} catch (Exception ec) {isGameConnected = false;isOnChess = false;isServer = false;controlpad.creatGameButton.setEnabled(true);controlpad.joinGameButton.setEnabled(true);controlpad.cancelGameButton.setEnabled(false);ec.printStackTrace();chatpad.chatLineArea.setText("chesspad.connectServer无法连接\n"+ ec);}}if (e.getSource() == controlpad.cancelGameButton) {if (isOnChess) {chesspad.chessthread.sendMessage("/giveup " + chessClientName);chesspad.chessVictory(-1 * chesspad.chessColor);controlpad.creatGameButton.setEnabled(true);controlpad.joinGameButton.setEnabled(true);controlpad.cancelGameButton.setEnabled(false);chesspad.statusText.setText("请建立游戏或者加入游戏");}if (!isOnChess) {controlpad.creatGameButton.setEnabled(true);controlpad.joinGameButton.setEnabled(true);controlpad.cancelGameButton.setEnabled(false);chesspad.statusText.setText("请建立游戏或者加入游戏");}isClient = isServer = false;}}public void keyPressed(KeyEvent e) {TextField inputWords = (TextField) e.getSource();if (e.getKeyCode() == KeyEvent.VK_ENTER) {if (erChoice.getSelectedItem().equals("所有人")) {try {out.writeUTF(inputWords.getText());inputWords.setText("");} catch (Exception ea) {chatpad.chatLineArea.setText("chessClient:KeyPressed无法连接,建议重新连接\n");erList.removeAll();erChoice.removeAll();inputWords.setText("");controlpad.connectButton.setEnabled(true);}} else {try {out.writeUTF("/" + erChoice.getSelectedItem()+ " " + inputWords.getText());inputWords.setText("");} catch (Exception ea) {chatpad.chatLineArea.setText("chessClient:KeyPressed无法连接,建议重新连接\n");erList.removeAll();erChoice.removeAll();inputWords.setText("");controlpad.connectButton.setEnabled(true);}}}}public void keyTyped(KeyEvent e) {}public void keyReleased(KeyEvent e) {}public static void main(String args[]) {chessClient chessClient = new chessClient();}}。

中国象棋python代码

中国象棋python代码

中国象棋python代码下面是一个简单的中国象棋的Python 代码示例:# 定义棋盘# 绘制棋盘def draw_board():for row in chessboard:for piece in row:print(piece, end=' ')print()# 判断是否在棋盘内def is_valid_move(x, y):return 0 <= x < 9 and 0 <= y < 10# 判断移动是否合法def is_valid_move(x1, y1, x2, y2):piece = chessboard[y1][x1]target = chessboard[y2][x2]if piece == ' ':return Falseif piece == '車' or piece == '車':if x1 != x2 and y1 != y2:return Falseif x1 == x2:min_y, max_y = (y1, y2) if y1 < y2 else (y2, y1)for y in range(min_y + 1, max_y):if chessboard[y][x1] != ' ':return Falseif y1 == y2:min_x, max_x = (x1, x2) if x1 < x2 else (x2, x1)for x in range(min_x + 1, max_x):if chessboard[y1][x] != ' ':return Falseif piece == '馬' or piece == '馬':dx = abs(x2 - x1)dy = abs(y2 - y1)if (dx == 1 and dy == 2) or (dx == 2 and dy == 1): return Truereturn Falseif piece == '象' or piece == '相':if y2 > 4 and (y2 - y1) % 2 != 0:return Falseif abs(x2 - x1) != 2 or abs(y2 - y1) != 2:return Falseif chessboard[(y1 + y2) // 2][(x1 + x2) // 2] != ' ': return Falseif piece == '士' or piece == '士':if x2 < 3 or x2 > 5:return Falseif y2 < 7 or y2 > 9:return Falseif abs(x2 - x1) != 1 or abs(y2 - y1) != 1: return Falseif piece == '帥' or piece == '将':if x2 < 3 or x2 > 5:return Falseif y2 < 0 or y2 > 2:return Falseif abs(x2 - x1) + abs(y2 - y1) != 1:return Falseif piece == '兵':if y1 < 5 and y2 != y1 - 1:return Falseif y1 >= 5 and (x1 != x2 or y2 != y1 - 1):return Falseif piece == '卒':if y1 > 4 and y2 != y1 + 1:return Falseif y1 <= 4 and (x1 != x2 or y2 != y1 + 1):return Falseif target == '帥' or target == '将':if piece == '卒' or piece == '兵':if y2 > 2:return Falseif piece == '兵' or piece == '卒':if y2 < 7:return Falsereturn True# 移动棋子def move_piece(x1, y1, x2, y2):if is_valid_move(x1, y1, x2, y2):piece = chessboard[y1][x1]chessboard[y2][x2] = piecechessboard[y1][x1] = ' 'else:print("Invalid move!")# 游戏循环def game_loop():while True:draw_board()player_input = input("请输入移动的起始位置和目标位置,以逗号分隔(例如:2,1,2,3):")positions = player_input.split(',')if len(positions) != 4:print("请输入正确的起始位置和目标位置!")continuex1, y1, x2, y2 = map(int, positions)if not is_valid_move(x1, y1) or not is_valid_move(x2, y2):print("请输入正确的起始位置和目标位置!")continuemove_piece(x1, y1, x2, y2)# 启动游戏game_loop()这是一个简单的中国象棋游戏代码示例,包括棋盘的绘制、棋子移动的判断和执行等功能。

象棋手机游戏源代码

象棋手机游戏源代码

作者:dlut_608_#4 来源:本站整理发布时间:2005-11-24 17:22:42123;if(point[guard2][guard1]<=16){g.setColor(255,255,0);g.fillArc(x-chessR+guard1*cellWidth,x-chessR+guard2*cellWidth,2*chessR,2*chessR,0,360);g.setColor(0x00000000);g.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_LARGE));g.drawString(word[guard2][guard1],x+guard1*cellWidth,x+chessR+guard2*cellWidth,Graphics.HCENTER|Graphics.BOTTOM); }}if(g2%2==0){if(point[guard2][guard1]>16){g.setColor(0,255,0);g.fillArc(x-chessR+guard1*cellWidth,x-chessR+guard2*cellWidth,2*chessR,2*chessR,0,360);g.setColor(0x00000000);g.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_LARGE));g.drawString(word[guard2][guard1],x+guard1*cellWidth,x+chessR+guard2*cellWidth,Graphics.HCENTER|Graphics.BOTTOM); }}}}protected void whoIsGoing(Graphics g)//判断该谁走了{checkWin();g.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_LARGE));if(isRedWin!=0){if(g2%2==1){g.setColor(255,0,0);g.drawString("该红方走了",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);}}else{ g.setColor(255,255,255);g.drawString("白方胜利",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);}if(isWhiteWin!=0){if(g2%2==0){g.setColor(255,255,255);g.drawString("该白方走了",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);}}else{ g.setColor(255,0,0);g.drawString("红方胜利",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);}}protected void checkWin()//判断输赢{ isRedWin=0;isWhiteWin=0;for(i=0;i<3;i++){for(j=0;j<3;j++){if(point[0+i][3+j]==5){isRedWin++;}}}for(i=0;i<3;i++){for(j=0;j<3;j++){if(point[7+i][3+j]==21){isWhiteWin++;}}}}protected void paintSelected(Graphics g)//画选择框{g.setColor(0,0,255);g.drawRect(x-chessR+selectedX*cellWidth,x-chessR+selectedY*cellWidth,2*chessR,2*chessR); }protected void paint(Graphics g){g.setColor(0x00000000);g.fillRect(0, 0, getWidth(), getHeight());paintMapa(g);paintMapb(g);paintMapc(g);paintAllChess(g);if(guard%2==1){chooseChess(g);}paintSelected(g);whoIsGoing(g);}protected void changTwoChessNum(int m,int n,int selectedX,int selectedY)//改变两个格子的值{g2++;p=point[selectedY][selectedX];point[selectedY][selectedX]=point[n][m];point[n][m]=0;q=word[selectedY][selectedX];word[selectedY][selectedX]=word[n][m];word[n][m]="空";}protected void theRuleOfChe(int m,int n,int selectedX,int selectedY)//车的规则{g=0;if(m==selectedX){if(n>selectedY){for(i=1;i {if(point[selectedY+i][m]!=0){g++;}}}else{for(i=1;i {if(point[n+i][m]!=0){g++;}}}if(g==0){changTwoChessNum(m,n,selectedX,selectedY);}}if(n==selectedY){if(m>selectedX){for(i=1;i {if(point[n][i+selectedX]!=0){g++;}}}else{for(i=1;i {if(point[n][m+i]!=0){g++;}}}if(g==0){changTwoChessNum(m,n,selectedX,selectedY);}}}protected void theRuleOfMa(int m,int n,int selectedX,int selectedY)//马的规则{if(n<9){if(point[n+1][m]==0){if(selectedX-m==1){if(selectedY-n==2){changTwoChessNum(m,n,selectedX,selectedY);}} }}if(n>0){if(point[n-1][m]==0){if(m-selectedX==1){if(n-selectedY==2){changTwoChessNum(m,n,selectedX,selectedY);}} }}if(n<9){if(point[n+1][m]==0){if(selectedX-m==-1){if(selectedY-n==2){changTwoChessNum(m,n,selectedX,selectedY);}} }}if(n>0){if(point[n-1][m]==0){if(m-selectedX==-1){if(n-selectedY==2){changTwoChessNum(m,n,selectedX,selectedY);}} }}if(m<8){if(point[n][m+1]==0){if(selectedX-m==2){if(selectedY-n==1){changTwoChessNum(m,n,selectedX,selectedY);}}}}if(m>0){if(point[n][m-1]==0){if(m-selectedX==2){if(n-selectedY==1){changTwoChessNum(m,n,selectedX,selectedY);}}}}if(m<8){if(point[n][m+1]==0){if(selectedimport Javax.microedition.lcdui.Display;import javax.microedition.midlet.MIDlet;public class Game extends MIDlet {GameCanvas game;//定义游戏界面的Canvas类GameCanvas的对象gobangpublic Game() {super();game=new GameCanvas(this);//生成GameCanvas类的对象game}protected void startApp(){Display.getDisplay(this).setCurrent(game);//在屏幕上绘出游戏见面game}protected void pauseApp(){}protected void destroyApp(boolean arg0){}}然后就是程序的主题部分了--GameCanvas,这里实现了从画棋盘棋子一直到判定和输出.我的主题思想是把棋盘初始化为一个2维数组,在有棋子的地方初始化为非0数,其他的都初始化为0;大家可在代码中看到,在图象输出和棋子移动也都是基于这个数组进行的。

(精选)关于棋牌游戏源代码开放

(精选)关于棋牌游戏源代码开放

关于棋牌游戏源代码开放在现今的棋牌游戏运营行业如火如荼的阶段,为了减少与避免一些初次接触此行业的运营商被一些产品开发商公司蒙骗上当,特此编写以下的一些说明和答疑,花点时间认真阅读和思考,可能会为您减少巨大的损失。

深圳市壹柒游网络科技有限公司为您全面解答。

1.对运营商开放源代码,可以使运营商根据运营环境与实际情况调节平台,而不被产品提供商所牵制:运营棋牌游戏,本质上做的事情就是为玩家提供最好的服务和游戏娱乐环境,玩家在这里玩开心,才会留下来,并为拉入更加多的朋友进来,从而才会使你赢取利润,是相辅相成的,是一个因果关系。

而玩家的需求日新月异,你必须根据实际的环境,调节必要的平台功能,例如注册登录策略,游戏奖励策略,游戏规则修改策略,引导购买会员策略,引导购买道具策略等等。

不同的运营时期,所进行的定制策略和程度是不一样的,所以运营商几乎每天都有修改定制部分的欲望与需求。

若运营没有得到源代码,将需要进行一系列繁琐过程:联系开发商,商讨价格,付款,等待开发,然后等待漫长的交付测试阶段。

市场机遇是不会等您的,您说这过程,使您错过了多少发展的机遇呢?从事实也得到证明,横观现今互联网的游戏运营商,从不对运营商开放源代码的棋牌站点,运营成功的又能有多少呢?答案是几乎没有。

再看使用了开放源代码的成功而且还保持不断发展的站点呢?数目是非常多的,具体的资料可以到网上搜索就能得到,这里我们就不逐一提及了。

您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?2.对运营商开放源代码,不需要为二次开发承担昂贵的开发费用:拥有了产品源代码,才可以进行二次开发,才可以时刻根据市场的需求的变化而立即变化。

而对于一些不牵涉到高级技术能力的功能的修改,也需要开发商加入的话,容易造成运营策略的泄漏,被其他人捷足先登了。

而且开发商除了收取开发成本的人员费用外,还需要收取您的人员管理成本,市场拓展成本,还有公司的收入等。

而这一切的成本,若运营商有了系统源代码后,您的运营成本将会减少很多,而这些成本费用的节省,可以使您投入到市场营销方面,赢取更加多的发展机遇。

五子棋源代码-Java_Applet小程序

五子棋源代码-Java_Applet小程序

五子棋源代码-Java_Applet小程序importjava.applet.Applet; importjava.awt.*;importjava.util.Random;public class wzq extends Applet implements Runnable{public void stop(){LoopThread = null;}privateintCalcZi(inti, int j, byte byte0){CXY cxy = new CXY(); int k = 0;int l = 0;do{int i1 = 0;int j1 = 0;do{cxy.x = i;cxy.y = j;if(MoveAGrid(cxy, l + 4 * j1) &&QiPan[cxy.x][cxy.y] == byte0) do{ if(QiPan[cxy.x][cxy.y] == 0 || QiPan[cxy.x][cxy.y] != byte0) break;i1++;} while(MoveAGrid(cxy, l + 4 * j1));}while(++j1 < 2);if(i1 > k)k = i1;}while(++l < 4);return ++k;}privatebooleanCanDo(){return steps < ((GRIDSUM * GRIDSUM) / 100) * 80;}//电脑下棋privateintCPUDo(CXY cxy, byte byte0){intai[] = new int[2];int ai1[] = new int[2];int ai2[] = new int[2];boolean flag = false;EnterTimes++;ai2[0] = 0;for(inti = recLU.x; i<= recRD.x; i++){for(int k = recLU.y; k <= recRD.y; k++){int l = 0;if(QiPan[i][k] == 0){DoAStep(i, k, byte0);l = CalcCPU(i, k, byte0);}if(l > 0){int i1 = 0;byte byte1;if(byte0 == 1)byte1 = 2; elsebyte1 = 1; if(EnterTimes<= level && steps < ((GRIDSUM * GRIDSUM) / 100) * 80)i1 = CPUDo(cxy, byte1);l += i1;if(l + Math.abs(rd.nextInt()) % 5 > ai2[0] || !flag){ai[0] = i;ai1[0] = k;ai2[0] = l;flag = true;}QiPan[i][k] = 0;}}}if(EnterTimes<= 1){cxy.x = ai[0];cxy.y = ai1[0];int j = 0;do{try{Thread.sleep(300L);}catch(InterruptedException _ex) { } QiPan[cxy.x][cxy.y] = byte0;repaint();try{Thread.sleep(300L);}catch(InterruptedException _ex) { } QiPan[cxy.x][cxy.y] = 0; repaint(); }while(++j < 2);}EnterTimes--;return ai2[0];}public void ClearPan(){for(inti = 0; i< GRIDSUM; i++){for(int j = 0; j < GRIDSUM; j++) QiPan[i][j] = 0;}scHong = 0;scHei = 0;steps = 0;recLU.x = 8;recRD.x = 9;recLU.y = 8;recRD.y = 9;}privatebooleanMoveAGrid(CXY cxy, inti){boolean flag = false;i %= 8;int j = cxy.x + oAdd[i][0]; int k = cxy.y + oAdd[i][1]; if(j >= 0 && j < GRIDSUM && k >= 0 && k < GRIDSUM){cxy.x = j;cxy.y = k;flag = true;}return flag;}public void paint(Graphics g){super.paint(g);for(inti = 0; i< GRIDSUM + 1; i++){g.drawLine(0, i * GRIDWIDTH, GRIDSUM * GRIDWIDTH, i * GRIDWIDTH);g.drawLine(i * GRIDWIDTH, 0, i * GRIDWIDTH, GRIDSUM * GRIDWIDTH);}for(int j = 0; j < GRIDSUM; j++){for(int k = 0; k < GRIDSUM; k++) drawQi(g, j, k, QiPan[j][k]);}}private void CPUInit(){PosAdd[0][0] = 8;PosAdd[0][1] = -2;PosAdd[1][0] = -2;PosAdd[0][2] = 3;PosAdd[2][0] = 3;PosAdd[0][3] = 2;PosAdd[3][0] = 2; PosAdd[1][1] = -7; PosAdd[1][2] = -1; PosAdd[2][1] = -1; PosAdd[1][3] = -1; PosAdd[3][1] = -1;PosAdd[2][2] = 4; PosAdd[3][3] = 4; PosAdd[2][3] = 4; PosAdd[3][2] = 4;}public void mouseDOWNThis(Event event){if(playerdo)xiazi.put(event.x, event.y);}privateintDoAStep(inti, int j, byte byte0){if(QiPan[i][j] != 0 || byte0 == 0 || byte0 > 2){return 0;}else{QiPan[i][j] = byte0; return 1;}}private void FreshRec(inti, int j){if(i - recLU.x< 2){recLU.x = i - 2;if(recLU.x< 0)recLU.x = 0;}if(recRD.x - i< 2){recRD.x = i + 2;if(recRD.x>= GRIDSUM) recRD.x = GRIDSUM - 1; }if(j - recLU.y< 2){recLU.y = j - 2;if(recLU.y< 0)recLU.y = 0;}if(recRD.y - j < 2){recRD.y = j + 2;if(recRD.y>= GRIDSUM) recRD.y = GRIDSUM - 1;}}publicwzq(){GRIDWIDTH = 18;GRIDSUM = 18; QiPan = new byte[GRIDSUM][GRIDSUM];oAdd = new int[8][2]; playing = false;playerdo = true;xy = new CXY();xiazi = new CXiaZi(); rd = new Random(); recLU = new CXY(); recRD = new CXY(); PosAdd = new int[4][4];}public void update(Graphics g){paint(g);}//画棋public void drawQi(Graphics g, inti, int j, int k){switch(k){case 0: // '\0'g.clearRect(i * GRIDWIDTH + 1, j * GRIDWIDTH + 1, GRIDWIDTH -2,GRIDWIDTH - 2);return;case 1: // '\001'g.setColor(Color.red);g.fillArc(i * GRIDWIDTH + 2, j * GRIDWIDTH + 2, GRIDWIDTH -4,GRIDWIDTH - 4, 0, 360);return;case 2: // '\002'g.setColor(Color.black);break;}g.fillArc(i * GRIDWIDTH + 2, j * GRIDWIDTH + 2, GRIDWIDTH -4,GRIDWIDTH - 4, 0, 360);}public void start(){if(LoopThread == null)LoopThread = new Thread(this, "wbqloop"); LoopThread.setPriority(1);LoopThread.start();}public void run(){for(; Thread.currentThread() == LoopThread; xiazi.get(xy)) {ClearPan();repaint();playing = true;//谁先下随机who = (byte)(Math.abs(rd.nextInt()) % 2 + 1); for(passes = 0; playing && passes < 2;){if(who == 1){lblStatus.setText("\u7EA2\u65B9\u4E0B");lblStatus.setForeground(Color.red);}else{lblStatus.setText("\u9ED1\u65B9\u4E0B");lblStatus.setForeground(Color.black);}if(steps < ((GRIDSUM * GRIDSUM) / 100) * 80){passes = 0;if(who == 1) //人下棋{xiazi.get(xy);for(; DoAStep(xy.x, xy.y, who) == 0; xiazi.get(xy)); scHong = CalcZi(xy.x, xy.y, who); FreshRec(xy.x, xy.y); steps++;}else //机器下棋{if(scHong == 0 &&scHei == 0){ xy.x = 9;xy.y = 9;} else{ CPUDo(xy, who);} for(; DoAStep(xy.x, xy.y, who) == 0; CPUDo(xy, who)); scHei = CalcZi(xy.x, xy.y, who); FreshRec(xy.x, xy.y); steps++;}}else{passes = 2;}if(scHong>= 5 || scHei>= 5) playing = false; repaint();//交换下棋方who = (byte)((1 - (who - 1)) + 1); Thread.yield(); }if(scHong>= 5) //红方胜{Status = "\u7EA2\u65B9\u80DC!";lblStatus.setForeground(Color.red); LoseTimes++; }else if(scHei>= 5)//黑方胜{Status = "\u9ED1\u65B9\u80DC!";lblStatus.setForeground(Color.black);if(LoseTimes> 0)LoseTimes--;}else //平局{Status = "\u4E0D\u5206\u80DC\u8D1F!";}lblStatus.setText(Status); repaint();}}//入口,开始下棋,初始化public void init() {super.init(); LoopThread = null; oAdd[0][0] = 0; oAdd[0][1] = -1; oAdd[1][0] = 1; oAdd[1][1] = -1; oAdd[2][0] = 1; oAdd[2][1] = 0; oAdd[3][0] = 1; oAdd[3][1] = 1; oAdd[4][0] = 0; oAdd[4][1] = 1; oAdd[5][0] = -1; oAdd[5][1] = 1; oAdd[6][0] = -1; oAdd[6][1] = 0; oAdd[7][0] = -1; oAdd[7][1] = -1; CPUInit();setLayout(null);resize(325, 352);lblStatus = new Label("Welcome"); lblStatus.setFont(new Font("Dialog", 1, 14));add(lblStatus);lblStatus.reshape(14, 332, 175, 15);lblLevel = new Label("JAVA\u4E94\u5B50\u68CB");lblLevel.setFont(new Font("Dialog", 1, 14));add(lblLevel);lblLevel.reshape(196, 332, 119, 15);}publicbooleanhandleEvent(Event event){if(event.id != 501 || event.target != this){returnsuper.handleEvent(event);}else{mouseDOWNThis(event);return true;}}privateintCalcCPU(inti, int j, byte byte0){CXY cxy = new CXY();String s = "";String s2 = "";String s4 = ""; byte byte1 = 0;CalcTimes++;if(byte0 == 1)byte1 = 2; elseif(byte0 == 2)byte1 = 1; int k = 0;int l = 0;do{int i1 = 0;String s1 = "";String s3 = "";String s5 = ""; int j1 = 0;do{int k1 = 0;cxy.x = i;for(cxy.y = j; MoveAGrid(cxy, l + 4 * j1) && k1 < 6 &&QiPan[cxy.x][cxy.y] != byte1; k1++) if(QiPan[cxy.x][cxy.y] == byte0) {if(j1 == 0)s3 += "1"; elses5 = "1" + s5; i1++;}elseif(j1 == 0)s3 += "0"; elses5 = "0" + s5;if(j1 == 0)s3 += "2";elses5 = "2" + s5;}while(++j1 < 2);i1++;s1 = s5 + "1" + s3;if(s1.indexOf("11111") != -1)i1 += 1000;elseif(s1.indexOf("011110") != -1)i1 += 500;elseif(s1.indexOf("211110") != -1 || s1.indexOf("011112") != -1 || s1.indexOf("01110") != -1 || s1.indexOf("01110") != -1 ||s1.indexOf("011010")!= -1 || s1.indexOf("010110") != -1 || s1.indexOf("11101") != -1 || s1.indexOf("10111") != -1 ||s1.indexOf("11011") != -1)i1 += 100;elseif(s1.indexOf("21110") != -1 || s1.indexOf("01112") != -1 ||s1.indexOf("0110") != -1 || s1.indexOf("211010") != -1 ||s1.indexOf("210110")!= -1)i1 += 20;if(l == 1 || l == 3)i1 += (i1 * 20) / 100;k += i1;}while(++l < 4); if(CalcTimes<= 1)k += CalcCPU(i, j, byte1);elseif(k > 10)k -= 10; CalcTimes--;return k;}int GRIDWIDTH; //网格宽度int GRIDSUM; //网格总数byte QiPan[][]; //棋盘intoAdd[][];Thread LoopThread;intscHong; //红方intscHei; //黑方byte who; //byte winner; //赢方boolean playing; booleanplayerdo; CXY xy;CXiaZixiazi; //下子String Status; //状态Random rd; //随机数 int passes;int steps;intLoseTimes;CXY recLU;CXY recRD; intPosAdd[][]; int level; intEnterTimes; intCalcTimes;Label lblStatus;Label lblLevel; }classCXiaZi{public synchronized void get(CXY cxy) {ready = false;notify();while(!ready)try{wait();}catch(InterruptedException _ex) { }ready = false;notify();cxy.x = xy.x;cxy.y = xy.y;}public synchronized void put(inti, int j){if(i< GRIDWIDTH * GRIDSUM && j < GRIDWIDTH * GRIDSUM) {xy.x = i / GRIDWIDTH; xy.y = j / GRIDWIDTH; ready = true; notify();}}publicCXiaZi(){GRIDWIDTH = 18;GRIDSUM = 18; xy = new CXY();ready = false;}private CXY xy;privateboolean ready; privateint GRIDWIDTH; privateint GRIDSUM; } class CXY{public CXY(){x = 0;y = 0;}publicint x; publicint y; }内部资料,请勿外传~。

纸牌游戏源代码

纸牌游戏源代码
continue;
}
}
}
printf("正面朝上的牌有:");
for(j=0;j<l->length;j++)
{
if(l->data[j]==0)
printf(" %d ",j+1);
}
}
void more(list* &l) //翻动次数最多
{
if(b==k[j])
{
if(l->data[j]==0)
printf("%d,翻牌次数为%d.为正面\n",j+1,b);
else
printf("%d,翻牌次数为%d.为反面\n",j+1,b);
}
}
}
return 0;
}
void change(list* &l) //翻牌
{
int j=0,i,zheng=0;
for(j=2;j<=l->length;j++)
{
for(i=1;i<=l->length;i++)
{
if((i*j<=l->length)&&(l->data[i*j-1]==1))
{
int b=k[0],r,j;
for(j=0;j<l->length-1;j++)
{
if(b<k[j+1])
{
b=k[j+1];
r=j+1;

关于棋牌游戏源代码开放

关于棋牌游戏源代码开放

关于棋牌游戏源代码开放在现今的棋牌游戏运营行业如火如荼的阶段,为了减少与避免一些初次接触此行业的运营商被一些产品开发商公司蒙骗上当,特此编写以下的一些说明和答疑,花点时间认真阅读和思考,可能会为您减少巨大的损失。

深圳市壹柒游网络科技有限公司为您全面解答。

1.对运营商开放源代码,可以使运营商根据运营环境与实际情况调节平台,而不被产品提供商所牵制:运营棋牌游戏,本质上做的事情就是为玩家提供最好的服务和游戏娱乐环境,玩家在这里玩开心,才会留下来,并为拉入更加多的朋友进来,从而才会使你赢取利润,是相辅相成的,是一个因果关系。

而玩家的需求日新月异,你必须根据实际的环境,调节必要的平台功能,例如注册登录策略,游戏奖励策略,游戏规则修改策略,引导购买会员策略,引导购买道具策略等等。

不同的运营时期,所进行的定制策略和程度是不一样的,所以运营商几乎每天都有修改定制部分的欲望与需求。

若运营没有得到源代码,将需要进行一系列繁琐过程:联系开发商,商讨价格,付款,等待开发,然后等待漫长的交付测试阶段。

市场机遇是不会等您的,您说这过程,使您错过了多少发展的机遇呢?从事实也得到证明,横观现今互联网的游戏运营商,从不对运营商开放源代码的棋牌站点,运营成功的又能有多少呢?答案是几乎没有。

再看使用了开放源代码的成功而且还保持不断发展的站点呢?数目是非常多的,具体的资料可以到网上搜索就能得到,这里我们就不逐一提及了。

您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?2.对运营商开放源代码,不需要为二次开发承担昂贵的开发费用:拥有了产品源代码,才可以进行二次开发,才可以时刻根据市场的需求的变化而立即变化。

而对于一些不牵涉到高级技术能力的功能的修改,也需要开发商加入的话,容易造成运营策略的泄漏,被其他人捷足先登了。

而且开发商除了收取开发成本的人员费用外,还需要收取您的人员管理成本,市场拓展成本,还有公司的收入等。

而这一切的成本,若运营商有了系统源代码后,您的运营成本将会减少很多,而这些成本费用的节省,可以使您投入到市场营销方面,赢取更加多的发展机遇。

Java写的围棋游戏的源代码

Java写的围棋游戏的源代码

import java.awt.*;import java.awt.event.*;import javax.swing.JOptionPane;public class Chess extends Frame{ChessPad chesspad= new ChessPad();Chess(){add(chesspad);chesspad.setBounds(70,90,440,440);Label label=new Label("click to point,doubled_click to remove,right click to back",Label.CENTER);add(label);label.setBounds(70,55,440,24);label.setBackground(Color.orange);addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}});setLayout(null);setVisible(true);setSize(600,550);}public static void main(String args[]){Chess chess=new Chess();}}class ChessPad extends Panel implements MouseListener, ActionListener,FocusListener {int x = -1, y = -1, chessColor = 1;String blackname="",whitename="";Button button=new Button("start");Button inputButton=new Button("input");TextField text_1=new TextField("black please"), text_2=new TextField(""),//white pleasetext_3=new TextField("black'name"),text_4=new TextField("white'name");ChessPad(){add(inputButton);inputButton.setBounds(35,5,60,26);inputButton.addActionListener(this);inputButton.addFocusListener(this);add(text_3);text_3.setBounds(115,5,90,24);text_3.addFocusListener(this);text_3.setEditable(true);add(text_4);text_4.setBounds(315,5,90,24);text_4.addFocusListener(this);text_4.setEditable(true);add(button);button.setBounds(35,36,60,26);button.setEnabled(false);button.addActionListener(this);add(text_1);text_1.setBounds(115,36,90,24);text_1.setEnabled(false);text_1.setEditable(false);add(text_2);text_2.setBounds(315,36,90,24);text_2.setEnabled(false);text_2.setEditable(false);setSize(440,440);setLayout(null);setBackground(Color.orange);addMouseListener(this);}public void paint(Graphics g){for(int i=80;i<=400;i=i+20){g.drawLine(40,i,400,i);}g.drawLine(40,420,400,420);for(int j=40;j<=380;j=j+20){g.drawLine(j,80,j,420);}g.drawLine(400,80,400,420);g.fillOval(97,137,6,6);g.fillOval(337,137,6,6);g.fillOval(97,377,6,6);g.fillOval(337,377,6,6);g.fillOval(217,257,6,6);}public void focusGained(FocusEvent e){Component com=(Component)e.getSource(); if(com==text_3){text_3.setText("");}else if(com==text_4){text_4.setText("");}}public void focusLost(FocusEvent e){}public void mousePressed(MouseEvent e)if(blackname.length()==0||whitename.length()==0){JOptionPane.showMessageDialog(this,"please input the player's name,and click input button before you start chess!","reminder",JOptionPane.WARNING_MESSAGE); }else if(blackname.equals("black'name")){JOptionPane.showMessageDialog(this,"please input the black player's name,and click input button","reminder",JOptionPane.WARNING_MESSAGE);}else if(whitename.equals("white'name")){JOptionPane.showMessageDialog(this,"please input the white player's name,and click input button","reminder",JOptionPane.WARNING_MESSAGE);}else if(e.getModifiers()==InputEvent.BUTTON1_MASK){x = (int)e.getX();y = (int)e.getY();int a=(x+10)/20,b=(y+10)/20;ChessPoint_black chesspoint_black=new ChessPoint_black(this);ChessPoint_white chesspoint_white=new ChessPoint_white(this);if(x/20<2||y/20<4||x/20>19||y/20>20){}else{if(chessColor==1){this.add(chesspoint_black);chesspoint_black.setBounds(a*20-10,b*20-10,20,20);chessColor=chessColor*(-1);text_2.setText(this.whitename+" please");text_1.setText("");else if(chessColor==-1){this.add(chesspoint_white);chesspoint_white.setBounds(a*20-10,b*20-10,20,20);chessColor=chessColor*(-1);text_1.setText(this.blackname+" please");text_2.setText("");}}}}public void mouseReleased(MouseEvent e){}public void mouseEntered(MouseEvent e){}public void mouseExited(MouseEvent e){}public void mouseClicked(MouseEvent e){}public void actionPerformed(ActionEvent e){if(e.getSource()==inputButton){blackname=text_3.getText();whitename=text_4.getText();if(blackname.length()==0||whitename.length()==0){JOptionPane.showMessageDialog(this,"you did not complete theinformation!","reminder",JOptionPane.WARNING_MESSAGE);}else if(blackname.equals("black'name")){JOptionPane.showMessageDialog(this,"please input the black player's name","reminder",JOptionPane.WARNING_MESSAGE);}else if(whitename.equals("white'name")){JOptionPane.showMessageDialog(this,"please input the white player's name","reminder",JOptionPane.WARNING_MESSAGE);}else{inputButton.setEnabled(false);text_3.removeFocusListener(this);text_3.setEnabled(false);text_4.setEnabled(false);button.setEnabled(true);text_1.setEnabled(true);text_1.setText(blackname+" please");text_2.setEnabled(true);}}else if(e.getSource()==button){inputButton.setEnabled(true);text_3.setEnabled(true);text_4.setEnabled(true);button.setEnabled(false);text_1.setEnabled(false);text_2.setEnabled(false);this.removeAll();chessColor=1;add(button);button.setBounds(35,36,60,26);add(text_1);text_1.setBounds(115,36,90,24);text_1.setText("black please");add(text_2);text_2.setBounds(315,36,90,24);text_2.setText("");add(inputButton);inputButton.setBounds(35,5,60,26);add(text_3);text_3.setText("black'name");text_3.addFocusListener(this);text_3.setBounds(115,5,90,24);add(text_4);text_4.setText("white'name");text_4.setBounds(315,5,90,24);blackname="";whitename="";}}}class ChessPoint_black extends Canvas implements MouseListener {ChessPad chesspad=null;ChessPoint_black(ChessPad p){setSize(20,20);chesspad=p;addMouseListener(this);}public void paint(Graphics g){g.setColor(Color.black);g.fillOval(0,0,20,20);}public void mousePressed(MouseEvent e){if(e.getModifiers()==InputEvent.BUTTON3_MASK){chesspad.remove(this);chesspad.chessColor=1;chesspad.text_2.setText("");chesspad.text_1.setText(chesspad.blackname+" please");}}public void mouseReleased(MouseEvent e){}public void mouseEntered(MouseEvent e){}public void mouseExited(MouseEvent e){}public void mouseClicked(MouseEvent e){if(e.getClickCount()>=2){chesspad.remove(this);}}}class ChessPoint_white extends Canvas implements MouseListener {ChessPad chesspad=null;ChessPoint_white(ChessPad p){setSize(20,20);chesspad=p;addMouseListener(this);}public void paint(Graphics g){g.setColor(Color.white);g.fillOval(0,0,20,20);}public void mousePressed(MouseEvent e){if(e.getModifiers()==InputEvent.BUTTON3_MASK){chesspad.remove(this);chesspad.chessColor=-1;chesspad.text_1.setText("");chesspad.text_2.setText(chesspad.whitename+" please"); }}public void mouseReleased(MouseEvent e){}public void mouseEntered(MouseEvent e){}public void mouseExited(MouseEvent e){}public void mouseClicked(MouseEvent e){if(e.getClickCount()>=2){chesspad.remove(this);}}}。

象棋游戏代码

象棋游戏代码

#include<stdio.h>#include<math.h>int x[11][12];void main(){int i,j;int x1,y1,x2,y2,rg,gg;int rgo(int,int,int,int);int ggo(int,int,int,int);/*初始化棋子(开局)*/for(i=1;i<=5;i++){ x[i][1]=x[10-i][1]=i+10;x[i][10]=x[10-i][10]=i+20;if(i%2==1){ x[i][4]=x[10-i][4]=17;x[i][7]=x[10-i][7]=27;}}x[2][3]=x[8][3]=16;x[2][8]=x[8][8]=26;for(i=0;i<=9;i++)x[i][0]=i;for(i=1;i<=10;i++)x[0][i]=i;printf("S27\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n"); for(j=10;j>=0;j--){ for(i=0;i<=9;i++){if(i==0){printf("%2d |",x[i][j]);continue;}if(j==0){printf(" 0%d ",x[i][j]);continue;}switch(x[i][j]){case 0 : printf(" ");break;case 11 : printf(" 车");break;case 12 : printf(" 马");break;case 13 : printf(" 相");break;case 14 : printf(" 士");break;case 15 : printf(" 帅");break;case 16 : printf(" 炮");break;case 17 : printf(" 兵");break;case 21 : printf(" JU ");break;case 22 : printf(" MA ");break;case 23 : printf(" XN ");break;case 24 : printf(" SH ");break;case 25 : printf(" JN ");break;case 26 : printf(" PO ");break;case 27 : printf(" ZU ");break;}}if(j==1)printf("|\n---+-------------------------------------\n");else if(j==0)printf("\n");elseprintf("|\n | |\n");}/*走子*/for(;;){/*红子走子*/for(rg=0;rg==0;){for(x1=0,y1=0,x2=0,y2=0;x[x1][y1]==0||x[x1][y1]>=20||x2<1||y2<1||x2>9||y2>10||x[x2][y2] <20&&x[x2][y2]>10||x[x2][y2]==x[x1][y1];){printf("请输入红子坐标(x1,y1,x2,y2):");scanf("%d,%d,%d,%d",&x1,&y1,&x2,&y2);}if(x[x1][y1]>20){continue;}rg=rgo(x1,y1,x2,y2);if(rg==0)continue;else{if(x[x2][y2]==25){x[x2][y2]=x[x1][y1],x[x1][y1]=0;printf("lu qi shu le\n");}elsex[x2][y2]=x[x1][y1],x[x1][y1]=0;}}printf("S27 制作\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n"); for(j=10;j>=0;j--){for(i=0;i<=9;i++){if(i==0){printf("%2d |",x[i][j]);continue;}if(j==0){printf(" 0%d ",x[i][j]);continue;}switch(x[i][j]){case 0 : printf(" ");break;case 11 : printf(" 车");break;case 12 : printf(" 马");break;case 13 : printf(" 相");break;case 14 : printf(" 士");break;case 15 : printf(" 帅");break;case 16 : printf(" 炮");break;case 17 : printf(" 兵");break;case 21 : printf(" JU ");break;case 22 : printf(" MA ");break;case 23 : printf(" XN ");break;case 24 : printf(" SH ");break;case 25 : printf(" JN ");break;case 26 : printf(" PO ");break;case 27 : printf(" ZU ");break;}}if(j==1)printf("|\n---+-------------------------------------\n");else if(j==0)printf("\n");printf("|\n | |\n");}/*绿子走子*/for(gg=0;gg==0;){for(x1=0,y1=0,x2=0,y2=0;x[x1][y1]<10||x2<1||y2<1||x2>9||y2>10||x[x2][y2]>20||x[x2][y2]= =x[x1][y1];){printf("请输入绿子坐标(x1,y1,x2,y2):");scanf("%d,%d,%d,%d",&x1,&y1,&x2,&y2);}if(x[x1][y1]<20){continue;}gg=ggo(x1,y1,x2,y2);if(gg==0)continue;else{if(x[x2][y2]==25){x[x2][y2]=x[x1][y1],x[x1][y1]=0;printf("hong qi shu le\n");}elsex[x2][y2]=x[x1][y1],x[x1][y1]=0;}}printf("S27 制作\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n");for(j=10;j>=0;j--){for(i=0;i<=9;i++){if(i==0){printf("%2d |",x[i][j]);continue;}if(j==0){printf(" 0%d ",x[i][j]);continue;switch(x[i][j]){case 0 : printf(" ");break;case 11 : printf(" 车");break;case 12 : printf(" 马");break;case 13 : printf(" 相");break;case 14 : printf(" 士");break;case 15 : printf(" 帅");break;case 16 : printf(" 炮");break;case 17 : printf(" 兵");break;case 21 : printf(" JU ");break;case 22 : printf(" MA ");break;case 23 : printf(" XN ");break;case 24 : printf(" SH ");break;case 25 : printf(" JN ");break;case 26 : printf(" PO ");break;case 27 : printf(" ZU ");break;}}if(j==1)printf("|\n---+-------------------------------------\n");else if(j==0)printf("\n");elseprintf("|\n | |\n"); }}}/*判定红棋是否有错*/int rgo(int xa,int ya,int xb,int yb){ if(x[xa][ya]==11) /*车*/{int t;if(xb-xa==0){if(yb<ya)t=yb,yb=ya,ya=t;for(t=1+ya;t<yb;t++)if(x[xa][t]!=0&&x[xa][t]<20)return 0;}else if(yb-ya==0){ if(xb<xa)t=xb,xb=xa,xa=t;for(t=1+xa;t<xb;t++)if(x[t][ya]!=0&&x[xa][t]<20)return 0;}else return 0;return 1;}if(x[xa][ya]==12) /*马*/ { if(fabs(yb-ya)==2&&fabs(xb-xa)==1) {if(yb-ya>0&&x[xa][ya+1]!=0)return 0;if(yb-ya<0&&x[xa][ya-1]!=0)return 0;if(x[xb][yb]!=0&&x[xb][yb]<20)return 0;}else if(fabs(xb-xa)==2&&fabs(yb-ya)==1) {if(xb-xa>0&&x[xa+1][ya]!=0)return 0;if(xb-xa<0&&x[xa-1][ya]!=0)return 0;if(x[xb][yb]!=0&&x[xb][yb]<20)return 0;}else return 0;return 1;}if(x[xa][ya]==13) /*相*/ {if(yb>5)return 0;if(fabs(yb-ya)==2&&fabs(xb-xa)==2) {if(yb-ya>0){if(xb-xa>0&&x[xa+1][ya+1]!=0)return 0;else if(xb-xa<0&&x[xa-1][ya+1]!=0)return 0;}else{if(xb-xa>0&&x[xa+1][ya-1]!=0)return 0;else if(xb-xa<0&&x[xa-1][ya-1]!=0)return 0;}if(x[xb][yb]!=0&&x[xb][yb]<20)return 0;}else return 0;return 1;}if(x[xa][ya]==14) /*士*/{if(xb<4||xb>6||yb>3)return 0;if(x[xb][yb]!=0&&x[xb][yb]<20)return 0;if(fabs(yb-ya)==fabs(xb-xa)==1)return 1;else return 0;}if(x[xa][ya]==15) /*帅*/{if(xb<4||xb>6||yb>3)return 0;if((fabs(yb-ya)==1&&xb-xa==0)||(fabs(xb-xa)==1&&yb-ya==0)) return 1;else return 0;}if(x[xa][ya]==16) /*炮*/{int t,k;if(yb-ya==0){if(xb<xa)t=xb,xb=xa,xa=t;for(t=0,k=1;xb>xa+k;k++)if(x[xa+k][ya]!=0)t++;if(t>1)return 0;else if(t==0){if(x[xb][yb]==0||x[xa][ya]==0)return 1;else return 0;}else if(t==1){if(x[xb][yb]>20)return 1;else return 0;}}else if(xb-xa==0){if(yb<ya)t=yb,yb=ya,ya=t;for(t=0,k=1;yb>ya+k;k++)if(x[xa][ya+k]!=0)t++;if(t>1)return 0;else if(t==0){if(x[xb][yb]==0||x[xa][ya]==0)return 1;else return 0;}else if(t==1){if(x[xb][yb]>20)return 1;else return 0;}}else return 0;}if(x[xa][ya]==17) /*兵*/{if(yb==ya&&fabs(xb-xa)==1||yb-ya==1&&xb==xa) {if((ya==4||ya==5)&&xb!=xa)return 0;if(x[xb][yb]!=0&&x[xb][yb]<20)return 0;}else return 0;}}/*判定绿棋是否有错*/int ggo(int xa,int ya,int xb,int yb){if(x[xa][ya]==21) /*车*/ {int t;if(xb-xa==0){if(yb<ya)t=yb,yb=ya,ya=t;for(t=1+ya;t<yb;t++)if(x[xa][t]!=0&&x[xa][t]>20)return 0;}else if(yb-ya==0){if(xb<xa)t=xb,xb=xa,xa=t;for(t=1+xa;t<xb;t++)if(x[t][ya]!=0&&x[t][ya]>20)return 0;}else return 0;return 1;}if(x[xa][ya]==22) /*马*/ {if(fabs(yb-ya)==2&&fabs(xb-xa)==1) {if(yb-ya>0&&x[xa][ya+1]!=0)return 0;if(yb-ya<0&&x[xa][ya-1]!=0)return 0;if(x[xb][yb]!=0&&x[xb][yb]>20)return 0;}else if(fabs(xb-xa)==2&&fabs(yb-ya)==1) {if(xb-xa>0&&x[xa+1][ya]!=0)return 0;if(xb-xa<0&&x[xa-1][ya]!=0)if(x[xb][yb]!=0&&x[xb][yb]>20)return 0;}else return 0;return 1;}if(x[xa][ya]==23) /*相*/ {if(yb<6)return 0;if(fabs(yb-ya)==2&&fabs(xb-xa)==2) {if(yb-ya>0){if(xb-xa>0&&x[xa+1][ya+1]!=0)return 0;else if(xb-xa<0&&x[xa-1][ya+1]!=0)return 0;}else{if(xb-xa>0&&x[xa+1][ya-1]!=0)return 0;else if(xb-xa<0&&x[xa-1][ya-1]!=0)return 0;}if(x[xb][yb]!=0&&x[xb][yb]>20)return 0;}else return 0;return 1;}if(x[xa][ya]==24) /*士*/ {if(xb<4||xb>6||yb<8)return 0;if(x[xb][yb]!=0&&x[xb][yb]>20)return 0;if(fabs(yb-ya)==fabs(xb-xa)==1) return 1;else return 0;}if(x[xa][ya]==25) /*帅*/ {return 0;if((fabs(yb-ya)==1&&xb-xa==0)||(fabs(xb-xa)==1&&yb-ya==0)) return 1;else return 0;}if(x[xa][ya]==26) /*炮*/{ int t,k;if(yb-ya==0){ if(xb<xa)t=xb,xb=xa,xa=t;for(t=0,k=1;xb>xa+k;k++)if(x[xa+k][ya]!=0)t++;if(t>1)return 0;else if(t==0){ if(x[xb][yb]==0||x[xa][ya]==0)return 1;else return 0;}else if(t==1){ if(x[xb][yb]<20)return 1;else return 0;}}else if(xb-xa==0){if(yb<ya)t=yb,yb=ya,ya=t;for(t=0,k=1;yb>ya+k;k++)if(x[xa][ya+k]!=0)t++;if(t>1)return 0;else if(t==0){if(x[xb][yb]==0||x[xa][ya]==0)return 1;else return 0;}else if(t==1){return 1;else return 0;}}else return 0;}if(x[xa][ya]==27) /*兵*/{if(yb==ya&&fabs(xb-xa)==1||ya-yb==1&&xb==xa) {if((ya==6||ya==7)&&xb!=xa)return 0;if(x[xb][yb]!=0&&x[xb][yb]>20)return 0;}else return 0;return 1;}}。

棋牌游戏 两人斗地主 源代码(客户端)

棋牌游戏 两人斗地主 源代码(客户端)

CPtrListN t(lst);
if(t.GetMaxPaiCount() > nShunPai)return false;
////if(t.mList.IsEmpty () && lzcnt == 0)return true;/////结束条件1
return IsShunAndDai(
mList,
m_iLaiZiCount,////赖子数
true,
-1,////上一手3牌牌点,如=-1则为入口位
firstpd,
4,
2,
1
);
}
bool CCardParserDDZ::Is4s2d(int &firstpd)//2对
{///3顺带单 最少2顺
if(m_iAllPaiCount < 4)return false;
return IsShunAndDai(
mList,
m_iLaiZiCount,////赖子数
true,
-1,////上一手3牌牌点,如=-1则为入口位
int nShunPai,////顺牌张数,如四顺则为4
/////带牌信息:
int nDaiPaiYuan,////带牌张数,如四带单则为1,四带对则为2
int nDaiPai////带牌单元个数,如四带一单则为1,四带二单则为2
)
{/////3顺带单 递归
);
}
bool CCardParserDDZ::Is4s1s1s(int &firstpd)
{
if(m_iAllPaiCount < 6)return false;

五子棋源代码(C++)-完美版

五子棋源代码(C++)-完美版

#include <iostream>#include <conio.h>using namespace std;#define WIDE_AND_LONG 20 //棋盘的长和宽#define NAME_LEN 20 //输入姓名的长度typedef class Gobang{public:int InitPlayerName(char *, char *);int CheckInput(char,int);int CheckIndexInput(char, char, char);int GetPlayerName();int InitBoard();int WriteBoard(char, char, bool);int BeginOrNot();int CheckRow();int CheckColumn();int CheckTopLeft();int CheckTopRight();int CheckDownLeft();int CheckDownRight();int CheckDraw();int CheckFinish();int Chess();int ShowBoard();private:char acBoard[WIDE_AND_LONG][WIDE_AND_LONG];char acPlayerOneName[NAME_LEN];char acPlayerTwoName[NAME_LEN];}GOBANG;//初始化姓名的缺省值int GOBANG::InitPlayerName(char *pPlayerOne,char *pPlayerTwo) {strcpy(acPlayerOneName,pPlayerOne);strcpy(acPlayerTwoName,pPlayerTwo);return 0;}//检查输入姓名时是否含非法字符空格和Tab键int GOBANG::CheckInput(char ch, int iNameLen){if(' ' == ch || '\t' == ch){cout<<"含有非法字符!"<<endl;return -1;}{cout<<"输入超出限定长度!"<<endl;return -1;}return 0;}//将棋子放到棋盘中int GOBANG::WriteBoard(char cRow, char cColumn, bool bJudge){int iRow = 0;int iColumn = 0;if(cRow >= '0' && cRow <= '9'){iRow = static_cast<int>(cRow - '0');}else if(cRow >= 'A' && cRow <= static_cast<char>('A' + WIDE_AND_LONG - 10 - 1)){iRow = static_cast<int>((cRow - 'A') + 10);}else{iRow = static_cast<int>((cRow - 'a') + 10);}if(cColumn >= '0' && cColumn <= '9'){iColumn = static_cast<int>(cColumn - '0');}else if(cColumn >= 'A' && cColumn <= static_cast<char>('A' + WIDE_AND_LONG - 10 - 1)) {iColumn = static_cast<int>((cColumn - 'A') + 10);}else{iColumn = static_cast<int>((cColumn - 'a') + 10);}if('+' != acBoard[iRow][iColumn]){cout<<"此处已有棋子!"<<endl;return -1;}if(!bJudge){acBoard[iRow][iColumn] = static_cast<char>(1);}elseacBoard[iRow][iColumn] = static_cast<char>(2);}return 0;}//检查坐标输入是否合法int GOBANG::CheckIndexInput(char cRow,char cSeparator,char cColumn){if(!cRow || !cSeparator || !cColumn){return -1;}if(!((cRow >= '0' && cRow <= '9') || \(cRow >= 'A' && cRow <= static_cast<char>('A' + WIDE_AND_LONG - 10 - 1)) || \ (cRow >= 'a' && cRow <= static_cast<char>('a' + WIDE_AND_LONG - 10 - 1)))){return -1;}if(' ' != cSeparator && '\t' != cSeparator && ',' != cSeparator){return -1;}if(!((cColumn >= '0' && cColumn <= '9') || \(cColumn >= 'A' && cColumn <= static_cast<char>('A' + WIDE_AND_LONG - 10 - 1)) || \ (cColumn >= 'a' && cColumn <= static_cast<char>('a' + WIDE_AND_LONG - 10 - 1)))){return -1;}return 0;}//获取玩家的昵称int GOBANG::GetPlayerName(){fflush(stdin);char cTemp = 0;int iNameLen = 0;cout<<"是否自己定义昵称?是(Y),否(任意键):";cTemp = getch();cout<<endl;if(('y' != cTemp) && ('Y' != cTemp)){return 0;}fflush(stdin);memset(acPlayerTwoName,0,sizeof(acPlayerTwoName));cout<<"请玩家一输入昵称:";while('\n' != (cTemp = getchar())){if(-1 == CheckInput(cTemp,iNameLen)){fflush(stdin);cout<<"请玩家一输入昵称:";continue;}acPlayerOneName[iNameLen] = cTemp;iNameLen++;}if(0 == iNameLen){strcpy(acPlayerOneName,"玩家一");}iNameLen = 0;fflush(stdin);cout<<"请玩家二输入昵称:";while('\n' != (cTemp = getchar())){if(-1 == CheckInput(cTemp,iNameLen)){fflush(stdin);cout<<"请玩家二输入昵称:";continue;}acPlayerTwoName[iNameLen] = cTemp;iNameLen++;}if(0 == iNameLen){strcpy(acPlayerTwoName,"玩家一");}return 0;}//初始化棋盘int GOBANG::InitBoard(){int iRow = 0;int iColumn = 0;for(iRow = 0; iRow < WIDE_AND_LONG; iRow++){for(iColumn = 0; iColumn < WIDE_AND_LONG; iColumn++)acBoard[iRow][iColumn] = '+';}}return 0;}//检查棋盘横向是否存在五子连珠int GOBANG::CheckRow(){int iRow = 0;int iColumn = 0;int iPlayerOneLen = 0;int iPlayerTwoLen = 0;for(iRow = 0; iRow < WIDE_AND_LONG; iRow ++) {while(iColumn < WIDE_AND_LONG){if(static_cast<char>(1) == acBoard[iRow][iColumn]){iPlayerOneLen ++;iPlayerTwoLen = 0;}else if(static_cast<char>(2) == acBoard[iRow][iColumn]) {iPlayerTwoLen ++;iPlayerOneLen = 0;}else{iPlayerTwoLen = 0;iPlayerOneLen = 0;}iColumn ++;}if(iPlayerOneLen >= 5){return 1;}if(iPlayerTwoLen >= 5){return 2;}iPlayerOneLen = 0;iPlayerTwoLen = 0;iColumn = 0;}}//检查棋盘竖向是否存在五子连珠int GOBANG::CheckColumn(){int iRow = 0;int iColumn = 0;int iPlayerOneLen = 0;int iPlayerTwoLen = 0;for(iColumn = 0; iColumn < WIDE_AND_LONG; iColumn ++) {while(iRow < WIDE_AND_LONG){if(static_cast<char>(1) == acBoard[iRow][iColumn]){iPlayerOneLen ++;iPlayerTwoLen = 0;}else if(static_cast<char>(2) == acBoard[iRow][iColumn]){iPlayerTwoLen ++;iPlayerOneLen = 0;}else{iPlayerTwoLen = 0;iPlayerOneLen = 0;}iRow ++;}if(iPlayerOneLen >= 5){return 1;}if(iPlayerTwoLen >= 5){return 2;}iPlayerOneLen = 0;iPlayerTwoLen = 0;iRow = 0;}return 0;}//检查棋盘左上方(包括对角线)是否存在五子连珠int GOBANG::CheckTopLeft()int iColumn = 0;int iPlayerOneLen = 0;int iPlayerTwoLen = 0;for(iRow = 4; iRow < WIDE_AND_LONG; iRow ++){iTempRow = iRow;while(iTempRow >= 0){if(static_cast<char>(1) == acBoard[iTempRow][iColumn]){iPlayerOneLen ++;iPlayerTwoLen = 0;if(iPlayerOneLen >= 5){return 1;}}else if(static_cast<char>(2) == acBoard[iTempRow][iColumn]) {iPlayerTwoLen ++;iPlayerOneLen = 0;if(iPlayerTwoLen >= 5){return 2;}}else{iPlayerTwoLen = 0;iPlayerOneLen = 0;}iTempRow --;iColumn ++;}iPlayerOneLen = 0;iPlayerTwoLen = 0;iColumn = 0;}return 0;}//检查棋盘右上方(包括对角线)是否存在五子连珠int GOBANG::CheckTopRight()int iTempColumn = 0;int iPlayerOneLen = 0;int iPlayerTwoLen = 0;for(iColumn = 0; iColumn < WIDE_AND_LONG - 4; iColumn ++) {iTempColumn = iColumn;while(iTempColumn < WIDE_AND_LONG){if(static_cast<char>(1) == acBoard[iRow][iTempColumn]){iPlayerOneLen ++;iPlayerTwoLen = 0;if(iPlayerOneLen >= 5){return 1;}}else if(static_cast<char>(2) == acBoard[iRow][iTempColumn]) {iPlayerTwoLen ++;iPlayerOneLen = 0;if(iPlayerTwoLen >= 5){return 2;}}else{iPlayerTwoLen = 0;iPlayerOneLen = 0;}iRow ++;iTempColumn ++;}iPlayerOneLen = 0;iPlayerTwoLen = 0;iRow = 0;}return 0;}//检查棋盘左下方(不包括对角线)是否存在五子连珠{int iRow = 0;int iTempRow = 0;int iColumn = 0;int iPlayerOneLen = 0;int iPlayerTwoLen = 0;for(iRow = 1; iRow < WIDE_AND_LONG - 4; iRow ++){iTempRow = iRow;while(iTempRow < WIDE_AND_LONG){if(static_cast<char>(1) == acBoard[iTempRow][iColumn]){iPlayerOneLen ++;iPlayerTwoLen = 0;if(iPlayerOneLen >= 5){return 1;}}else if(static_cast<char>(2) == acBoard[iTempRow][iColumn]) {iPlayerTwoLen ++;iPlayerOneLen = 0;if(iPlayerTwoLen >= 5){return 2;}}else{iPlayerTwoLen = 0;iPlayerOneLen = 0;}iTempRow ++;iColumn ++;}iPlayerOneLen = 0;iPlayerTwoLen = 0;iColumn = 0;}return 0;}int GOBANG::CheckDownRight(){int iRow = 0;int iTempRow = 0;int iColumn = WIDE_AND_LONG - 1;int iPlayerOneLen = 0;int iPlayerTwoLen = 0;for(iRow = 1; iRow < WIDE_AND_LONG - 4; iRow ++){iTempRow = iRow;while(iTempRow < WIDE_AND_LONG){if(static_cast<char>(1) == acBoard[iTempRow][iColumn]){iPlayerOneLen ++;iPlayerTwoLen = 0;if(iPlayerOneLen >= 5){return 1;}}else if(static_cast<char>(2) == acBoard[iTempRow][iColumn]) {iPlayerTwoLen ++;iPlayerOneLen = 0;if(iPlayerTwoLen >= 5){return 2;}}else{iPlayerTwoLen = 0;iPlayerOneLen = 0;}iTempRow ++;iColumn --;}iPlayerOneLen = 0;iPlayerTwoLen = 0;iColumn = WIDE_AND_LONG - 1;}return 0;//检查是否平局int GOBANG::CheckDraw(){int iRow = 0;int iColumn = 0;for(iRow = 0; iRow < WIDE_AND_LONG; iRow++){for(iColumn = 0; iColumn < WIDE_AND_LONG; iColumn++){if('+' == acBoard[iRow][iColumn]){return 1;}}}return 0;}//检查是否达到结束的条件(五子连珠或平局)int GOBANG::CheckFinish(){int iJudgeRow = 0;int iJudgeColumn = 0;int iJudgeTopLeft = 0;int iJudgeTopRight = 0;int iJudgeDownLeft = 0;int iJudgeDownRight = 0;int iJudgeDraw = 0;iJudgeRow = CheckRow();iJudgeColumn = CheckColumn();iJudgeTopLeft = CheckTopLeft();iJudgeTopRight = CheckTopRight();iJudgeDownLeft = CheckDownLeft();iJudgeDownRight = CheckDownRight();iJudgeDraw = CheckDraw();if(1 == iJudgeRow || 1 == iJudgeColumn || 1 == iJudgeTopLeft || \1 == iJudgeTopRight || 1 == iJudgeDownLeft || 1 == iJudgeDownRight) {cout<<"恭喜玩家<"<<acPlayerOneName<<">获胜!"<<endl;return 1;}if(2 == iJudgeRow || 2 == iJudgeColumn || 2 == iJudgeTopLeft || \2 == iJudgeTopRight || 2 == iJudgeDownLeft || 2 == iJudgeDownRight) {cout<<"恭喜玩家<"<<acPlayerTwoName<<">获胜!"<<endl;return 1;}if(0 == iJudgeDraw){cout<<"平局!"<<endl;return 1;}return 0;}//显示棋盘到控制台int GOBANG::ShowBoard(){int iRow = 0;int iColumn = 0;system("cls");cout<<" ";for(iRow = 0; iRow < WIDE_AND_LONG; iRow++){if(9 < iRow){cout<<static_cast<char>('A' + iRow - 10)<<" ";}else{cout<<iRow<<" ";}}cout<<endl;for(iRow = 0; iRow < WIDE_AND_LONG; iRow++){if(9 < iRow){cout<<static_cast<char>('A' + iRow - 10)<<" ";}else{cout<<iRow<<" ";}for(iColumn = 0; iColumn < WIDE_AND_LONG; iColumn++) {cout<<acBoard[iRow][iColumn]<<' ';}cout<<endl;}return 0;}//开始下棋int GOBANG::Chess(){bool bJudge = false;while(1){char cRow = 0;char cSeparator = 0;char cColumn = 0;char cTemp = 0;int iLen =1;fflush(stdin);if(!bJudge){cout<<"请<"<<acPlayerOneName<<">输入对应的行和列(格式: a,3 或a 3 或a 3):"; }else{cout<<"请<"<<acPlayerTwoName<<">输入对应的行和列(格式: a,3 或a 3 或a 3):"; }while('\n' != (cTemp = getchar())){if(iLen > 3){cout<<"输入有误!"<<endl;fflush(stdin);if(!bJudge){cout<<"请<"<<acPlayerOneName<<">输入对应的行和列(格式: a,3 或a 3 或a 3):";}else{cout<<"请<"<<acPlayerTwoName<<">输入对应的行和列(格式: a,3 或a 3 或a 3):";}iLen = 1;continue;}if(1 == iLen){cRow = cTemp;}else if(2 == iLen){cSeparator = cTemp;}else{cColumn = cTemp;}iLen++;}if(-1 == CheckIndexInput(cRow,cSeparator,cColumn)) {cout<<"输入有误!"<<endl;continue;}if(-1 == WriteBoard(cRow,cColumn,bJudge)){continue;}ShowBoard();if(1 == CheckFinish()){BeginOrNot();}bJudge = !bJudge;}return 0;}//判断游戏结束后玩家是否选择继续还是退出int GOBANG::BeginOrNot(){char cTemp = 0;cout<<"是否继续?是(Y),退出(任意键):";fflush(stdin);cTemp = getch();if('y' == cTemp || 'Y' == cTemp){InitBoard();ShowBoard();Chess();}else{exit(0); //程序的出口}return 0;}int main(){GOBANG gobang;memset(&gobang,0,sizeof(GOBANG));gobang.InitPlayerName("玩家一","玩家二"); gobang.GetPlayerName();gobang.InitBoard(); gobang.ShowBoard(); gobang.Chess(); return 0;}。

关于棋牌游戏源代码开放.doc

关于棋牌游戏源代码开放.doc

关于棋牌游戏源代码开放在现今的棋牌游戏运营行业如火如荼的阶段,为了减少与避免一些初次接触此行业的运营商被一些产品开发商公司蒙骗上当,特此编写以下的一些说明和答疑,花点时间认真阅读和思考,可能会为您减少巨大的损失。

深圳市壹柒游网络科技有限公司为您全面解答。

1.对运营商开放源代码,可以使运营商根据运营环境与实际情况调节平台,而不被产品提供商所牵制:运营棋牌游戏,本质上做的事情就是为玩家提供最好的服务和游戏娱乐环境,玩家在这里玩开心,才会留下来,并为拉入更加多的朋友进来,从而才会使你赢取利润,是相辅相成的,是一个因果关系。

而玩家的需求日新月异,你必须根据实际的环境,调节必要的平台功能,例如注册登录策略,游戏奖励策略,游戏规则修改策略,引导购买会员策略,引导购买道具策略等等。

不同的运营时期,所进行的定制策略和程度是不一样的,所以运营商几乎每天都有修改定制部分的欲望与需求。

若运营没有得到源代码,将需要进行一系列繁琐过程:联系开发商,商讨价格,付款,等待开发,然后等待漫长的交付测试阶段。

市场机遇是不会等您的,您说这过程,使您错过了多少发展的机遇呢?从事实也得到证明,横观现今互联网的游戏运营商,从不对运营商开放源代码的棋牌站点,运营成功的又能有多少呢?答案是几乎没有。

再看使用了开放源代码的成功而且还保持不断发展的站点呢?数目是非常多的,具体的资料可以到网上搜索就能得到,这里我们就不逐一提及了。

您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?2.对运营商开放源代码,不需要为二次开发承担昂贵的开发费用:拥有了产品源代码,才可以进行二次开发,才可以时刻根据市场的需求的变化而立即变化。

而对于一些不牵涉到高级技术能力的功能的修改,也需要开发商加入的话,容易造成运营策略的泄漏,被其他人捷足先登了。

而且开发商除了收取开发成本的人员费用外,还需要收取您的人员管理成本,市场拓展成本,还有公司的收入等。

而这一切的成本,若运营商有了系统源代码后,您的运营成本将会减少很多,而这些成本费用的节省,可以使您投入到市场营销方面,赢取更加多的发展机遇。

麻将C语言源代码(求完善版)

麻将C语言源代码(求完善版)

非吾之力,此资源:求更改,求完善,求分享!邮箱:*****************麻将源代码*/#include "dos.h"#include "stdio.h"#include "graphics.h"#include "bios.h"#include "conio.h"#include "stdlib.h"unsigned char far *video_buffer=(char far *)0xA0000000L;#define VGA256 0x13 /*图形模式13h*/#define TEXT_MODE 0x03 /*普通文本模式*/#define SETVGA Set_Video_Mode(VGA256)#define OUTVGA Set_Video_Mode(TEXT_MODE)#define BYTE unsigned char#define WORD unsigned int#define DWORD unsigned int#define ESC 283#define LEFT 19200#define RIGHT 19712#define H 9064#define ENTER 7181unsigned long int z=54400,zz=0,zy=0,zyy=0,z1=0,zl=10140;int key=0,keyy=0,sing=0,sing1=0,second=0,threes=0;struct chi{int lg;int lgg;}ch[13];struct mj{ char *name; /*名字*/int data1; /*是否已出,无用了*/int data2; /*是否在手中,1为自己,2为对方*/int number; /*同一个花色的第几张,共4张*/}m[136]={"1.bmp",0,0,1,"1.bmp",0,0,2,"1.bmp",0,0,3,"1.bmp",0,0,4,"2.bmp",0,0,1,"2.bmp",0,0,2,"2.bmp",0,0,3,"2.bmp",0,0,4,"3.bmp",0,0,1,"3.bmp",0,0,2,"3.bmp",0,0,3,"3.bmp",0,0,4,"4.bmp",0,0,1,"4.bmp",0,0,2,"4.bmp",0,0,3,"4.bmp",0,0,4,"5.bmp",0,0,1,"5.bmp",0,0,2,"5.bmp",0,0,3,"5.bmp",0,0,4,"6.bmp",0,0,1,"6.bmp",0,0,2,"6.bmp",0,0,3,"6.bmp",0,0,4,"7.bmp",0,0,1,"7.bmp",0,0,2,"7.bmp",0,0,3,"7.bmp",0,0,4,"8.bmp",0,0,1,"8.bmp",0,0,2,"8.bmp",0,0,3,"8.bmp",0,0,4,"9.bmp",0,0,1,"9.bmp",0,0,2,"9.bmp",0,0,3,"9.bmp",0,0,4,"10.bmp",0,0,1,"10.bmp",0,0,2,"10.bmp",0,0,3,"10.bmp",0,0,4,"11.bmp",0,0,1,"11.bmp",0,0,2,"11.bmp",0,0,3,"11.bmp",0,0,4,"12.bmp",0,0,1,"12.bmp",0,0,2,"12.bmp",0,0,3,"12.bmp",0,0,4,"13.bmp",0,0,1,"13.bmp",0,0,2,"13.bmp",0,0,3,"13.bmp",0,0,4,"14.bmp",0,0,1,"14.bmp",0,0,2,"14.bmp",0,0,3,"14.bmp",0,0,4,"15.bmp",0,0,1,"15.bmp",0,0,2,"15.bmp",0,0,3,"15.bmp",0,0,4,"19.bmp",0,0,4,"20.bmp",0,0,1,"20.bmp",0,0,2,"20.bmp",0,0,3,"20.bmp",0,0,4, "21.bmp",0,0,1,"21.bmp",0,0,2,"21.bmp",0,0,3,"21.bmp",0,0,4,"22.bmp",0,0,1, "22.bmp",0,0,2,"22.bmp",0,0,3,"22.bmp",0,0,4,"23.bmp",0,0,1,"23.bmp",0,0,2, "23.bmp",0,0,3,"23.bmp",0,0,4,"24.bmp",0,0,1,"24.bmp",0,0,2,"24.bmp",0,0,3, "24.bmp",0,0,4,"25.bmp",0,0,1,"25.bmp",0,0,2,"25.bmp",0,0,3,"25.bmp",0,0,4, "26.bmp",0,0,1,"26.bmp",0,0,2,"26.bmp",0,0,3,"26.bmp",0,0,4,"27.bmp",0,0,1, "27.bmp",0,0,2,"27.bmp",0,0,3,"27.bmp",0,0,4,"28.bmp",0,0,1,"28.bmp",0,0,2, "28.bmp",0,0,3,"28.bmp",0,0,4,"29.bmp",0,0,1,"29.bmp",0,0,2,"29.bmp",0,0,3, "29.bmp",0,0,4,"30.bmp",0,0,1,"30.bmp",0,0,2,"30.bmp",0,0,3,"30.bmp",0,0,4, "31.bmp",0,0,1,"31.bmp",0,0,2,"31.bmp",0,0,3,"31.bmp",0,0,4,"32.bmp",0,0,1, "32.bmp",0,0,2,"32.bmp",0,0,3,"32.bmp",0,0,4,"33.bmp",0,0,1,"33.bmp",0,0,2, "33.bmp",0,0,3,"33.bmp",0,0,4,"34.bmp",0,0,1,"34.bmp",0,0,2,"34.bmp",0,0,3, "34.bmp"};struct every{ int *k; /*名字*/int oneorfour; /*同一张牌的第几张*/int number; /*第几张牌136*/int p;int g;int c;int d[2];};struct me{ int m; /*定义有几张牌,开始有13张随着游戏的进行,会越来越小*/int p; /*乓对方*/int c; /*吃对方*/int g; /*杠*/struct every pp[14]; /*存放手上的牌*/}me;struct computer{ int m;int p;int c;int g;struct every pp[14];}computer,comp;/* 设置调色板 */void Set_Palette(int Color,BYTE r,BYTE g,BYTE b){outportb(0x3c8,Color); /*0x3c8写端口写色号*/outportb(0x3c9,r); /*0x3c9数据端口 R、G、B的比例*/outportb(0x3c9,g);outportb(0x3c9,b);}/*0x3c7读端口 0x3c6计算机调色板寄存器调用端口*//* 设置显示模式的函数 */void Set_Video_Mode(int mode){union REGS inregs,outregs; /*定义输入和返回寄存器*/}void h_line(int x0,int x1,int y,unsigned int color) { unsigned int address,n,temp;if(x0>x1){temp=x1;x1=x0;x0=temp;}address=320*y+x0;for(n=0;n<=x1-x0;n++){video_buffer[address]=color;address+=1;}}void p_pixel(int x,int y,unsigned int color){ video_buffer[y*320+x]=color;}void s_square(int x,int y,int side,int color){h_line(x,x+side,y,color);h_line(x,x+side,y+side,color);v_line(y,y+side,x,color);v_line(y,y+side,x+side,color);}void r_rectangle(int x1,int y1,int x2,int y2,int color) {h_line(x1,x2,y1,color);h_line(x1,x2,y2,color);v_line(y1,y2,x1,color);v_line(y1,y2,x2,color);}void fillRectangle(int x1,int y1,int x2,int y2,int color) {int i;for(i=y1;i<=y2;i++){h_line(x1,x2,i,color);}}void showbmp(int l)bmp=fopen(me.pp[l].k,"rb");fseek(bmp,54,SEEK_SET);for(i=0;i<256;i++){palette[i][2]=fgetc(bmp)>>2;palette[i][1]=fgetc(bmp)>>2;palette[i][0]=fgetc(bmp)>>2;fgetc(bmp);Set_Palette(i,palette[i][0],palette[i][1],palette[i][2]); }for (y=0;y<30;y++)for(x=0;x<20;x++)pokeb(0xa000,y*320+x+z+zz+z1,fgetc(bmp)); fclose(bmp);}void showbmpd(int l){ FILE *bmp;int i,x,y;BYTE palette[256][3];bmp=fopen(me.pp[l].k,"rb");fseek(bmp,54,SEEK_SET);for(i=0;i<256;i++){palette[i][2]=fgetc(bmp)>>2;palette[i][1]=fgetc(bmp)>>2;palette[i][0]=fgetc(bmp)>>2;fgetc(bmp);Set_Palette(i,palette[i][0],palette[i][1],palette[i][2]); }for (y=0;y<30;y++)for(x=0;x<20;x++)pokeb(0xa000,y*320+x+zyy,fgetc(bmp));fclose(bmp);}void showybmp(int ll){ FILE *bmp;int i,x,y;BYTE palette[256][3];bmp=fopen(computer.pp[ll].k,"rb");fseek(bmp,54,SEEK_SET);for(i=0;i<256;i++){palette[i][2]=fgetc(bmp)>>2;palette[i][1]=fgetc(bmp)>>2;palette[i][0]=fgetc(bmp)>>2;fgetc(bmp);Set_Palette(i,palette[i][0],palette[i][1],palette[i][2]); }for (y=0;y<30;y++)for(x=0;x<20;x++)void showcbmp(int ll){ FILE *bmp;int i,x,y;BYTE palette[256][3];bmp=fopen(computer.pp[ll].k,"rb");fseek(bmp,54,SEEK_SET);for(i=0;i<256;i++){palette[i][2]=fgetc(bmp)>>2;palette[i][1]=fgetc(bmp)>>2;palette[i][0]=fgetc(bmp)>>2;fgetc(bmp);Set_Palette(i,palette[i][0],palette[i][1],palette[i][2]); }for (y=0;y<30;y++)for(x=0;x<20;x++)pokeb(0xa000,y*320+x+zyy,fgetc(bmp));fclose(bmp);}void bmpp(int number){ FILE *bmp;int i,x,y;BYTE palette[256][3];bmp=fopen(m[number].name,"rb");fseek(bmp,54,SEEK_SET);for(i=0;i<256;i++){palette[i][2]=fgetc(bmp)>>2;palette[i][1]=fgetc(bmp)>>2;palette[i][0]=fgetc(bmp)>>2;fgetc(bmp);Set_Palette(i,palette[i][0],palette[i][1],palette[i][2]); }for (y=0;y<30;y++)for(x=0;x<20;x++)pokeb(0xa000,y*320+x+zl,fgetc(bmp));fclose(bmp);}void comlipai() /*整理电脑的牌*/{ int n,j,u;for(j=n;j<computer.m;j++){if(computer.pp[n].number>computer.pp[j+1].number) {lingshi=computer.pp[n].k;computer.pp[n].k=computer.pp[j+1].k;computer.pp[j+1].k=lingshi;u=computer.pp[n].oneorfour;computer.pp[n].oneorfour=computer.pp[j+1].oneorfour; computer.pp[j+1].oneorfour=u;u=computer.pp[n].number;computer.pp[n].number=computer.pp[j+1].number; computer.pp[j+1].number=u;}elseif(computer.pp[n].number==computer.pp[j+1].number)if(computer.pp[n].oneorfour>computer.pp[j+1].oneorfour) {lingshi=computer.pp[n].k;computer.pp[n].k=computer.pp[j+1].k;computer.pp[j+1].k=lingshi;u=computer.pp[n].oneorfour;computer.pp[n].oneorfour=computer.pp[j+1].oneorfour; computer.pp[j+1].oneorfour=u;u=computer.pp[n].number;computer.pp[n].number=computer.pp[j+1].number; computer.pp[j+1].number=u;}}}void melipai(){ int n,j,u;int *lingshi;for(n=0;n<me.m;n++)for(j=n;j<me.m;j++){if(me.pp[n].number>me.pp[j+1].number){lingshi=me.pp[n].k;me.pp[n].k=me.pp[j+1].k;me.pp[j+1].k=lingshi;u=me.pp[n].oneorfour;me.pp[n].oneorfour=me.pp[j+1].oneorfour;me.pp[j+1].oneorfour=u;u=me.pp[n].number;me.pp[n].number=me.pp[j+1].number;me.pp[j+1].number=u;}elseif(me.pp[n].number==me.pp[j+1].number)me.pp[n].k=me.pp[j+1].k;me.pp[j+1].k=lingshi;u=me.pp[n].oneorfour;me.pp[n].oneorfour=me.pp[j+1].oneorfour;me.pp[j+1].oneorfour=u;u=me.pp[n].number;me.pp[n].number=me.pp[j+1].number;me.pp[j+1].number=u;}}}void rgzn(int c) /*本程序涵数的核心针对电脑的牌*/ { int b=0,lg,lgg,logo,logoo,pg=0,gp=0,cs=0,f=0;if(me.pp[c].number<=35 && me.pp[c].number>=0){logo=1;if(me.pp[c].number<=3 && me.pp[c].number>=0) logoo=1;else if(me.pp[c].number<=7 && me.pp[c].number>=4) logoo=2;else if(me.pp[c].number<=11 && me.pp[c].number>=8) logoo=3;else if(me.pp[c].number<=15 && me.pp[c].number>=12) logoo=4;else if(me.pp[c].number<=19 && me.pp[c].number>=16) logoo=5;else if(me.pp[c].number<=23 && me.pp[c].number>=20) logoo=6;[1] [2]else if(me.pp[c].number<=27 && me.pp[c].number>=24) logoo=7;else if(me.pp[c].number<=31 && me.pp[c].number>=28) logoo=8;else if(me.pp[c].number<=35 && me.pp[c].number>=32) logoo=9;}if(me.pp[c].number<=39 && me.pp[c].number>=36) logoo=1;else if(me.pp[c].number<=43 && me.pp[c].number>=40) logoo=2;else if(me.pp[c].number<=47 && me.pp[c].number>=44) logoo=3;else if(me.pp[c].number<=51 && me.pp[c].number>=48) logoo=4;else if(me.pp[c].number<=55 && me.pp[c].number>=52) logoo=5;else if(me.pp[c].number<=59 && me.pp[c].number>=56) logoo=6;else if(me.pp[c].number<=63 && me.pp[c].number>=60) logoo=7;else if(me.pp[c].number<=67 && me.pp[c].number>=64) logoo=8;else if(me.pp[c].number<=71 && me.pp[c].number>=68) logoo=9;}else if(me.pp[c].number<=107 && me.pp[c].number>=72) {logo=3;if(me.pp[c].number<=75 && me.pp[c].number>=72) logoo=1;else if(me.pp[c].number<=79 && me.pp[c].number>=76) logoo=2;else if(me.pp[c].number<=83 && me.pp[c].number>=80) logoo=3;else if(me.pp[c].number<=87 && me.pp[c].number>=84) logoo=4;else if(me.pp[c].number<=91 && me.pp[c].number>=88) logoo=5;else if(me.pp[c].number<=95 && me.pp[c].number>=92) logoo=6;else if(me.pp[c].number<=99 && me.pp[c].number>=96) logoo=7;else if(me.pp[c].number<=103 && me.pp[c].number>=100) logoo=8;else if(me.pp[c].number<=107 && me.pp[c].number>=104) logoo=9;}else if(me.pp[c].number<=135 && me.pp[c].number>=108) {logo=4;if(me.pp[c].number<=111 && me.pp[c].number>=108) logoo=1;else if(me.pp[c].number<=115 && me.pp[c].number>=112) logoo=2;else if(me.pp[c].number<=119 && me.pp[c].number>=116) logoo=3;else if(me.pp[c].number<=131 && me.pp[c].number>=128)logoo=6;else if(me.pp[c].number<=135 && me.pp[c].number>=132)logoo=7;}while(b<=computer.m){if(computer.pp[b].number<=35 && computer.pp[b].number>=0)/*假定电脑经过分析后出了第一张牌*/{lg=1;computer.pp[b].d[0]=1;if(computer.pp[b].number<=3 && computer.pp[b].number>=0){lgg=1;computer.pp[b].d[1]=1;}else if(computer.pp[b].number<=7 && computer.pp[b].number>=4) {lgg=2;computer.pp[b].d[1]=2;}else if(computer.pp[b].number<=11 && computer.pp[b].number>=8) {lgg=3;computer.pp[b].d[1]=3;}else if(computer.pp[b].number<=15 && computer.pp[b].number>=12) {lgg=4;computer.pp[b].d[1]=4;}else if(computer.pp[b].number<=19 && computer.pp[b].number>=16) {lgg=5;computer.pp[b].d[1]=5;}else if(computer.pp[b].number<=23 && computer.pp[b].number>=20) {lgg=6;computer.pp[b].d[1]=6;}else if(computer.pp[b].number<=27 && computer.pp[b].number>=24) {lgg=7;computer.pp[b].d[1]=7;computer.pp[b].d[1]=8;}else if(computer.pp[b].number<=35 && computer.pp[b].number>=32) {lgg=9;computer.pp[b].d[1]=9;}}else if(computer.pp[b].number<=71 && computer.pp[b].number>=36) {lg=2;computer.pp[b].d[0]=2;if(computer.pp[b].number<=39 && computer.pp[b].number>=36) {lgg=1;computer.pp[b].d[1]=1;}else if(computer.pp[b].number<=43 && computer.pp[b].number>=40) {lgg=2;computer.pp[b].d[1]=2;}else if(computer.pp[b].number<=47 && computer.pp[b].number>=44) {lgg=3;computer.pp[b].d[1]=3;}else if(computer.pp[b].number<=51 && computer.pp[b].number>=48) {lgg=4;computer.pp[b].d[1]=4;}else if(computer.pp[b].number<=55 && computer.pp[b].number>=52) {lgg=5;computer.pp[b].d[1]=5;}else if(computer.pp[b].number<=59 && computer.pp[b].number>=56) {lgg=6;computer.pp[b].d[1]=6;}else if(computer.pp[b].number<=63 && computer.pp[b].number>=60) {lgg=7;computer.pp[b].d[1]=7;}else if(computer.pp[b].number<=67 && computer.pp[b].number>=64) {else if(computer.pp[b].number<=71 && computer.pp[b].number>=68) {lgg=9;computer.pp[b].d[1]=9;}}else if(computer.pp[b].number<=107 && computer.pp[b].number>=72) {lg=3;computer.pp[b].d[0]=3;if(computer.pp[b].number<=75 && computer.pp[b].number>=72){lgg=1;computer.pp[b].d[1]=1;}else if(computer.pp[b].number<=79 && computer.pp[b].number>=76) {lgg=2;computer.pp[b].d[1]=2;}else if(computer.pp[b].number<=83 && computer.pp[b].number>=80) {lgg=3;computer.pp[b].d[1]=3;}else if(computer.pp[b].number<=87 && computer.pp[b].number>=84) {lgg=4;computer.pp[b].d[1]=4;}else if(computer.pp[b].number<=91 && computer.pp[b].number>=88) {lgg=5;computer.pp[b].d[1]=5;}else if(computer.pp[b].number<=95 && computer.pp[b].number>=92) {lgg=6;computer.pp[b].d[1]=6;}else if(computer.pp[b].number<=99 && computer.pp[b].number>=96) {lgg=7;computer.pp[b].d[1]=7;}else if(computer.pp[b].number<=103 && computer.pp[b].number>=100) {lgg=8;computer.pp[b].d[1]=8;}else if(computer.pp[b].number<=107 && computer.pp[b].number>=104)computer.pp[b].d[1]=9;}}else if(computer.pp[b].number<=135 && computer.pp[b].number>=108) {lg=4;computer.pp[b].d[0]=4;if(computer.pp[b].number<=111 && computer.pp[b].number>=108) {lgg=1;computer.pp[b].d[1]=1;}else if(computer.pp[b].number<=115 && computer.pp[b].number>=112) {lgg=2;computer.pp[b].d[1]=2;}else if(computer.pp[b].number<=119 && computer.pp[b].number>=116) {lgg=3;computer.pp[b].d[1]=3;}else if(computer.pp[b].number<=123 && computer.pp[b].number>=120) {lgg=4;computer.pp[b].d[1]=4;}else if(computer.pp[b].number<=127 && computer.pp[b].number>=124) {lgg=5;computer.pp[b].d[1]=5;}else if(computer.pp[b].number<=131 && computer.pp[b].number>=128) {lgg=6;computer.pp[b].d[1]=6;}else if(computer.pp[b].number<=135 && computer.pp[b].number>=132) {lgg=7;computer.pp[b].d[1]=7;}}ch[b].lg=lg; /*保存电脑手里的每张牌的信息*/ ch[b].lgg=lgg;lg=0;lgg=0;b++;}if(pg==2) /*乓*/{sing=1;b=computer.m;while(b!=-1){if(strcmp(me.pp[c].k,computer.pp[b].k)==0) computer.pp[b].p=1;b--;}}if(pg==3) /*杠*/{sing=2;b=computer.m;while(b!=-1){if(strcmp(me.pp[c].k,computer.pp[b].k)==0) computer.pp[b].g=1;b--;}}f=0;while(f<computer.m) /*吃的判断*/{ if(ch[f].lg==logo && ch[f].lg!=4){if(ch[f+1].lgg-ch[f].lgg==1) /*顺吃*/if(ch[f].lgg-logoo==1){gp++;computer.pp[f].c=1;computer.pp[f+1].c=1;}if(ch[f].lgg-ch[f+1].lgg==-1) /*逆吃*/if(ch[f+1].lgg-logoo==-1){gp++;computer.pp[f].c=1;computer.pp[f+1].c=1;}if(ch[f].lgg-logoo==-1) /*中吃*/computer.pp[f].c=1;computer.pp[f+1].c=1;}if(gp==1)break;}f++;}if(gp==1){sing=7;}pg=0;gp=0;b=0;}void rgznme(int c) /*本程序涵数的核心针对我的牌*/{ int b=0,lg,lgg,logo,logoo,pg=0,gp=0,cs=0,f=0;if(computer.pp[c].number<=35 && computer.pp[c].number>=0){logo=1;if(computer.pp[c].number<=3 && computer.pp[c].number>=0) logoo=1;else if(computer.pp[c].number<=7 && computer.pp[c].number>=4) logoo=2;else if(computer.pp[c].number<=11 && computer.pp[c].number>=8) logoo=3;else if(computer.pp[c].number<=15 && computer.pp[c].number>=12) logoo=4;else if(computer.pp[c].number<=19 && computer.pp[c].number>=16) logoo=5;else if(computer.pp[c].number<=23 && computer.pp[c].number>=20) logoo=6;else if(computer.pp[c].number<=27 && computer.pp[c].number>=24) logoo=7;else if(computer.pp[c].number<=31 && computer.pp[c].number>=28) logoo=8;else if(computer.pp[c].number<=35 && computer.pp[c].number>=32) logoo=9;}else if(computer.pp[c].number<=71 && computer.pp[c].number>=36) {logo=2;if(computer.pp[c].number<=39 && computer.pp[c].number>=36) logoo=1;else if(computer.pp[c].number<=43 && computer.pp[c].number>=40) logoo=2;else if(computer.pp[c].number<=47 && computer.pp[c].number>=44) logoo=3;else if(computer.pp[c].number<=51 && computer.pp[c].number>=48)else if(computer.pp[c].number<=59 && computer.pp[c].number>=56) logoo=6;else if(computer.pp[c].number<=63 && computer.pp[c].number>=60) logoo=7;else if(computer.pp[c].number<=67 && computer.pp[c].number>=64) logoo=8;else if(computer.pp[c].number<=71 && computer.pp[c].number>=68) logoo=9;}else if(computer.pp[c].number<=107 && computer.pp[c].number>=72) {logo=3;if(computer.pp[c].number<=75 && computer.pp[c].number>=72) logoo=1;else if(computer.pp[c].number<=79 && computer.pp[c].number>=76) logoo=2;else if(computer.pp[c].number<=83 && computer.pp[c].number>=80) logoo=3;else if(computer.pp[c].number<=87 && computer.pp[c].number>=84) logoo=4;else if(computer.pp[c].number<=91 && computer.pp[c].number>=88) logoo=5;else if(computer.pp[c].number<=95 && computer.pp[c].number>=92) logoo=6;else if(computer.pp[c].number<=99 && computer.pp[c].number>=96) logoo=7;else if(computer.pp[c].number<=103 && computer.pp[c].number>=100) logoo=8;else if(computer.pp[c].number<=107 && computer.pp[c].number>=104) logoo=9;}else if(computer.pp[c].number<=135 && computer.pp[c].number>=108) {logo=4;if(computer.pp[c].number<=111 && computer.pp[c].number>=108) logoo=1;else if(computer.pp[c].number<=115 && computer.pp[c].number>=112) logoo=2;else if(computer.pp[c].number<=119 && computer.pp[c].number>=116) logoo=3;else if(computer.pp[c].number<=123 && computer.pp[c].number>=120) logoo=4;else if(computer.pp[c].number<=127 && computer.pp[c].number>=124) logoo=5;else if(computer.pp[c].number<=131 && computer.pp[c].number>=128) logoo=6;else if(computer.pp[c].number<=135 && computer.pp[c].number>=132) logoo=7;}while(b<=me.m){lg=1;me.pp[b].d[0]=1;if(me.pp[b].number<=3 && me.pp[b].number>=0){lgg=1;me.pp[b].d[1]=1;}else if(me.pp[b].number<=7 && me.pp[b].number>=4) {lgg=2;me.pp[b].d[1]=2;}else if(me.pp[b].number<=11 && me.pp[b].number>=8) {lgg=3;me.pp[b].d[1]=3;}else if(me.pp[b].number<=15 && me.pp[b].number>=12) {lgg=4;me.pp[b].d[1]=4;}else if(me.pp[b].number<=19 && me.pp[b].number>=16) {lgg=5;me.pp[b].d[1]=5;}else if(me.pp[b].number<=23 && me.pp[b].number>=20) {lgg=6;me.pp[b].d[1]=6;}else if(me.pp[b].number<=27 && me.pp[b].number>=24) {lgg=7;me.pp[b].d[1]=7;}else if(me.pp[b].number<=31 && me.pp[b].number>=28) {lgg=8;me.pp[b].d[1]=8;}else if(me.pp[b].number<=35 && me.pp[b].number>=32) {lgg=9;me.pp[b].d[1]=9;}}else if(me.pp[b].number<=71 && me.pp[b].number>=36) {if(me.pp[b].number<=39 && me.pp[b].number>=36){lgg=1;me.pp[b].d[1]=1;}else if(me.pp[b].number<=43 && me.pp[b].number>=40) {lgg=2;me.pp[b].d[1]=2;}else if(me.pp[b].number<=47 && me.pp[b].number>=44) {lgg=3;me.pp[b].d[1]=3;}else if(me.pp[b].number<=51 && me.pp[b].number>=48) {lgg=4;me.pp[b].d[1]=4;}else if(me.pp[b].number<=55 && me.pp[b].number>=52) {lgg=5;me.pp[b].d[1]=5;}else if(me.pp[b].number<=59 && me.pp[b].number>=56) {lgg=6;me.pp[b].d[1]=6;}else if(me.pp[b].number<=63 && me.pp[b].number>=60) {lgg=7;me.pp[b].d[1]=7;}else if(me.pp[b].number<=67 && me.pp[b].number>=64) {lgg=8;me.pp[b].d[1]=8;}else if(me.pp[b].number<=71 && me.pp[b].number>=68) {lgg=9;me.pp[b].d[1]=9;}}else if(me.pp[b].number<=107 && me.pp[b].number>=72) {lg=3;me.pp[b].d[0]=3;if(me.pp[b].number<=75 && me.pp[b].number>=72)}else if(me.pp[b].number<=79 && me.pp[b].number>=76) {lgg=2;me.pp[b].d[1]=2;}else if(me.pp[b].number<=83 && me.pp[b].number>=80) {lgg=3;me.pp[b].d[1]=3;}else if(me.pp[b].number<=87 && me.pp[b].number>=84) {lgg=4;me.pp[b].d[1]=4;}else if(me.pp[b].number<=91 && me.pp[b].number>=88) {lgg=5;me.pp[b].d[1]=5;}else if(me.pp[b].number<=95 && me.pp[b].number>=92) {lgg=6;me.pp[b].d[1]=6;}else if(me.pp[b].number<=99 && me.pp[b].number>=96) {lgg=7;me.pp[b].d[1]=7;}else if(me.pp[b].number<=103 && me.pp[b].number>=100) {lgg=8;me.pp[b].d[1]=8;}else if(me.pp[b].number<=107 && me.pp[b].number>=104) {lgg=9;me.pp[b].d[1]=9;}}else if(me.pp[b].number<=135 && me.pp[b].number>=108)if(me.pp[b].number<=111 && me.pp[b].number>=108) {lgg=1;me.pp[b].d[1]=1;}else if(me.pp[b].number<=115 && me.pp[b].number>=112) {lgg=2;me.pp[b].d[1]=2;}else if(me.pp[b].number<=119 && me.pp[b].number>=116) {lgg=3;me.pp[b].d[1]=3;}else if(me.pp[b].number<=123 && me.pp[b].number>=120) {lgg=4;me.pp[b].d[1]=4;}else if(me.pp[b].number<=127 && me.pp[b].number>=124) {lgg=5;me.pp[b].d[1]=5;}else if(me.pp[b].number<=131 && me.pp[b].number>=128) {lgg=6;me.pp[b].d[1]=6;}else if(me.pp[b].number<=135 && me.pp[b].number>=132) {lgg=7;me.pp[b].d[1]=7;}}}}void istwo(testt)int testt[];{ if(testt[0]==testt[1])second++;}void isthree(testt,n)int testt[],n=0;{ int i,j,flage=0,lianx=0,same=0;n=n/3;for(j=0;j<n;j++){for(i=j*3;i<2+j*3;i++)same++;if(testt[i+1]-testt[i]==1)lianx++;}if(same==2)threes++;if(lianx==2)threes++;same=0;lianx=0;}}void panduan() /*本程序的精髓*/{int data[14];int pw[14];int pt[14];int pi[14];int pf[14];int test[12];int jj,w,mm,nn,tpp=0,lp=0,ww=0,tt=0,ii=0,ff=0;ill=0; for(jj=0;jj<=me.m;jj++){if(me.pp[jj].d[0]==1)data[jj]=me.pp[jj].d[1];if(me.pp[jj].d[0]==2)data[jj]=me.pp[jj].d[1]+10;if(me.pp[jj].d[0]==3)data[jj]=me.pp[jj].d[1]+20;if(me.pp[jj].d[0]==4)data[jj]=me.pp[jj].d[1]+30;}if(logo==2)w=logoo+10;if(logo==3)w=logoo+20;if(logo==4)w=logoo+30;data[computer.m+1]=w;for(mm=0;mm<=computer.m;mm++)for(nn=mm;nn<=computer.m;nn++)if(data[mm]>data[nn+1]){tpp=data[mm];data[mm]=data[nn+1];data[nn+1]=tpp;}lp=0;while(lp<=computer.m){ if(data[lp]<10)pw[ww++]=data[lp];if(data[lp]>10 && data[lp]<20)pi[ii++]=data[lp];if(data[lp]>30 && data[lp]<38)pf[ff++]=data[lp];lp++;}if(ww==2)istwo(pw);else if(ww==3)isthree(pw,ww);else if(ww==5)/*pw[5]原始牌数组,假设已经升序排列*//*test[3]用来放置测试牌的数组*/for(i=0;i<4;i++){for(j=0;j<2;j++){test[j]=pw[i+j];}if(istwo(test)){ ill=0;for(kl=0;kl<5;kl++) /*把不在test数组中的三张放到test数组中*/ {if(kl==i){kl=kl+2;if(kl==5)break;}test[ill++]=pw[kl];}isthree(test);}}else if(ww==6)isthree(pw,ww);else if(ww==8)for(i=0;i<7;i++){for(j=0;j<2;j++){test[j]=pw[i+j];}if(istwo(test)){ ill=0;for(kl=0;kl<8;kl++) /*把不在test数组中的六张放到test数组中*/if(kl==8)break;}test[ill++]=pw[kl];}isthree(test,ww-2);}}else if(ww==9)isthree(pw,ww);else if(ww==11)for(i=0;i<10;i++){for(j=0;j<2;j++){test[j]=pw[i+j];}if(istwo(test)){ ill=0;for(kl=0;kl<11;kl++) /*把不在test数组中的九张放到test数组中*/ {if(kl==i){kl=kl+2;if(kl==11)break;}test[ill++]=pw[kl];}isthree(test,ww-2);}}else if(ww=12)isthree(pw,ww);else if(ww=14)for(i=0;i<13;i++){for(j=0;j<2;j++){test[j]=pw[i+j];}if(istwo(test)){ ill=0;for(kl=0;kl<11;kl++) /*把不在test数组中的九张放到test数组中*/ {if(kl==i){kl=kl+2;if(kl==14)break;}test[ill++]=pw[kl];}isthree(test,ww-2);。

(精选)关于棋牌游戏源代码开放

(精选)关于棋牌游戏源代码开放

(精选)关于棋牌游戏源代码开放棋牌游戏源代码开放是指游戏开发者将游戏的源代码开放给公众,使得任何人都可以查看、修改和使用这些代码。

这种开放源代码的做法在近年来越来越受到游戏开发者和玩家的青睐,因为它为游戏开发和创新提供了更多的可能性。

在本文中,我们将探讨棋牌游戏源代码开放的优势和劣势,以及对游戏行业的影响。

首先,让我们来看看棋牌游戏源代码开放的优势。

首先,开放源代码可以促进游戏开发的创新。

通过开放源代码,开发者可以共享他们的代码和技术,从而为其他开发者提供了更多的灵感和资源。

这种开放的环境可以促进游戏行业的不断发展和进步。

其次,开放源代码可以增加游戏的可玩性和持续性。

玩家可以通过修改游戏源代码来创建新的游戏模式、角色和地图,从而为游戏增加了更多的乐趣和挑战性。

此外,开放源代码还可以增加游戏的可信度和安全性。

由于开放源代码可以被公众审查,因此可以更容易地发现和修复游戏中的漏洞和问题,从而提高了游戏的质量和可靠性。

然而,棋牌游戏源代码开放也存在一些劣势。

首先,开放源代码可能会导致游戏的盗版和侵权问题。

一旦游戏的源代码被公开,就很难控制它的使用和传播。

这可能会导致游戏的盗版和侵权现象,从而损害了开发者的利益。

其次,开放源代码可能会增加游戏的安全风险。

由于游戏的源代码可以被公众访问,黑客和恶意用户可能会利用这些代码来攻击游戏的服务器和玩家的账户,从而造成严重的安全问题。

因此,开放源代码需要开发者采取更多的安全措施来保护游戏和玩家的利益。

尽管棋牌游戏源代码开放存在一些劣势,但它仍然对游戏行业产生了积极的影响。

首先,开放源代码可以促进游戏开发者之间的合作和交流。

通过共享源代码和技术,开发者可以相互学习和帮助,从而提高了整个行业的水平和竞争力。

其次,开放源代码可以增加游戏玩家的参与度和忠诚度。

玩家可以通过修改游戏源代码来定制自己喜欢的游戏内容,从而增加了他们对游戏的投入和喜爱。

此外,开放源代码还可以帮助游戏开发者更好地了解玩家的需求和反馈,从而更好地满足他们的期望和要求。

井字棋游戏源代码

井字棋游戏源代码

井字棋游戏源代码井字棋C语言源代码#include<graphics.h> #include<math.h>#include<dos.h>#include<bios.h>#include<conio.h> #include<string.h> #define ENTER 0x1c0d #define esc 0x11b #define up 0x4800 #define down 0x5000 #define left 0x4b00 #define right 0x4d00 int i,j,x1,y1,v,n,m,key,d,e,p,q,h,o,x,y,k;int a[3][3]={0,0,0,0,0,0,0,0,0};int score[3][3]={0,0,0,0,0,0,0,0,0};char s [30];int main(){void drawone();void drawtwo();void drawthree(); void drawfour();void drawfive();void drawsix();void xianka();int renzouqi();int xuanze();int py( int a[][3]); int jisuanji();int xuanzeyouxi(); int bioskey(int cmd); xianka();drawone();if((key=bioskey(0))==ENTER) drawtwo();key=bioskey(0);if(key==ENTER)drawfour();v=1;while(v==1){drawthree();n=xuanze();x1=220; y1=230;circle(220,230,20);o=pan_y(a);while(o==2) {if(n==1)n=renzouqi();if(n==-1)n=jisuanji();o=pan_y(a);}drawsix();getch();drawfive();v=xuanzeyouxi();}closegraph();}/*显卡驱动*/void xianka(){int graphdriver,graphmode;int driver=DETECT,mode;initgraph(&driver,&mode,""); graphdriver=DETECT;initgraph(&graphdriver,&graphmode,""); }/*定义判赢函数*/int pan_y(int a[][3]){int n,b,c,i,j,k=2;for(i=0;i<3;i++){n=a[i][0]; b=a[i][1]; c=a[i][2];if(n+b+c==3) k=1;if(n+b+c==-3) k=-1;}for(j=0;j<3;j++){n=a[0][j];b=a[1][j];c=a[2][j];if(n+b+c==3) k=1;if(n+b+c==-3) k=-1;}n=a[0][0]; b=a[1][1]; c=a[2][2];if(n+b+c==3) k=1;if(n+b+c==-3) k=-1;n=a[0][2]; b=a[1][1]; c=a[2][0];if(n+b+c==3) k=1;if(n+b+c==-3) k=-1;if(a[0][0]!=0&&a[0][1]!=0&&a[0][2]!=0&&a[1][0]!=0&&a[1][1]!=0&&a[1][ 2]!=0&&a[2][0]!=0&&a[2][1]!=0&&a[2][2]!=0)k=0;return k;}/*选择哪一方先下*/int xuanze(){key=bioskey(0);n=-1;while(key!=ENTER){if(key==up){setfillstyle(1,3);floodfill(471,150,4);setfillstyle(1,14);floodfill(471,200,4);n=-1; }if(key==down){setfillstyle(1,14);floodfill(471,150,4);setfillstyle(1,3);floodfill(550,200,4);n=1; }key=bioskey(0);}return n;}/*界面1*/void drawone() {for(i=1;i<6;i++){setcolor(i);settextstyle(0,HORIZ_DIR,i); outtextxy(250-43*i,80*i,"Welcome To You");}setcolor(10);settextstyle(0,VERT_DIR,2); outtextxy(20,80,"*** How Do You Do ***");settextstyle(0,VERT_DIR,2); outtextxy(620,80,"*** How Do You Do***");setcolor(13);line(20,0,20,479);line(22,0,22,479);line(600,0,600,479);line(602,0,602,479);}/*界面2*/void drawtwo() {cleardevice();setbkcolor(2);setviewport(0,0,639,479,0); settextstyle(1,0,6);setfillstyle(1,12);rectangle(230,10,370,280); floodfill(150,350,13); settextstyle(1,0,5);setbkcolor(0);outtextxy(250,10,"Jing"); outtextxy(280,100,"Zi"); outtextxy(280,200,"Qi"); settextstyle(1,0,3);setcolor(0);outtextxy(250,300,"Designed by: Zhang Kai Xuan");outtextxy(402,350,"Yang Shao Hua");outtextxy(402,400,"Ren Jian"); }/*界面3*/void drawthree() {cleardevice();setbkcolor(14);setviewport(0,0,639,479,1); setfillstyle(1,2);setcolor(4);line(70,180,370,180);line(70,280,370,280);line(170,80,170,380);line(270,80,270,380);line(470,180,570,180); rectangle(470,130,570,230); setfillstyle(1,3);floodfill(500,150,4);settextstyle(1,0,2);outtextxy(475,190,"person"); outtextxy(475,140,"computer");settextstyle(3,0,1);outtextxy(468,260,"person");circle(557,274,10);setfillstyle(1,13);floodfill(555,274,4);outtextxy(468,300,"computer"); circle(557,308,10);setfillstyle(1,3);floodfill(555,300,4);}/*界面4*/void drawfour() {int i,x5=300,y5=200,r=100,x6=350,y6=200;cleardevice();setbkcolor(8);setcolor(14);settextstyle(1,0,5);setviewport(0,0,639,479,0); for(i=0;i<800;i++){x6=x5+r*cos(i*2*3.1415926/50); y6=y5+r*sin(i*2*3.1415926/50); setcolor(i%15);line(x5,y5,x6,y6);outtextxy(222,350,"Loading.....");}}/*界面5*/void drawfive() {cleardevice();setviewport(0,0,639,479,1);circle(120,240,30);setfillstyle(1,3);circle(115,225,4);circle(135,225,4);floodfill(115,225,2);floodfill(135,225,2);setfillstyle(1,7);floodfill(120,240,2);line(115,251,133,247);settextstyle(1,0,1);outtextxy(400,400,"choose quit or new game");outtextxy(381,325,"NEW");outtextxy(480,325,"QUIT");settextstyle(1,0,5);if(o==-1)outtextxy(200,230,"You lost! Come on!");if(o==1)outtextxy(200,230,"You win!");if(o==0)outtextxy(200,230,"DRAW!"); circle(400,330,25); circle(500,330,25); setfillstyle(1,12); floodfill(400,330,2); }/*界面6*/void drawsix() {settextstyle(1,0,5); setcolor(2);outtextxy(110,410,"GAME OVER!");}/*人下棋*/int renzouqi(){key=bioskey(0);while(key!=ENTER){if(key==up){x=x1; y=y1-100;if(y>80){ setcolor(14);circle(x1,y1,20);setcolor(4);circle(x,y,20);x1=x; y1=y; }}if(key==down){x=x1; y=y1+100;if(y<380){ setcolor(14); circle(x1,y1,20); setcolor(4);circle(x,y,20);x1=x; y1=y; }}if(key==left){x=x1-100; y=y1;if(x>70){ setcolor(14); circle(x1,y1,20); setcolor(4);circle(x,y,20);x1=x; y1=y; }}if(key==right){x=x1+100; y=y1;if(x<370){ setcolor(14); circle(x1,y1,20); setcolor(4);circle(x,y,20);x1=x; y1=y; }}key=bioskey(0);}if(a[(x1-120)/100][(y1-130)/100]==0){ setfillstyle(1,13);floodfill(x1,y1,4);d=(x1-120)/100;e=(y1-130)/100;a[d][e]=1;n=-1;}else n=1;return n; }/*计算机下棋*/int jisuanji() {for(i=0;i<3;i++){for(j=0;j<3;j++){if(a[i][j]!=0) score[i][j]=-2;}}for(i=0;i<3;i++){m=a[i][0]; p=a[i][1]; q=a[i][2];if(m+p+q==2){ if(m==0) score[i][0]=25; if(p==0) score[i][1]=25;if(q==0) score[i][2]=25;}if(m+p+q==-2){ if(m==0) score[i][0]=50; if(p==0) score[i][1]=50;if(q==0) score[i][2]=50;}if(m+p+q==1){ if(p==0 && q==0)score[i][1]=score[i][2]=8;if(m==0 && q==0)score[i][0]=score[i][2]=8;if(p==0 && p==0)score[i][1]=score[i][0]=8;}if(m+p+q==-1){ if(p==0 && q==0)score[i][1]=score[i][2]=10;if(m==0 && q==0)score[i][0]=score[i][2]=10;if(p==0 && m==0)score[i][1]=score[i][0]=10;}if(m+p+q==0){ if(m==0 && p==0 && q==0) score[i][0]=score[i][1]=score[i][2]=4; }}/*end横*/for(i=0;i<3;i++){m=a[0][i]; p=a[1][i]; q=a[2][i];if(m+p+q==2){ if(m==0) {if(score[0][i]<25) score[0][i]=25;}if(p==0) {if(score[1][i]<25) score[1][i]=25;}if(q==0) {if(score[2][i]<25) score[2][i]=25;}}if(m+p+q==-2){ if(m==0) {if(score[0][i]<50) score[0][i]=50;}if(p==0) {if(score[0][i]<50) score[1][i]=50;}if(q==0) {if(score[0][i]<50) score[2][i]=50;}}if(m+p+q==1){ if(p==0 && q==0) { if(score[1][i]<8) score[1][i]=8;if(score[2][i]<8) score[2][i]=8;}if(m==0 && q==0) { if(score[0][i]<8) score[0][i]=8;if(score[2][i]<8) score[2][i]=8;}if(p==0 && m==0) { if(score[1][i]<8) score[1][i]=8;if(score[0][i]<8) score[0][i]=8;}}if(m+p+q==-1){ if(p==0 && q==0) { if(score[1][i]<10) score[1][i]=10; if(score[2][i]<10) score[2][i]=10;}if(m==0 && q==0) { if(score[0][i]<10) score[0][i]=10;if(score[2][i]<10) score[2][i]=10;}if(p==0 && m==0) { if(score[1][i]<10) score[1][i]=10;if(score[0][i]<10) score[0][i]=10;}if(m+p+q==0){ if(m==0 && p==0 && q==0) {if(score[0][i]<4) score[0][i]=4;if(score[1][i]<4) score[1][i]=4;if(score[2][i]<4) score[2][i]=4;}}}/*end竖*/m=a[0][0]; p=a[1][1]; q=a[2][2];if(m+p+q==2){ if(m==0) {if(score[0][0]<25) score[0][0]=25;}if(p==0) {if(score[1][1]<25) score[1][1]=25;}if(q==0) {if(score[2][2]<25) score[2][2]=25;}}if(m+p+q==-2){ if(m==0) {if(score[0][0]<50) score[0][0]=50;}if(p==0) {if(score[1][1]<50) score[1][1]=50;}if(q==0) {if(score[2][2]<50) score[2][2]=50;}}if(m+p+q==1){ if(p==0 && q==0) { if(score[1][1]<8) score[1][1]=8;if(score[2][2]<8) score[2][2]=8;}if(m==0 && q==0) { if(score[0][0]<8) score[0][0]=8;if(score[2][2]<8) score[2][2]=8;}if(p==0 && m==0) { if(score[1][1]<8) score[1][1]=8;if(score[0][0]<8) score[0][0]=8;}}if(m+p+q==-1){ if(p==0 && q==0) { if(score[1][1]<10) score[1][1]=10; if(score[2][2]<10) score[2][2]=10;}if(m==0 && q==0) { if(score[0][0]<10) score[0][0]=10;if(score[2][2]<10) score[2][2]=10;}if(p==0 && m==0) { if(score[1][1]<10) score[1][1]=10;if(score[0][0]<10) score[0][0]=10;}}if(m+p+q==0){ if(m==0 && p==0 && q==0) {if(score[0][0]<4) score[0][0]=4;if(score[1][1]<4) score[1][1]=4;if(score[2][2]<4) score[2][2]=4;}}}/*斜扫描*/m=a[0][2]; p=a[1][1]; q=a[2][0];if(m+p+q==2){ if(m==0) {if(score[0][2]<25) score[0][2]=25;}if(p==0) {if(score[1][1]<25) score[1][1]=25;}if(q==0) {if(score[2][0]<25) score[2][0]=25;}}if(m+p+q==-2){ if(m==0) {if(score[0][2]<50) score[0][2]=50;}if(p==0) {if(score[1][1]<50) score[1][1]=50;}if(q==0) {if(score[2][0]<50) score[2][0]=50;}}if(m+p+q==1){ if(p==0 && q==0) { if(score[1][1]<8) score[1][1]=8; if(score[2][0]<8) score[2][0]=8;}if(m==0 && q==0) { if(score[2][0]<8) score[2][0]=8;if(score[0][2]<8) score[0][2]=8;}if(p==0 && m==0) { if(score[1][1]<8) score[1][1]=8;if(score[0][2]<8) score[0][2]=8;}}if(m+p+q==-1){if(p==0 && q==0) { if(score[1][1]<10) score[1][1]=10; if(score[2][0]<10) score[2][0]=10;}if(m==0 && q==0) { if(score[0][2]<10) score[0][2]=10; if(score[2][0]<10) score[2][0]=10;}if(p==0 && m==0) { if(score[1][1]<10) score[1][1]=10; if(score[0][2]<10) score[0][2]=10;}}if(m+p+q==0){ if(m==0 && p==0 && q==0) {if(score[0][2]<4) score[0][2]=4;if(score[1][1]<4) score[1][1]=4;if(score[2][0]<4) score[2][0]=4;}}/*斜扫描*/h=k=1;for(i=0;i<3;i++) {for(j=0;j<3;j++) {if(score[i][j]>score[h][k]){h=i; k=j; }}}x1=120+100*h;y1=130+100*k;circle(x1,y1,20);setfillstyle(1,3);floodfill(x1,y1,4);a[h][k]=-1;n=1;for(i=0;i<3;i++){for(j=0;j<3;j++)score[i][j]=0;}return n;}/*重新开始游戏*/int xuanzeyouxi() {key=bioskey(0);while(key!=ENTER){if(key==left){ setfillstyle(1,12); floodfill(400,330,2); setfillstyle(1,14); floodfill(500,330,2); settextstyle(1,0,2); v=1;}if(key==right){ setfillstyle(1,12); floodfill(500,330,2); setfillstyle(1,14); floodfill(400,330,2); v=0;}key=bioskey(0);}for(i=0;i<3;i++){ for(j=0;j<3;j++){ a[i][j]=0;}}return v;}。

扑克牌游戏c源代码

扑克牌游戏c源代码

扑克牌游戏c++源代码/*第1题扑克牌游戏--源代码及关键源代码注解如下:*///* This Program was written entirely by the author Frank Vokoun.//*******************preprocessor directives***********************//#include &lt;iostream.h&gt;#include &lt;string.h&gt;#include &lt;conio.h&gt;#include &lt;stdlib.h&gt;#include &lt;stdio.h&gt;#include &lt;time.h&gt;// used to seed the random number generator////*********************************************************************** class Playing_Card //扑克类{private:int m_Value;char m_Face[3]; //扑克的数字大小char m_Suit ; //扑克的花色(黑、红、梅、方)public:Playing_Card();// CONSTRUCTORvoid showcard();// Displays an object of class Playing_Card void Card_Make(int);};class Deck//一副扑克(52张){private:Playing_Card m_cardarray[52];// Object array of class Playing_Cardint m_lastdelt;public:Deck();// CONSTRUCTOR initializes empty Deck objectvoid MakeDeck();// makes a complete object of class Deckvoid Deal_One();// Deals a card from top of the deckvoid ShowDeck();// Displays a Deck object to the screenvoid DeckShuff(int);// &quot;Shuffles&quot; a Deck object for int timesvoid Remove_Card();// Removes used card from Deck Prevents};//mistakenly using a nonexistant card //can bu used to send a card ??//***************************prototypes**********************************void Program_Init();// Program informationint main();void Center_Text(char []);// Centers textint get_number();// Gets a integer from userchar Get_Key();// Gets a char from user, pauses programvoid DeckMakeDriver();// Tests Several Functions including Makedeck int getRandInt(int min, int max);// Random number generatorvoid prog_close();// pauses before program termination//****************************Main*************************************int main()//************************************************************************** //*int main:Main Function Calls other functions//*//*expects:None.//*Returns:Integer 0;//*Side effects None//*//*Tasks(1) Seeds the Random number generator//*(2) Calls Program Init function for Title etc.//*(3) Call DeckMakeDriver to Test MakeDeck and DeckShuff.//*//***********************************************************************{srand( (unsigned)time( NULL ) );// Seeds GetRandIntint Card_Number = 0;Program_Init();// Showd title etc.DeckMakeDriver();// The Main Function Driver Tests Deck and//Playing_Card classesprog_close();// pauses screen outputreturn 1;}Playing_Card::Playing_Card()// CONSTRUCTOR//************************************************************************** //*Playing_Card Playing_Card CONSTRUCTOR FOR CLASS Playing_Card//*//*expects:None.//*Returns:None//*Side effects None//*//*Tasks Constructs object of class playing_card replaces default constructor//*********************************************************************// Constructor replaces default constructor{int i;for(i=1;i&lt;=3;)// inits string variable to blanks{m_Face[i] = &#39; &#39;;i++;}m_Suit = &#39; &#39;;// inits char variable to blankm_Value = 0;}void Program_Init()//************************************************************************* //*void Program_Init():Shows Title//*//*expects None//*returns:None//*Side Effects:Text is centered on screen//*//*Task(s)Output program information to screen.//*//***********************************************************************{Center_Text(&quot;Lab #5&quot;);cout &lt;&lt; endl;Center_Text(&quot;A Deck Driver&quot;);cout &lt;&lt; endl &lt;&lt;&quot;\n&quot; ;Center_Text(&quot;By Frank Vokoun&quot;);cout &lt;&lt; endl &lt;&lt;&quot;\n&quot; ;Center_Text(&quot;(C) 2001, Frank Vokoun&quot;);cout &lt;&lt; endl &lt;&lt;&quot;\n&quot; ;Center_Text(&quot;Hit the &lt;Return&gt; key to Continue..&quot;);cin.get();}char Get_Key()//*********************************************************************** //*char Get_Key():Uses a input prompt to get a char//*//*expects:None.//*Returns:Input char.//*Side effects:Pauses Program execution (desired effect).//*//*Task(s):Gets a char from the user..//*//********************************************************************** {char x;x = cin.get();cout &lt;&lt; endl;return x;}void Playing_Card::showcard()//*****************************************************************//*void showcard(card):Displays a Playing Cards object to the screen//*//* Expects:None -&gt; Uses calling members Playing_Card object//* Returns:None//* Side Effects:Displays//*//*Task(s):Displays the object of class Playing_Card to screen//*//*********************************************************************** {cout &lt;&lt; &quot; &quot;;cout &lt;&lt; m_Face ;cout.width(1);cout &lt;&lt; m_Suit;cout &lt;&lt; &quot; &quot;;}void Center_Text(char ShellText[80])//********************************************************************** //*Void Center_Text:Displays text centered on the screen.//*//*expects:The text to display.//*Returns:None.//*Side effects:Outputs Centered text on screen.//*//*******************************************************************{int length;int center;length= strlen(ShellText);center = (80 - length)/2;for(;center!=0;center--){cputs(&quot; &quot;);}cputs(ShellText);}int get_number()//******************************************************************** //*//*int get_number:Gets an integer from the user.//*expects:None.//*Returns:Integer.//*Side effects:None.//*Task(s):Asks the user to enter an integer then returnsthat integer.//*.//********************************************************************** {int Input_Integer = 0;Center_Text(&quot;Please enter an integer between 0 and 51. 52 to quit.&quot;);cout &lt;&lt; endl;cin &gt;&gt; Input_Integer;return Input_Integer;}void Playing_Card::Card_Make(int num)//********************************************************************* //* Get_Card(int):Creates a Playing_Card object based on an interger input.//* Expects:int//* Returns:None -&gt; uses Calling members Playing_Card object//* Side Effects:None//*//*Tasks: 1. assign a face value//* 2. assign a m_Suit(char type)//* 3. assign a point value//*//******************************************************************** {int i = 0;char j;int face_num = num % 13;switch(face_num)// Assigns a Face value for string cards{case 0: strcpy(m_Face,&quot; A&quot;);break;case 9: strcpy(m_Face,&quot;10&quot;);break;case 10: strcpy(m_Face,&quot; J&quot;);break;case 11: strcpy(m_Face,&quot; Q&quot;);break;case 12: strcpy(m_Face,&quot; K&quot;);break;default:j = char(face_num + 49);// Fills string with number mod 13if(i&lt;3){m_Face[i] = &#39; &#39;; i++;m_Face[i] = j;i++;m_Face[i] = NULL;break;}}if(num &lt;= 12)m_Suit = 6;// assigns suit use ascii values forif(num &gt;12 &amp;&amp; num &lt;= 25)m_Suit = 3;//card symbolsif(num &gt;25 &amp;&amp; num &lt;= 38)m_Suit = 5;if(num &gt;38 &amp;&amp; num &lt;= 51)m_Suit = 4;if(face_num &lt;= 9)m_Value = face_num + 1;// Card value&#39;s Ace = 1 if(face_num &gt;= 10)m_Value = 10;}void DeckMakeDriver()//********************************************************************//* DeckMakeDriver():Used to test the various deck functions Deckmake,//*Deckshuff, Deckcopy etc.//*Expects:None.//* Returns:None.//* Side effects:None//*//* Tasks: 1. Call make Deck//* 2. Show Deck//* 3. Call shuffle//* 4. Call show deck//* 5. While !Done Call//* a. Deal one//* b. Show card//*//*Note the dot operator is need to access object because this is not a member of the class //**********************************************************************{Deck deck_1;deck_1.MakeDeck();// Creates the Deck.deck_1.ShowDeck();// Displays deck to screen.Get_Key();// Pauses Program.deck_1.DeckShuff(250);// Shuffles the deck 250 timesdeck_1.ShowDeck();// Displays deck to screen.cout &lt;&lt; endl &lt;&lt;endl &lt;&lt; endl;char y;do{deck_1.Deal_One();cout &lt;&lt; endl;cout &lt;&lt; endl &lt;&lt; endl &lt;&lt; &quot;Y to Deal One more N to quit&quot;&lt;&lt; endl;cin &gt;&gt; y;y = toupper(y);}while(y == &#39;Y&#39; );}void Deck::MakeDeck()// creates a full deck not a construct//************************************************************************** //* Deck Make Deck():Creates a Deck Object//* Expects:none -&gt; uses calling functions deck object//*Returns:none -&gt; uses calling functions Deck object //* Side effects:none//* Tasks: 1. Create a Full Deck structure of unique card structures//* a. have the decks last delt variable = to the top card//***********************************************************************{m_lastdelt = 51;// Set Deck to emptywhile(m_lastdelt &gt;-1)// iterate until deck is full.{m_cardarray[m_lastdelt].Card_Make(m_lastdelt); // call card make for every card object m_lastdelt--;// inside the deck object ie cardarray}}void Deck::ShowDeck()//********************************************************************//* void ShowDeck:Displays the deck in a organized readable fashion to the screen //* Expects:none shows calling functions object of class deck//* Returns:none//* Side Effects:None//* Tasks: 1. set an index to lastdealt + 1//* 2. call ShowCard passing in card[index]//*********************************************************************{int index = m_lastdelt + 1;int newline = 0;Center_Text(&quot;Current Deck of Cards from top to bottom&quot;);cout &lt;&lt; endl;while(index&lt;=51){if(newline % 11 == 0) cout &lt;&lt; endl;m_cardarray[index].showcard();// calls showcard for every card innewline++;// the cardarray objectindex++;}}int getRandInt(int min, int max)//*********************************************************************//*int GetRandInt:Returns a random number between min and max//*//* BORROWED FUNCTION:Used with permission from Prof. Steve Samuelson.//*//*Expects:min -- smallest possible number to return//*max -- largest possible number to return//* Returns: A number between min and max//* Side Effects:None//*//* Tasks: 1. set a num = to random number generator.//* 2. make num = num % (max - min +1); add min.//* 3. Return the num//*******************************************************************{int numToReturn;numToReturn = rand();numToReturn = numToReturn % (max - min + 1) + min;return numToReturn;}void Deck::DeckShuff( int times) //洗牌次数//********************************************************************//*Deck DeckShuff(Deck, int):Simulates the shuffling of a deck of cards//*expects:none -&gt; uses calling functions Deck object//*Returns:none -&gt; manipulates calling functions object of class Deck USING //* A THIS POINTER//*Side effects:no unintended effects.//*//*Task(s) 1. To randomly arrange the elements of the Deck structure Playing_Card//*array.//* A. split the Deck structure into two halves at a random location//*between 20 and 35.//* B. Alternating between the two halves move a random number of //*Playing_Card structures to the original deck structure, Until//*it is full of cards (52cards in a deck).* this is also the//*number of cards available in the to halves.//* C. Since it is a full unused deck set the lastdelt variable to -1//*//*//*********************************************************************{int x, split; //split是分开成两部分的位置,如上部分、下部分Center_Text(&quot;Shuffling Deck&quot;);cout &lt;&lt; endl;for(x=0;x&lt;=times;x++)// iterate input number of times {split = getRandInt(20,35);// Get split locationDeck topdeck;// Create 2 new unfilled decks Deck bottomdeck;int i;int bottomdeckindex = 1;int topdeckindex = 1;for(i=0;i&lt;=split - 1;){topdeck.m_cardarray[topdeckindex] = this-&gt;m_cardarray[i];topdeckindex++;i++;}for(i=(split);i&lt; 52;)// move remaining cards to bottom deck{bottomdeck.m_cardarray[bottomdeckindex] = this-&gt;m_cardarray[i]; bottomdeckindex++;i++;}int deckoutindex = 0;// set deck to fill&#39;s index to zeroint numcardstomovetop;int numcardstomovebottom;int j;int h = 0;bottomdeckindex = 52 - split;// set index to num cards in bottom topdeckindex =split;// set index to num cards in topwhile(deckoutindex &lt;= 51){numcardstomovetop = getRandInt(2,7);//从上部分抽取的张数,是2-7之间的随机数numcardstomovebottom = getRandInt(2,7);// Move a random number of cards(2-7)for(j=0;j &lt;=numcardstomovebottom;j++)//from bottomdeck to original deck{if(bottomdeckindex &gt; 0)// check for available cards{this-&gt;m_cardarray[deckoutindex] = bottomdeck.m_cardarray[bottomdeckindex]; deckoutindex++;bottomdeckindex--;}for(h=0;h&lt;=numcardstomovetop;h++)// Move a random number of cards (2 to 7){//from topdeck to original deck.if((topdeckindex &gt; 0) &amp;&amp; (deckoutindex &lt;=52))// check for available cards{//and slotsthis-&gt;m_cardarray[deckoutindex]=topdeck.m_cardarray[topdeckindex]; deckoutindex++;topdeckindex--;}}}}}this-&gt;m_lastdelt = -1;// Return a complete shuffled deck}void prog_close()//*******************************************************************//*void prog_close:Waits for user input to end//*Inputs:None//*Returns:None//*Side effects:Output text to screen/waits for user input to//*end program.//*//*task(s) 1. Pauses Program so the last output can be seen//*//*********************************************************************** {cout &lt;&lt; endl &lt;&lt; endl;cout &lt;&lt; &quot; Hit the &lt;Return&gt; key to Continue..&quot; &lt;&lt; endl;cout &lt;&lt; endl &lt;&lt; endl;Get_Key();// Necesary for clear input.cin.get();}void Deck::Remove_Card()//*****************************************************************//* Deck Remove_Card(Deck deck_1):Removes the card delt from dealing deck.//*Expects:The Deck that delt the card.//*Returns:The Deck without the card delt.//*Side effects:None.//*//*Task(s):Remove card delt from Deck//****************************************************************{m_cardarray[m_lastdelt]= Playing_Card();// reinits used card prevents mistakes}void Deck::Deal_One()//************************************************************************** *****************//* Deck Deal one(Deck):Deals a card from the top of the deck//* Expects: A deck to deal from//* Returns:The deck minus the card delt//* Side effects:lastdealt in the deck is incremented//*//* Tasks: 1. Check if lastdealt = 51 if so Error//* 2. Increment last dealt//* 3. Return card[last dealt]//************************************************************************** {if(m_lastdelt != 51)// Checks for available cards{m_lastdelt++;cout.width(5);cout &lt;&lt;&quot; Card delt&quot;;m_cardarray[m_lastdelt].showcard();}else{cout &lt;&lt; &quot;Out of range Error&quot;;prog_close();}}Deck :: Deck()// CONSTRUCTOR replaces default//**********************************************************************//* Deck Deck Class Deck CONSTRUCTOR//* Expects: A deck to deal from//* Returns:The deck minus the card delt//* Side effects:lastdealt in the deck is incremented//*//* Tasks: 1. Check if lastdealt = 51 if so Error//* 2. Increment last dealt//* 3. Return card[last dealt]//******************************************************************* {int lastdelt = 0;int i;for(i=0;i&lt;=51;i++){m_cardarray[1] = Playing_Card();// calls constructor class Playing_Card}// for every Playing_Card object in}// the class Deck&#39;s array.。

C语言五子棋游戏源代码

C语言五子棋游戏源代码

C语言五子棋游戏源代码SANY GROUP system office room 【SANYUA16H-#include<stdio.h>#define N 10void welcome();void initqipan();void showqi(int i);void save(int p);void panduan(int p);void heqi();void over();int zouqihang();int zouqilie();/******************结构体*****************/ struct zuobiao{int x[N*N];int y[N*N];}weizhi[N*N];/******************主函数*****************/ void main(){int p=0;welcome();initqipan();for(p=1;p<=N*N;p++){weizhi[p].x[p]=zouqihang();weizhi[p].y[p]=zouqilie();save(p);showqi(p);panduan(p);}if(p==N*N)heqi();over();}/******************建立棋盘*****************/ void initqipan(){int i,j;for(i=0;i<N;i++){printf("%d",i);printf(" ");}printf("\n");for(i=1;i<N;i++){for(j=0;j<N;j++){if(j==0)printf("%d",i);elseprintf("·");}printf("\n");}}/******************显示棋子*****************/ void showqi(int p){int i,j,k,m;int a[N*N],b[N*N];FILE *fp;fp=fopen("wuzi_list","rb");for(i=1;i<=N*N;i++){fread(&weizhi[i],sizeof(struct zuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}for(m=1;m<p;m++){while(weizhi[p].x[p]==a[m]&&weizhi[p].y[p]==b[m]) {printf("error!\n");weizhi[p].x[p]=zouqihang();weizhi[p].y[p]=zouqilie();m=1;}}for(i=0;i<N;i++){printf("%d",i);printf(" ");}printf("\n");for(i=1;i<N;i++){for(j=1;j<N;j++){if(j==1)printf("%d",i);for(k=1;k<=p;k++){if(i==weizhi[k].x[k]&&j==weizhi[k].y[k]) {if(k%2==1){printf("○");break;}else if(k%2==0){printf("●");break;}}}if(k>p)printf("·");else continue;}printf("\n");}}/******************走棋行*****************/ int zouqihang(){int x;printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);while(x>N-1||x<1){printf("error!\n");printf("请输入要走棋子所在行数!\n");printf("x=");scanf("%d",&x);}return x;/******************走棋列*****************/ int zouqilie(){int y;printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);while(y>N-1||y<1){printf("error!\n");printf("请输入要走棋子所在列数!\n");printf("y=");scanf("%d",&y);}return y;}/******************文件保存*****************/ void save(int i){FILE *fp;fp=fopen("wuzi_list","wb");fwrite(&weizhi[i],sizeof(struct zuobiao),1,fp);}/****************判断输赢*******************/ void panduan(int p){int i,j,k[8]={1,1,1,1,1,1,1,1,};int a[N*N],b[N*N];FILE *fp;fp=fopen("wuzi_list","rb");for(i=1;i<=p;i++){fread(&weizhi[i],sizeof(struct zuobiao),1,fp);a[i]=weizhi[i].x[i];b[i]=weizhi[i].y[i];}/*****************判断行******************/ for(i=1;i<=p;i++)if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[0]++;continue;}else if((a[i]==a[j])&&(b[i]==b[j]-2)) {k[0]++;continue;}else if((a[i]==a[j])&&(b[i]==b[j]-3)) {k[0]++;continue;}else if((a[i]==a[j])&&(b[i]==b[j]-4)) {k[0]++;continue;}else if(k[0]==5){printf("Player 1 wins!!!\n");}elsecontinue;}if(k[0]==5)break;k[0]=1;}else if(k[0]==5)break;else if(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j])&&(b[i]==b[j]-1)){k[1]++;continue;}else if((a[i]==a[j])&&(b[i]==b[j]-2)){k[1]++;continue;}else if((a[i]==a[j])&&(b[i]==b[j]-3)){k[1]++;continue;}else if((a[i]==a[j])&&(b[i]==b[j]-4)){k[1]++;continue;}else if(k[1]==5){printf("Player 2 wins!!!\n");}elsecontinue;}if(k[1]==5)break;k[1]=1;}}/**********************判断列************************/ for(i=1;i<=p;i++){if(k[0]==5||k[1]==5)break;else if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[2]++;continue;}else if((a[i]==a[j]-2)&&(b[i]==b[j]))k[2]++;continue;}else if((a[i]==a[j]-3)&&(b[i]==b[j])) {k[2]++;continue;}else if((a[i]==a[j]-4)&&(b[i]==b[j])) {k[2]++;continue;}else if(k[2]==5){printf("Player 1 wins!!!\n");}elsecontinue;}if(k[2]==5)break;k[2]=1;}else if(k[2]==5)break;else if(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j])){k[3]++;continue;}else if((a[i]==a[j]-2)&&(b[i]==b[j])) {k[3]++;continue;}else if((a[i]==a[j]-3)&&(b[i]==b[j])) {k[3]++;continue;else if((a[i]==a[j]-4)&&(b[i]==b[j])){k[3]++;continue;}else if(k[3]==5){printf("Player 2 wins!!!\n");}elsecontinue;}if(k[3]==5)break;k[3]=1;}}/****************判断对角(左上-右下)******************/ for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5)break;else if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[4]++;continue;}else if((a[i]==a[j]-2)&&(b[i]==b[j]-2)){k[4]++;continue;}else if((a[i]==a[j]-3)&&(b[i]==b[j]-3)){k[4]++;continue;}else if((a[i]==a[j]-4)&&(b[i]==b[j]-4)){k[4]++;continue;}else if(k[4]==5){printf("Player 1 wins!!!\n");}elsecontinue;}if(k[4]==5)break;k[4]=1;}else if(k[2]==5)break;else if(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]-1)&&(b[i]==b[j]-1)){k[5]++;continue;}else if((a[i]==a[j]-2)&&(b[i]==b[j]-2)) {k[5]++;continue;}else if((a[i]==a[j]-3)&&(b[i]==b[j]-3)) {k[5]++;continue;}else if((a[i]==a[j]-4)&&(b[i]==b[j]-4)) {k[5]++;continue;}else if(k[5]==5){printf("Player 2 wins!!!\n");}elsecontinue;}if(k[5]==5)break;k[5]=1;}}/**********判断对角(左下-右上)************/for(i=1;i<=p;i++){if(k[0]==5||k[1]==5||k[2]==5||k[3]==5||k[4]==5||k[5]==5) break;else if(i%2==1){for(j=1;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[6]++;continue;}else if((a[i]==a[j]+2)&&(b[i]==b[j]-2)){k[6]++;continue;}else if((a[i]==a[j]+3)&&(b[i]==b[j]-3)){k[6]++;continue;}else if((a[i]==a[j]+4)&&(b[i]==b[j]-4)){k[6]++;continue;}else if(k[6]==5){printf("Player 1 wins!!!\n");}elsecontinue;}if(k[6]==5)break;k[6]=1;}else if(k[6]==5)break;else if(i%2==0){for(j=2;j<=p;j=j+2){if((a[i]==a[j]+1)&&(b[i]==b[j]-1)){k[7]++;continue;}else if((a[i]==a[j]+2)&&(b[i]==b[j]-2)) {k[7]++;continue;}else if((a[i]==a[j]+3)&&(b[i]==b[j]-3)) {k[7]++;continue;}else if((a[i]==a[j]+4)&&(b[i]==b[j]-4)) {k[7]++;continue;}else if(k[7]==5){printf("Player 2 wins!!!\n");}elsecontinue;}if(k[7]==5)break;k[7]=1;}}}/****************和棋*******************/ void heqi(){printf("************************************\n"); printf(" Tie!!!\n");printf("************************************\n"); }/****************游戏结束*******************/ void over(){printf("************************************\n"); printf(" game over!!!\n");printf("************************************\n"); }/****************游戏开始*******************/ void welcome(){printf("************************************\n"); printf(" Welcome!!!\n");printf("************************************\n"); }。

中国象棋游戏源代码

中国象棋游戏源代码

using System;using System.Collections.Generic; using ponentModel; using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace象棋{enum player{blank,red,blue,};enum chesstype{blank,jiang,che,ma,pao,xiang,zu,shi};struct chess{public player side;public chesstype type;};//下载于struct block{public PictureBox container;public chess item;};public partial class Form1 : Form{public Form1(){InitializeComponent();pictureboxlist = new List<PictureBox>(81); Matrix=new block[10][];int i,j;for (i = 0; i < 10;i++ ){Matrix[i] = new block[9];}for(i=0;i<10;i++){for(j=0;j<9;j++){Control[] col =this.Controls.Find("pictureBox" + (i*9+j+1), false); Matrix[i][j].container=col[0] as PictureBox;Matrix[i][j].container.Location = new Point(60 * j, 60 * i);}}redcoll = new collecter();bluecool = new collecter();for (i = 91; i < 107;i++ ){Control[] col =this.Controls.Find("pictureBox" + i, false);bluecool.add(col[0] as PictureBox);}for (i = 107; i < 123;i++ ){Control[] col =this.Controls.Find("pictureBox" + i, false);redcoll.add(col[0] as PictureBox);}resetground();}List<PictureBox> pictureboxlist;block[][] Matrix;collecter redcoll;collecter bluecool;int chozenX;int chozenY;player currentside;bool beenchozen;bool clickswitch;private void click1(object sender, EventArgs e) {if(!clickswitch){resetground();return;}string name = (sender as PictureBox).Name;string number = name.Substring(10);int index = Convert.ToInt32(number);int i,j;bool flag = false;i=(index-1)/9;j=(index-1)%9;//下载于if (beenchozen){Matrix[chozenX][chozenY].container.BorderStyle = BorderStyle.None;Matrix[chozenX][chozenY].container.BackColor =Color.Transparent;beenchozen = false;if(Matrix[chozenX][chozenY].item.side==Matrix[i][j].it em.side){return;}if(Matrix[chozenX][chozenY].item.side != player.blank) {if(Matrix[i][j].item.type== chesstype.jiang){flag=true;}if(!movechess(i, j)){return;}if(flag){if (currentside == player.red) {MessageBox.Show("红方胜利!点击任意处重新开局");}else{MessageBox.Show("蓝方胜利!点击任意处重新开局");}clickswitch = false;}}if (currentside == player.red){currentside = player.blue;label1.Text = "蓝方";label1.ForeColor = Color.Blue;}else{currentside = player.red;label1.Text = "红方";label1.ForeColor = Color.Red;}}else if(Matrix[i][j].item.side== currentside){Matrix[i][j].container.BorderStyle = BorderStyle.FixedSingle;Matrix[i][j].container.BackColor = Color.Brown;chozenX = i;chozenY = j;beenchozen = true;}}private void resetground(){int i, j;for (i = 0; i < 10;i++ ){for(j=0;j<9;j++){Matrix[i][j].container.Image = null;Matrix[i][j].item.side = player.blank;Matrix[i][j].item.type = chesstype.blank;}}beenchozen = false;clickswitch = true;currentside = player.red;label1.Text = "红方";label1.ForeColor = Color.Red;redcoll.clear();bluecool.clear();Matrix[0][0].container.Image = global::象棋.Properties.Resources.蓝车;Matrix[0][1].container.Image = global::象棋.Properties.Resources.蓝马;Matrix[0][2].container.Image = global::象棋.Properties.Resources.蓝象;Matrix[0][3].container.Image = global::象棋.Properties.Resources.蓝士;Matrix[0][4].container.Image = global::象棋.Properties.Resources.蓝将;Matrix[0][5].container.Image = global::象棋.Properties.Resources.蓝士;Matrix[0][6].container.Image = global::象棋.Properties.Resources.蓝象;Matrix[0][7].container.Image = global::象棋.Properties.Resources.蓝马;Matrix[0][8].container.Image = global::象棋.Properties.Resources.蓝车;Matrix[2][1].container.Image = global::象棋.Properties.Resources.蓝炮;Matrix[2][7].container.Image = global::象棋.Properties.Resources.蓝炮;Matrix[3][0].container.Image = global::象棋.Properties.Resources.蓝卒;Matrix[3][2].container.Image = global::象棋.Properties.Resources.蓝卒;Matrix[3][4].container.Image = global::象棋.Properties.Resources.蓝卒;Matrix[3][6].container.Image = global::象棋.Properties.Resources.蓝卒;Matrix[3][8].container.Image = global::象棋.Properties.Resources.蓝卒;Matrix[6][0].container.Image = global::象棋.Properties.Resources.红卒;Matrix[6][2].container.Image = global::象棋.Properties.Resources.红卒;Matrix[6][4].container.Image = global::象棋.Properties.Resources.红卒;Matrix[6][6].container.Image = global::象棋.Properties.Resources.红卒;Matrix[6][8].container.Image = global::象棋.Properties.Resources.红卒;Matrix[7][1].container.Image = global::象棋.Properties.Resources.红炮;Matrix[7][7].container.Image = global::象棋.Properties.Resources.红炮;Matrix[9][0].container.Image = global::象棋.Properties.Resources.红车;Matrix[9][1].container.Image = global::象棋.Properties.Resources.红马;Matrix[9][2].container.Image = global::象棋.Properties.Resources.红象;Matrix[9][3].container.Image = global::象棋.Properties.Resources.红士;Matrix[9][4].container.Image = global::象棋.Properties.Resources.红将;Matrix[9][5].container.Image = global::象棋.Properties.Resources.红士;Matrix[9][6].container.Image = global::象棋.Properties.Resources.红象;Matrix[9][7].container.Image = global::象棋.Properties.Resources.红马;Matrix[9][8].container.Image = global::象棋.Properties.Resources.红车;//下载于Matrix[0][0].item.side = player.blue;Matrix[0][1].item.side = player.blue;Matrix[0][2].item.side = player.blue;Matrix[0][3].item.side = player.blue;Matrix[0][4].item.side = player.blue;Matrix[0][5].item.side = player.blue;Matrix[0][6].item.side = player.blue;Matrix[0][7].item.side = player.blue;Matrix[0][8].item.side = player.blue;Matrix[2][1].item.side = player.blue;Matrix[2][7].item.side = player.blue;Matrix[3][0].item.side = player.blue;Matrix[3][2].item.side = player.blue;Matrix[3][4].item.side = player.blue;Matrix[3][6].item.side = player.blue;Matrix[3][8].item.side = player.blue;Matrix[6][0].item.side = player.red;Matrix[6][2].item.side = player.red;Matrix[6][4].item.side = player.red;Matrix[6][6].item.side = player.red;Matrix[6][8].item.side = player.red;Matrix[7][1].item.side = player.red;Matrix[7][7].item.side = player.red;Matrix[9][0].item.side = player.red;Matrix[9][1].item.side = player.red;Matrix[9][2].item.side = player.red;Matrix[9][3].item.side = player.red;Matrix[9][4].item.side = player.red;Matrix[9][5].item.side = player.red;Matrix[9][6].item.side = player.red;Matrix[9][7].item.side = player.red;Matrix[9][8].item.side = player.red;Matrix[0][0].item.type = chesstype.che; Matrix[0][1].item.type = chesstype.ma;Matrix[0][2].item.type = chesstype.xiang; Matrix[0][3].item.type = chesstype.shi; Matrix[0][4].item.type = chesstype.jiang; Matrix[0][5].item.type = chesstype.shi; Matrix[0][6].item.type = chesstype.xiang; Matrix[0][7].item.type = chesstype.ma;Matrix[0][8].item.type = chesstype.che; Matrix[2][1].item.type = chesstype.pao; Matrix[2][7].item.type = chesstype.pao; Matrix[3][0].item.type = chesstype.zu;Matrix[3][2].item.type = chesstype.zu;Matrix[3][4].item.type = chesstype.zu;Matrix[3][6].item.type = chesstype.zu;Matrix[3][8].item.type = chesstype.zu;Matrix[6][0].item.type = chesstype.zu;Matrix[6][2].item.type = chesstype.zu;Matrix[6][4].item.type = chesstype.zu;Matrix[6][6].item.type = chesstype.zu;Matrix[6][8].item.type = chesstype.zu;Matrix[7][1].item.type = chesstype.pao;Matrix[7][7].item.type = chesstype.pao;Matrix[9][0].item.type = chesstype.che;Matrix[9][1].item.type = chesstype.ma;Matrix[9][2].item.type = chesstype.xiang; Matrix[9][3].item.type = chesstype.shi;Matrix[9][4].item.type = chesstype.jiang; Matrix[9][5].item.type = chesstype.shi;Matrix[9][6].item.type = chesstype.xiang; Matrix[9][7].item.type = chesstype.ma;Matrix[9][8].item.type = chesstype.che;}private bool movechess(int X,int Y){int i, j, k, n=0;switch(Matrix[chozenX][chozenY].item.type) {case chesstype.che:if(chozenX==X){i = chozenY < Y ? chozenY : Y; j = chozenY > Y ? chozenY : Y;for(k=i+1;k<j;k++){if(Matrix[X][k].item.side!= player.blank){return false;}}}if (chozenY == Y){i = chozenX < X ? chozenX : X; j = chozenX > X ? chozenX : X;for (k = i + 1; k < j; k++){if(Matrix[k][Y].item.side != player.blank){return false;}}}setmove(X, Y);return true;case chesstype.jiang:if(Matrix[X][Y].item.type== chesstype.jiang&&chozenY==Y){i = chozenX < X ? chozenX : X; j = chozenX > X ? chozenX : X;for (k = i + 1; k < j; k++){if(Matrix[k][Y].item.side != player.blank){return false;}}setmove(X, Y);return true;}if(Matrix[chozenX][chozenY].item.side== player.blue){if(Y<3||Y>5||X>2){return false;}}else{if(Y<3||Y>5||X<7){return false;}}if((chozenX-X)*(chozenX-X)+(chozenY-Y)*(chozenY-Y)!=1) {return false;}setmove(X, Y);return true;case chesstype.ma:if (Math.Abs(chozenX - X) == 1 && Math.Abs(chozenY - Y) == 2){if (Matrix[chozenX][chozenY +(Y - chozenY) / Math.Abs(Y - chozenY)].item.side!= player.blank){return false;}}else if (Math.Abs(chozenX - X) == 2 && Math.Abs(chozenY - Y) == 1){if (Matrix[chozenX + (X - chozenX) / Math.Abs(X - chozenX)][chozenY].item.side != player.blank){return false;}}else{return false;}setmove(X, Y);return true;case chesstype.pao: n = 0;if(chozenX==X){i = chozenY < Y ? chozenY : Y; j = chozenY > Y ? chozenY : Y; n = 0;for(k=i+1;k<j;k++){if(Matrix[X][k].item.side!= player.blank){n++;}}if(n>1){return false;}}else if (chozenY == Y){i = chozenX < X ? chozenX : X; j = chozenX > X ? chozenX : X; n = 0;for (k = i + 1; k < j; k++){if(Matrix[k][Y].item.side != player.blank){n++;}}if (n > 1){return false;}}else{return false;}if(n==0&&Matrix[X][Y].item.side!= player.blank){return false;}if(n==1&&Matrix[X][Y].item.side== player.blank){return false;}setmove(X, Y);return true;case chesstype.shi:if(Matrix[chozenX][chozenY].item.side== player.blue){if(Y<3||Y>5||X>2){return false;}}else{if(Y<3||Y>5||X<7){return false;}}if(Math.Abs(X-chozenX)!=1||Math.Abs(chozenY-Y)!=1){return false;}setmove(X, Y);return true;case chesstype.xiang:if(Matrix[chozenX][chozenY].item.side == player.blue){if (X>4){return false;}}else{if (X<5){return false;}}if ((X - chozenX) * (X - chozenX) + (chozenY - Y) * (chozenY - Y) != 8){return false;}if(Matrix[(X+chozenX)/2][(Y+chozenY)/2].item.side!=player.blank){return false;}setmove(X, Y);return true;case chesstype.zu:if(X!=chozenX&&Y!=chozenY){return false;}if(Matrix[chozenX][chozenY].item.side == player.blue) {if (chozenX<5&&X-chozenX!=1) {return false;}if(chozenX>4){if(X==chozenX&&Math.Abs(Y-chozenY)!=1){return false;}if(Y==chozenY&&X-chozenX!=1){return false;}}}else{if (chozenX>4&&chozenX-X!=1) {return false;}if (chozenX <5){if (X == chozenX && Math.Abs(Y - chozenY) != 1){return false;}if (Y == chozenY && chozenX-X != 1){return false;}}}setmove(X,Y);return true;}return false;}private void setmove(int X,int Y){if (Matrix[X][Y].item.side== player.red) {redcoll.push(Matrix[X][Y].container.Image);}else if (Matrix[X][Y].item.side == player.blue){bluecool.push(Matrix[X][Y].container.Image);}Matrix[X][Y].container.Image =Matrix[chozenX][chozenY].container.Image;Matrix[X][Y].item =Matrix[chozenX][chozenY].item;Matrix[chozenX][chozenY].container.Image = null;Matrix[chozenX][chozenY].item.side = player.blank;Matrix[chozenX][chozenY].item.type= chesstype.blank;}}class collecter{public PictureBox[] container;public int number;public int chessnum;public collecter(){number = 0;container = new PictureBox[16];chessnum = 0;}public void add(PictureBox box).{container[number++] = box;}public void push(Image ima){container[chessnum++].BackgroundImage = ima;}public void clear(){for (int i = 0; i < chessnum; i++){container[i].BackgroundImage = null; }chessnum = 0;}};}.。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

关于棋牌游戏源代码开放
在现今的棋牌游戏运营行业如火如荼的阶段,为了减少与避免一些初次接触此行业的运营商被一些产品开发商公司蒙骗上当,特此编写以下的一些说明和答疑,花点时间认真阅读和思考,可能会为您减少巨大的损失。

深圳市壹柒游网络科技有限公司为您全面解答。

1.对运营商开放源代码,可以使运营商根据运营环境与实际情况调节平台,而不被产品提供商所牵制:
运营棋牌游戏,本质上做的事情就是为玩家提供最好的服务和游戏娱乐环境,玩家在这里玩开心,才会留下来,并为拉入更加多的朋友进来,从而才会使你赢取利润,是相辅相成的,是一个因果关系。

而玩家的需求日新月异,你必须根据实际的环境,调节必要的平台功能,例如注册登录策略,游戏奖励策略,游戏规则修改策略,引导购买会员策略,引导购买道具策略等等。

不同的运营时期,所进行的定制策略和程度是不一样的,所以运营商几乎每天都有修改定制部分的欲望与需求。

若运营没有得到源代码,将需要进行一系列繁琐过程:联系开发商,商讨价格,付款,等待开发,然后等待漫长的交付测试阶段。

市场机遇是不会等您的,您说这过程,使您错过了多少发展的机遇呢?
从事实也得到证明,横观现今互联网的游戏运营商,从不对运营商开放源代码的棋牌站点,运营成功的又能有多少呢?
答案是几乎没有。

再看使用了开放源代码的成功而且还保持不断发展的站点呢?数目是非常多的,具体的资料可以到网上搜索就能得到,这里我们就不逐一提及了。

您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?
2.对运营商开放源代码,不需要为二次开发承担昂贵的开发费用:
拥有了产品源代码,才可以进行二次开发,才可以时刻根据市场的需求的变化而立即变化。

而对于一些不牵涉到高级技术能力的功能的修改,也需要开发商加入的话,容易造成运营策略的泄漏,被其他人捷足先登了。

而且开发商除了收取开发成本的人员费用外,还需要收取您的人员管理成本,市场拓展成本,还有公司的收入等。

而这一切的成本,若运营商有了系统源代码后,您的运营成本将会减少很多,而这些成本费用的节省,可以使您投入到市场营销方面,赢取更加多的发展机遇。

您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?
3.对运营商开放源代码,可以使游戏系统更加健壮:
俗语说,一人智短,二人智长。

那么更加多的人呢?是不是应该更加更加智长呢?答案当然是肯定的。

开放源代码的系统,经历着这么多的运营商的实际运营考验,实际进行的功能增加和功能修改,并被众多的技术人员的查阅和审核,您说,这样的系统是不是比不开放源代码的系统更加健壮和问题,漏洞问题是否更加容易发现和及时修补。

而对于不开放源代码的产品商,他们是没有精力顾及到那么多的运营商,也没有这样的人力投入进行到错误的检测和修正方面。

所以,他们的系统只是把错误隐藏起来,使您无法察觉而已,而到了错误产生的时候,您的损失就无法避免了。

让我们一起开一个实际的例子吧,微软的Windows系统与开源的Linux系统,那个更加稳定,那个更加健壮?Linux经历这众多的开发人员共同研究,共同除错,是一个非常稳定的系统。

现今网络上,几乎一切超大型的门户网站,新闻网站,社区网站做服务器系统的,几乎都是清一色的开源Linux服务器系统,谁会用Windows系统的呢?
您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?
4.对运营商开放源代码,可以使游戏运营商更加迅速适应市场的变化:
玩家的需求日新月异,你必须根据实际的环境,调节必要的平台功能,例如注册登录策略,游戏奖励策略,游戏规则修改策略,引导购买会员策略,引导购买道具策略等等。

不同的运营时期,所进行的定制策略和程度是不一样的,所以运营商几乎每天都有修改定制部分的欲望与需求。

若运营没有得到源代码,将需要进行一系列繁琐过程:联系开发商,商讨价格,付款,等待开发,然后等待漫长的交付测试阶段。

市场机遇是不会等您的,您说这过程,使您错过了多少发展的机遇呢?
5.对运营商开放源代码,可以使运营商更加放心,避免被开发商植入后门程序的顾虑:
开发源代码,可以用代码事实证明,系统是没有植入后门程序的。

若没有提供源代码,您又怎么知道和证明开发商没有植入后门程序呢?您就真的完全放心地用这样的产品去发展吗?就不怕等您发展到一定的阶段的时候,被别人利用后门进入您的系统进行破坏吗?您的一切不就被后门程序说要挟和控制了吗安全又从而而来呢
您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?
6.对运营商开放源代码,可以使运营商的平台更加容易成功,更加具有价值:
棋牌系统运营的某个程度,必定会吸引某些投资商,收购商的兴趣,会提出对您的网站进行投资或者收购。

而若您的运营系统是没有代码的,您觉得投资商与收购商还会那么傻给您进行投资与收购吗?是绝对不会的,因为没有源代码,无论如何成功,都只是个空壳,没有一点实际价值和意义,运营商只能谋求在游戏运作阶段每月的玩家消费收入。

您说,怎么样的系统您的发展是否更加有利呢?更加容易成功呢?
一些疑问回答:
1.开放源代码的系统,数据是如何保证安全的呢?
一套棋牌游戏系统,是由服务器与客户端组合而成的。

服务器,是运作在您具有完全控制权的机器里,一切的修改,更新,维护,替换工作都是在您的知情,可控的范围内进行的。

客户端,是供玩家下载的,运行在玩家的电脑里。

有些运营上会有这样的疑问,游戏代码都开放了,那玩家不就更加容易编写木马和外挂程序了吗?其实这个是个极端除错误的认识,其实开放代码的系统,更加不容易出现木马和外挂程序,请接着看以下的一些分析和概念说明。

在游戏系统中,游戏客户端承担的角色只是负责玩家的输入与服务器的数据的显示,还有一些辅助逻辑功能的预先计算功能。

例如服务器告诉客户端,某某玩家干了些什么事情,客户端就简单的用友好的视觉界面表现给玩家而已。

又例如玩家要出某个牌,就发个消息通知服务器,我要出什么什么牌了,请代我告诉其他人,客户端是以这样的一个模式运作的。

我们不要忘记了,这一切的可执行的行为的合法性,正确性,都是由服务器效验和执行,而不是客户端说干嘛就能干嘛的。

开放源代码的程序,可以供运营商检测系统到底是否这样做了,服务器有没有做验证(备注:某些不开发代码的系统,为了编码的简单和减少开发时间和工作量,是不会在服务器严格的验证,导致的后果就是客户端要干什么就什么,导致服务器的数据混乱,系统不稳定)
而在整个游戏系统中,服务器程序的修改与替换,都是由您的控制而完成的,所以,只要保证了服务器环境的安全,就等于保证了整个游戏系统的安全,保证不会被玩家加入木马程序与外挂程序了。

2.既然这样,那些不提供代码的开发商为什么就不能提供源代码呢?
有几个原因的,导致他们不提供源代码:
a)系统源代码的撷取有非法性,非本公司的技术开发成果产品,是从某些不见得人的渠道获得的。

若提供源代码的话,将
会被被法律控告,遭受巨额赔款,而不提供源代码,将使控告流程无法取证,也就无法被控告了,也就没有巨额赔款了。

b)为了控制运营商,使运营上的发展与自己紧密绑定在一起,为自己日后的发展做铺垫。

c)为了获取运营商更多的利润,若是一个有了1000人的游戏平台,运营商没有代码只能给开发商来开发,那岂不是任由
开发商宰割?都有可以直接吞并的可能性存在!
d)代码具有严重的安全性,若公开的了源代码,将会被众多的技术开发人员阅读,导致爆发出系统漏洞无法修复,影响巨
大。

请各位运营商醒醒吧,因为以上的这些原因,他们是不会为您提供源代码的,就算您愿意付出昂贵的报酬代价,也是不可以的,因为涉及到的是他的命脉哦,他们知道了若提供了源代码后,等于自取灭亡,遭受巨额赔款,您觉得他们会为您提供源代码吗?。

相关文档
最新文档