小程序开发源代码大全(小程序开发源代码大全下载)

小程序开发 2780
今天给各位分享小程序开发源代码大全的知识,其中也会对小程序开发源代码大全下载进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!求java小程序源代码 在线等 急急急!!! 下面是俄罗斯方块游戏源代码 还没完,这代码太长了,我用我另一个号再粘上import javax.swing.*; import javax.swing.JOptionPane;

今天给各位分享小程序开发源代码大全的知识,其中也会对小程序开发源代码大全下载进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

求java小程序源代码 在线等 急急急!!!

下面是俄罗斯方块游戏源代码

还没完,这代码太长了,我用我另一个号再粘上

import javax.swing.*;

import javax.swing.JOptionPane;

import javax.swing.border.Border;

import javax.swing.border.EtchedBorder;

import java.awt.*;

import java.awt.event.*;

/**

* 游戏主类,继承自JFrame类,负责游戏的全局控制。

* 内含

* 1, 一个GameCanvas画布类的实例引用,

* 2, 一个保存当前活动块(ErsBlock)实例的引用,

* 3, 一个保存当前控制面板(ControlPanel)实例的引用;*/

public class ErsBlocksGame extends JFrame {

/**

* 每填满一行计多少分*/

public final static int PER_LINE_SCORE = 100;

/**

* 积多少分以后能升级*/

public final static int PER_LEVEL_SCORE = PER_LINE_SCORE * 20;

/**

* 最大级数是10级*/

public final static int MAX_LEVEL = 10;

/**

* 默认级数是5*/

public final static int DEFAULT_LEVEL = 5;

private GameCanvas canvas;

private ErsBlock block;

private boolean playing = false;

private ControlPanel ctrlPanel;

private JMenuBar bar = new JMenuBar();

private JMenu

mGame = new JMenu("游戏设置"),

mControl = new JMenu("游戏控制"),

mWindowStyle = new JMenu("窗口风格");

private JMenuItem

miNewGame = new JMenuItem("新游戏"),

miSetBlockColor = new JMenuItem("设置颜色 ..."),

miSetBackColor = new JMenuItem("设置底色 ..."),

miTurnHarder = new JMenuItem("提升等级"),

miTurnEasier = new JMenuItem("调底等级"),

miExit = new JMenuItem("退出"),

miPlay = new JMenuItem("开始游戏"),

miPause = new JMenuItem("暂停"),

miResume = new JMenuItem("继续");

private JCheckBoxMenuItem

miAsWindows = new JCheckBoxMenuItem("风格1"),

miAsMotif = new JCheckBoxMenuItem("风格2"),

miAsMetal = new JCheckBoxMenuItem("风格3", true);

/**

* 主游戏类的构造函数

* @param title String,窗口标题*/

public ErsBlocksGame(String title) {

super(title);

//this.setTitle("lskdf");

setSize(315, 392);

Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();

//获得屏幕的大小

setLocation((scrSize.width - getSize().width) / 2,

(scrSize.height - getSize().height) / 2);

createMenu();

Container container = getContentPane();

container.setLayout(new BorderLayout(6, 0));

canvas = new GameCanvas(20, 12);

ctrlPanel = new ControlPanel(this);

container.add(canvas, BorderLayout.CENTER);

container.add(ctrlPanel, BorderLayout.EAST);

addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent we) {

JOptionPane about=new JOptionPane();

stopGame();

System.exit(0);

}

});

addComponentListener(new ComponentAdapter() {

public void componentResized(ComponentEvent ce) {

canvas.fanning();

}

});

show();

canvas.fanning();

}

// 游戏“复位”

public void reset() {

ctrlPanel.reset();

canvas.reset();

}

/**

* 判断游戏是否还在进行

* @return boolean, true-还在运行,false-已经停止*/

public boolean isPlaying() {

return playing;

}

/**

* 得到当前活动的块

* @return ErsBlock, 当前活动块的引用*/

public ErsBlock getCurBlock() {

return block;

}

/**

* 得到当前画布

* @return GameCanvas, 当前画布的引用 */

public GameCanvas getCanvas() {

return canvas;

}

/**

* 开始游戏*/

public void playGame() {

play();

ctrlPanel.setPlayButtonEnable(false);

miPlay.setEnabled(false);

ctrlPanel.requestFocus();

}

/**

* 游戏暂停*/

public void pauseGame() {

if (block != null) block.pauseMove();

ctrlPanel.setPauseButtonLabel(false);

miPause.setEnabled(false);

miResume.setEnabled(true);

}

/**

* 让暂停中的游戏继续*/

public void resumeGame() {

if (block != null) block.resumeMove();

ctrlPanel.setPauseButtonLabel(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

ctrlPanel.requestFocus();

}

/**

* 用户停止游戏 */

public void stopGame() {

playing = false;

if (block != null) block.stopMove();

miPlay.setEnabled(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

ctrlPanel.setPlayButtonEnable(true);

ctrlPanel.setPauseButtonLabel(true);

}

/**

* 得到当前游戏者设置的游戏难度

* @return int, 游戏难度1-MAX_LEVEL*/

public int getLevel() {

return ctrlPanel.getLevel();

}

/**

* 让用户设置游戏难度

* @param level int, 游戏难度1-MAX_LEVEL*/

public void setLevel(int level) {

if (level 11 level 0) ctrlPanel.setLevel(level);

}

/**

* 得到游戏积分

* @return int, 积分。*/

public int getScore() {

if (canvas != null) return canvas.getScore();

return 0;

}

/**

* 得到自上次升级以来的游戏积分,升级以后,此积分清零

* @return int, 积分。*/

public int getScoreForLevelUpdate() {

if (canvas != null) return canvas.getScoreForLevelUpdate();

return 0;

}

/**

* 当分数累计到一定的数量时,升一次级

* @return boolean, ture-update successufl, false-update fail

*/

public boolean levelUpdate() {

int curLevel = getLevel();

if (curLevel MAX_LEVEL) {

setLevel(curLevel + 1);

canvas.resetScoreForLevelUpdate();

return true;

}

return false;

}

/**

* 游戏开始*/

private void play() {

reset();

playing = true;

Thread thread = new Thread(new Game());

thread.start();

}

/**

* 报告游戏结束了*/

private void reportGameOver() {

JOptionPane.showMessageDialog(this, "游戏结束!");

}

/**

* 建立并设置窗口菜单 */

private void createMenu() {

bar.add(mGame);

bar.add(mControl);

bar.add(mWindowStyle);

mGame.add(miNewGame);

mGame.addSeparator();

mGame.add(miSetBlockColor);

mGame.add(miSetBackColor);

mGame.addSeparator();

mGame.add(miTurnHarder);

mGame.add(miTurnEasier);

mGame.addSeparator();

mGame.add(miExit);

mControl.add(miPlay);

mControl.add(miPause);

mControl.add(miResume);

mWindowStyle.add(miAsWindows);

mWindowStyle.add(miAsMotif);

mWindowStyle.add(miAsMetal);

setJMenuBar(bar);

miPause.setAccelerator(

KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK));

miResume.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));

miNewGame.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

stopGame();

reset();

setLevel(DEFAULT_LEVEL);

}

});

miSetBlockColor.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

Color newFrontColor =

JColorChooser.showDialog(ErsBlocksGame.this,

"设置积木颜色", canvas.getBlockColor());

if (newFrontColor != null)

canvas.setBlockColor(newFrontColor);

}

});

miSetBackColor.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

Color newBackColor =

JColorChooser.showDialog(ErsBlocksGame.this,

"设置底版颜色", canvas.getBackgroundColor());

if (newBackColor != null)

canvas.setBackgroundColor(newBackColor);

}

});

miTurnHarder.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

int curLevel = getLevel();

if (curLevel MAX_LEVEL) setLevel(curLevel + 1);

}

});

miTurnEasier.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

int curLevel = getLevel();

if (curLevel 1) setLevel(curLevel - 1);

}

});

miExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

System.exit(0);

}

});

miPlay.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

playGame();

}

});

miPause.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

pauseGame();

}

});

miResume.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

resumeGame();

}

});

miAsWindows.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

String plaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

setWindowStyle(plaf);

canvas.fanning();

ctrlPanel.fanning();

miAsWindows.setState(true);

miAsMetal.setState(false);

miAsMotif.setState(false);

}

});

miAsMotif.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

String plaf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

setWindowStyle(plaf);

canvas.fanning();

ctrlPanel.fanning();

miAsWindows.setState(false);

miAsMetal.setState(false);

miAsMotif.setState(true);

}

});

miAsMetal.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

String plaf = "javax.swing.plaf.metal.MetalLookAndFeel";

setWindowStyle(plaf);

canvas.fanning();

ctrlPanel.fanning();

miAsWindows.setState(false);

miAsMetal.setState(true);

miAsMotif.setState(false);

}

});

}

/**

* 根据字串设置窗口外观

* @param plaf String, 窗口外观的描述

*/

private void setWindowStyle(String plaf) {

try {

UIManager.setLookAndFeel(plaf);

SwingUtilities.updateComponentTreeUI(this);

} catch (Exception e) {

}

}

/**

* 一轮游戏过程,实现了Runnable接口

* 一轮游戏是一个大循环,在这个循环中,每隔100毫秒,

* 检查游戏中的当前块是否已经到底了,如果没有,

* 就继续等待。如果到底了,就看有没有全填满的行,

* 如果有就删除它,并为游戏者加分,同时随机产生一个

* 新的当前块,让它自动下落。

* 当新产生一个块时,先检查画布最顶上的一行是否已经

* 被占了,如果是,可以判断Game Over了。*/

private class Game implements Runnable {

public void run() {

//产生新方快

int col = (int) (Math.random() * (canvas.getCols() - 3)),

style = ErsBlock.STYLES[(int) (Math.random() * 7)][(int) (Math.random() * 4)];

while (playing) {

if (block != null) { //第一次循环时,block为空

if (block.isAlive()) {

try {

Thread.currentThread().sleep(100);

} catch (InterruptedException ie) {

ie.printStackTrace();

}

continue;

}

}

checkFullLine(); //检查是否有全填满的行

if (isGameOver()) { //检查游戏是否应该结束了

miPlay.setEnabled(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

ctrlPanel.setPlayButtonEnable(true);

ctrlPanel.setPauseButtonLabel(true);

reportGameOver();

return;

}

block = new ErsBlock(style, -1, col, getLevel(), canvas);

block.start();

col = (int) (Math.random() * (canvas.getCols() - 3));

style = ErsBlock.STYLES[(int) (Math.random() * 7)][(int) (Math.random() * 4)];

ctrlPanel.setTipStyle(style);

}

}

/**

* 检查画布中是否有全填满的行,如果有就删除之*/

public void checkFullLine() {

for (int i = 0; i canvas.getRows(); i++) {

int row = -1;

boolean fullLineColorBox = true;

for (int j = 0; j canvas.getCols(); j++) {

if (!canvas.getBox(i, j).isColorBox()) {

fullLineColorBox = false;

break;

}

}

if (fullLineColorBox) {

row = i--;

canvas.removeLine(row);

}

}

}

/**

* 根据最顶行是否被占,判断游戏是否已经结束了。

* @return boolean, true-游戏结束了,false-游戏未结束*/

private boolean isGameOver() {

for (int i = 0; i canvas.getCols(); i++) {

ErsBox box = canvas.getBox(0, i);

if (box.isColorBox()) return true;

}

return false;

}

}

求C语言小程序源代码,300行左右

黑白棋游戏

#include "graphics.h" /*图形系统头文件*/

#define LEFT 0x4b00 /*光标左键值*/

#define RIGHT 0x4d00 /*光标右键值*/

#define DOWN 0x5000 /*光标下键值*/

#define UP 0x4800 /*光标上键值*/

#define ESC 0x011b /* ESC键值*/

#define ENTER 0x1c0d /* 回车键值*/

int a[8][8]={0},key,score1,score2;/*具体分数以及按键与存放棋子的变量*/

char playone[3],playtwo[3];/*两个人的得分转换成字符串输出*/

void playtoplay(void);/*人人对战函数*/

void DrawQp(void);/*画棋盘函数*/

void SetPlayColor(int x);/*设置棋子第一次的颜色*/

void MoveColor(int x,int y);/*恢复原来棋盘状态*/

int QpChange(int x,int y,int z);/*判断棋盘的变化*/

void DoScore(void);/*处理分数*/

void PrintScore(int n);/*输出成绩*/

void playWin(void);/*输出胜利者信息*/

/******主函数*********/

void main(void)

{

int gd=DETECT,gr;

initgraph(gd,gr,"c:\\tc"); /*初始化图形系统*/

DrawQp();/*画棋盘*/

playtoplay();/*人人对战*/

getch();

closegraph();/*关闭图形系统*/

}

void DrawQp()/*画棋盘*/

{

int i,j;

score1=score2=0;/*棋手一开始得分都为0*/

setbkcolor(BLUE);

for(i=100;i=420;i+=40)

{

line(100,i,420,i);/*画水平线*/

line(i,100,i,420); /*画垂直线*/

}

setcolor(0);/*取消圆周围的一圈东西*/

setfillstyle(SOLID_FILL,15);/*白色实体填充模式*/

fillellipse(500,200,15,15); /*在显示得分的位置画棋*/

setfillstyle(SOLID_FILL,8); /*黑色实体填充模式*/

fillellipse(500,300,15,15);

a[3][3]=a[4][4]=1;/*初始两个黑棋*/

a[3][4]=a[4][3]=2;/*初始两个白棋*/

setfillstyle(SOLID_FILL,WHITE);

fillellipse(120+3*40,120+3*40,15,15);

fillellipse(120+4*40,120+4*40,15,15);

setfillstyle(SOLID_FILL,8);

fillellipse(120+3*40,120+4*40,15,15);

fillellipse(120+4*40,120+3*40,15,15);

score1=score2=2; /*有棋后改变分数*/

DoScore();/*输出开始分数*/

}

void playtoplay()/*人人对战*/

{

int x,y,t=1,i,j,cc=0;

while(1)/*换棋手走棋*/

{

x=120,y=80;/*每次棋子一开始出来的坐标,x为行坐标,y为列坐标*/

while(1) /*具体一个棋手走棋的过程*/

{

PrintScore(1);/*输出棋手1的成绩*/

PrintScore(2);/*输出棋手2的成绩*/

SetPlayColor(t);/*t变量是用来判断棋手所执棋子的颜色*/

fillellipse(x,y,15,15);

key=bioskey(0);/*接收按键*/

if(key==ESC)/*跳出游戏*/

break;

else

if(key==ENTER)/*如果按键确定就可以跳出循环*/

{

if(y!=80a[(x-120)/40][(y-120)/40]!=1

a[(x-120)/40][(y-120)/40]!=2)/*如果落子位置没有棋子*/

{

if(t%2==1)/*如果是棋手1移动*/

a[(x-120)/40][(y-120)/40]=1;

else/*否则棋手2移动*/

a[(x-120)/40][(y-120)/40]=2;

if(!QpChange(x,y,t))/*落子后判断棋盘的变化*/

{

a[(x-120)/40][(y-120)/40]=0;/*恢复空格状态*/

cc++;/*开始统计尝试次数*/

if(cc=64-score1-score2) /*如果尝试超过空格数则停步*/

{

MoveColor(x,y);

fillellipse(x,y,15,15);

break;

}

else

continue;/*如果按键无效*/

}

DoScore();/*分数的改变*/

break;/*棋盘变化了,则轮对方走棋*/

}

else/*已经有棋子就继续按键*/

continue;

}

else /*四个方向按键的判断*/

if(key==LEFTx120)/*左方向键*/

{

MoveColor(x,y);

fillellipse(x,y,15,15);

SetPlayColor(t);

x-=40;

fillellipse(x,y,15,15);

}

else

if(key==RIGHTx400y80)/*右方向键*/

{

MoveColor(x,y);

fillellipse(x,y,15,15);

SetPlayColor(t);

x+=40;

fillellipse(x,y,15,15);

}

else

if(key==UPy120)/*上方向键*/

{

MoveColor(x,y);

fillellipse(x,y,15,15);

SetPlayColor(t);

y-=40;

fillellipse(x,y,15,15);

}

else

if(key==DOWNy400)/*下方向键*/

{

MoveColor(x,y);

fillellipse(x,y,15,15);

SetPlayColor(t);

y+=40;

fillellipse(x,y,15,15);

}

}

if(key==ESC)/*结束游戏*/

break;

if((score1+score2)==64||score1==0||score2==0)/*格子已经占满或一方棋子为0判断胜负*/

{

playWin();/*输出最后结果*/

break;

}

t=t%2+1; /*一方走后,改变棋子颜色即轮对方走*/

cc=0; /*计数值恢复为0*/

} /*endwhile*/

}

void SetPlayColor(int t)/*设置棋子颜色*/

{

if(t%2==1)

setfillstyle(SOLID_FILL,15);/*白色*/

else

setfillstyle(SOLID_FILL,8);/*灰色*/

}

void MoveColor(int x,int y)/*走了一步后恢复原来格子的状态*/

{

if(y100)/*如果是从起点出发就恢复蓝色*/

setfillstyle(SOLID_FILL,BLUE);

else/*其他情况如果是1就恢复白色棋子,2恢复黑色棋子,或恢复蓝色棋盘*/

switch(a[(x-120)/40][(y-120)/40])

{

case 1:

setfillstyle(SOLID_FILL,15);break; /*白色*/

case 2:

setfillstyle(SOLID_FILL,8);break; /*黑色*/

default:

setfillstyle(SOLID_FILL,BLUE); /*蓝色*/

}

}

int QpChange(int x,int y,int t)/*判断棋盘的变化*/

{

int i,j,k,kk,ii,jj,yes;

yes=0;

i=(x-120)/40; /*计算数组元素的行下标*/

j=(y-120)/40; /*计算数组元素的列下标*/

SetPlayColor(t);/*设置棋子变化的颜色*/

/*开始往8个方向判断变化*/

if(j6)/*往右边*/

{

for(k=j+1;k8;k++)

if(a[i][k]==a[i][j]||a[i][k]==0)/*遇到自己的棋子或空格结束*/

break;

if(a[i][k]!=0k8)

{

for(kk=j+1;kkkk8;kk++)/*判断右边*/

{

a[i][kk]=a[i][j]; /*改变棋子颜色*/

fillellipse(120+i*40,120+kk*40,15,15);

}

if(kk!=j+1) /*条件成立则有棋子改变过颜色*/

yes=1;

}

}

if(j1)/*判断左边*/

{

for(k=j-1;k=0;k--)

if(a[i][k]==a[i][j]||!a[i][k])

break;

if(a[i][k]!=0k=0)

{

for(kk=j-1;kkkk=0;kk--)

{

a[i][kk]=a[i][j];

fillellipse(120+i*40,120+kk*40,15,15);

}

if(kk!=j-1)

yes=1;

}

}

if(i6)/*判断下边*/

{

for(k=i+1;k8;k++)

if(a[k][j]==a[i][j]||!a[k][j])

break;

if(a[k][j]!=0k8)

{

for(kk=i+1;kkkk8;kk++)

{

a[kk][j]=a[i][j];

fillellipse(120+kk*40,120+j*40,15,15);

}

if(kk!=i+1)

yes=1;

}

}

if(i1)/*判断上边*/

{

for(k=i-1;k=0;k--)

if(a[k][j]==a[i][j]||!a[k][j])

break;

if(a[k][j]!=0k=0)

{

for(kk=i-1;kkkk=0;kk--)

{

a[kk][j]=a[i][j];

fillellipse(120+kk*40,120+j*40,15,15);

}

if(kk!=i-1)

yes=1;

}

}

if(i1j6)/*右上*/

{

for(k=i-1,kk=j+1;k=0kk8;k--,kk++)

if(a[k][kk]==a[i][j]||!a[k][kk])

break;

if(a[k][kk]k=0kk8)

{

for(ii=i-1,jj=j+1;iikk=0;ii--,jj++)

{

a[ii][jj]=a[i][j];

fillellipse(120+ii*40,120+jj*40,15,15);

}

if(ii!=i-1)

yes=1;

}

}

if(i6j1)/*左下*/

{

for(k=i+1,kk=j-1;k8kk=0;k++,kk--)

if(a[k][kk]==a[i][j]||!a[k][kk])

break;

if(a[k][kk]!=0k8kk=0)

{

for(ii=i+1,jj=j-1;iikk8;ii++,jj--)

{

a[ii][jj]=a[i][j];

fillellipse(120+ii*40,120+jj*40,15,15);

}

if(ii!=i+1)

yes=1;

}

}

if(i1j1)/*左上*/

{

for(k=i-1,kk=j-1;k=0kk=0;k--,kk--)

if(a[k][kk]==a[i][j]||!a[k][kk])

break;

if(a[k][kk]!=0k=0kk=0)

{

for(ii=i-1,jj=j-1;iikk=0;ii--,jj--)

{

a[ii][jj]=a[i][j];

fillellipse(120+ii*40,120+jj*40,15,15);

}

if(ii!=i-1)

yes=1;

}

}

if(i6j6)/* 右下*/

{

for(k=i+1,kk=j+1;kk8kk8;k++,kk++)

if(a[k][kk]==a[i][j]||!a[k][kk])

break;

if(a[k][kk]!=0kk8k8)

{

for(ii=i+1,jj=j+1;iikk8;ii++,jj++)

{

a[ii][jj]=a[i][j];

fillellipse(120+ii*40,120+jj*40,15,15);

}

if(ii!=i+1)

yes=1;

}

}

return yes;/*返回是否改变过棋子颜色的标记*/

}

void DoScore()/*处理分数*/

{

int i,j;

score1=score2=0;/*重新开始计分数*/

for(i=0;i8;i++)

for(j=0;j8;j++)

if(a[i][j]==1)/*分别统计两个人的分数*/

score1++;

else

if(a[i][j]==2)

score2++;

}

void PrintScore(int playnum)/*输出成绩*/

{

if(playnum==1)/*清除以前的成绩*/

{

setfillstyle(SOLID_FILL,BLUE);

bar(550,100,640,400);

}

setcolor(RED);

settextstyle(0,0,4);/*设置文本输出样式*/

if(playnum==1)/*判断输出哪个棋手的分,在不同的位置输出*/

{

sprintf(playone,"%d",score1);

outtextxy(550,200,playone);

}

else

{

sprintf(playtwo,"%d",score2);

outtextxy(550,300,playtwo);

}

setcolor(0);

}

void playWin()/*输出最后的胜利者结果*/

{

settextstyle(0,0,4);

setcolor(12);

if(score2score1)/*开始判断最后的结果*/

outtextxy(100,50,"black win!");

else

if(score2score1)

outtextxy(100,50,"white win!");

else

outtextxy(60,50,"you all win!");

}

五子棋游戏

/*五子棋*/

#includestdio.h

#includestdlib.h

#includegraphics.h

#includebios.h

#includeconio.h

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define DOWN 0x5000

#define UP 0x4800

#define ESC 0x011b

#define SPACE 0x3920

#define BILI 20

#define JZ 4

#define JS 3

#define N 19

int box[N][N];

int step_x,step_y ;

int key ;

int flag=1 ;

void draw_box();

void draw_cicle(int x,int y,int color);

void change();

void judgewho(int x,int y);

void judgekey();

int judgeresult(int x,int y);

void attentoin();

void attention()

{

char ch ;

window(1,1,80,25);

textbackground(LIGHTBLUE);

textcolor(YELLOW);

clrscr();

gotoxy(15,2);

printf("游戏操作规则:");

gotoxy(15,4);

printf("Play Rules:");

gotoxy(15,6);

printf("1、按左右上下方向键移动棋子");

gotoxy(15,8);

printf("1. Press Left,Right,Up,Down Key to move Piece");

gotoxy(15,10);

printf("2、按空格确定落棋子");

gotoxy(15,12);

printf("2. Press Space to place the Piece");

gotoxy(15,14);

printf("3、禁止在棋盘外按空格");

gotoxy(15,16);

printf("3. DO NOT press Space outside of the chessboard");

gotoxy(15,18);

printf("你是否接受上述的游戏规则(Y/N)");

gotoxy(15,20);

printf("Do you accept the above Playing Rules? [Y/N]:");

while(1)

{

gotoxy(60,20);

ch=getche();

if(ch=='Y'||ch=='y')

break ;

else if(ch=='N'||ch=='n')

{

window(1,1,80,25);

textbackground(BLACK);

textcolor(LIGHTGRAY);

clrscr();

exit(0);

}

gotoxy(51,12);

printf(" ");

}

}

void draw_box()

{

int x1,x2,y1,y2 ;

setbkcolor(LIGHTBLUE);

setcolor(YELLOW);

gotoxy(7,2);

printf("Left, Right, Up, Down KEY to move, Space to put, ESC-quit.");

for(x1=1,y1=1,y2=18;x1=18;x1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x1+JZ)*BILI,(y2+JS)*BILI);

for(x1=1,y1=1,x2=18;y1=18;y1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x2+JZ)*BILI,(y1+JS)*BILI);

for(x1=1;x1=18;x1++)

for(y1=1;y1=18;y1++)

box[x1][y1]=0 ;

}

void draw_circle(int x,int y,int color)

{

setcolor(color);

setlinestyle(SOLID_LINE,0,1);

x=(x+JZ)*BILI ;

y=(y+JS)*BILI ;

circle(x,y,8);

}

void judgekey()

{

int i ;

int j ;

switch(key)

{

case LEFT :

if(step_x-10)

break ;

else

{

for(i=step_x-1,j=step_y;i=1;i--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i1)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case RIGHT :

if(step_x+118)

break ;

else

{

for(i=step_x+1,j=step_y;i=18;i++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i18)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case DOWN :

if((step_y+1)18)

break ;

else

{

for(i=step_x,j=step_y+1;j=18;j++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j18)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case UP :

if((step_y-1)0)

break ;

else

{

for(i=step_x,j=step_y-1;j=1;j--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j1)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case ESC :

break ;

case SPACE :

if(step_x=1step_x=18step_y=1step_y=18)

{

if(box[step_x][step_y]==0)

{

box[step_x][step_y]=flag ;

if(judgeresult(step_x,step_y)==1)

{

sound(1000);

delay(1000);

nosound();

gotoxy(30,4);

if(flag==1)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,5);

/*三重笔划字体, 水平放?5倍*/

outtextxy(20,20,"The White Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The White Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

if(flag==2)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,8);

/*三重笔划字体, 水平放大8倍*/

outtextxy(20,20,"The Red Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The Red Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

}

change();

break ;

}

}

else

break ;

}

}

void change()

{

if(flag==1)

flag=2 ;

else

flag=1 ;

}

void judgewho(int x,int y)

{

if(flag==1)

draw_circle(x,y,15);

if(flag==2)

draw_circle(x,y,4);

}

int judgeresult(int x,int y)

{

int j,k,n1,n2 ;

while(1)

{

n1=0 ;

n2=0 ;

/*水平向左数*/

for(j=x,k=y;j=1;j--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*水平向右数*/

for(j=x,k=y;j=18;j++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*垂直向上数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;k=1;k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*垂直向下数*/

for(j=x,k=y;k=18;k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向左上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=1,k=1;j--,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向右下方数*/

for(j=x,k=y;j=18,k=18;j++,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向右上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=18,k=1;j++,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向左下方数*/

for(j=x,k=y;j=1,k=18;j--,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

return(0);

break ;

}

}

void main()

{

int gdriver=VGA,gmode=VGAHI;

clrscr();

attention();

initgraph(gdriver,gmode,"c:\\tc");

/* setwritemode(XOR_PUT);*/

flag=1 ;

draw_box();

do

{

step_x=0 ;

step_y=0 ;

/*draw_circle(step_x,step_y,8); */

judgewho(step_x-1,step_y-1);

do

{

while(bioskey(1)==0);

key=bioskey(0);

judgekey();

}

while(key!=SPACEkey!=ESC);

}

while(key!=ESC);

closegraph();

}

小程序三级分销商城系统源代码开发

目前小程序已经开发出来三级分销源代码,可以按照自己的需求进行选择和定制。

第1种是卖模板为主的网络公司。

优点是:价格低,几千块钱到万元之间就能搞定,方便,能够快速上线;

缺点是:修改功能麻烦,这里需要避免低价陷阱,不要到最后才发现模板性的修改功能所花的钱比买模板还贵。而且不是独立的,一个模本卖给很多商家用,模板不是永久使用的,一般每年都要交年费。

第2种是主流的方式,定制开发为主的网络公司。

优点是:独一无二的,专为你的企业或者店面定制的,功能你来定,要求你来定,后期修改BUG方便,改东西也很方便,最重要的是永久使用权!!

缺点是:相对价格比较高!!! 定制版的基本费用在上万元到十几万不等!不过贵也有贵的道理吧,毕竟功能做的更全面一点。

最后总结,至于找什么样的小程序开发公司?花多少钱来开发?还是需要看贵公司准备的预算这块!希望对大家有用!

求一个最简单的微信小程序源代码

要带后台不,带后台的一般不会简单,这种额也有,价格会高些,不带后台的话便宜多了,一般作业应该是不带后台的吧,当然也可以直接找额说要求

微信小程序的源代码有哪几家

售卖小程序源代码的公司有很多,但是一般不建议购买小程序源代码。首先一点是别人写的代码,自己再看的时候非常吃力,因为每个人写代码的逻辑思维都不一样;另外一点是如果有BUG,排查出来很麻烦,浪费时间和精力。建议还是可以直接用小程序模版制作,只需要更改内容就行。

微信小程序分销系统源代码开发

微信小程序分销系统的开发大致有三种方式:

一、自己有多年的编程基础,自己学习,自己研究。

二、使用第三方小程序开发工具这种方式是使用第三方的小程序开发工具,这类工具一般都不需要编程。区别于微信小程序官方的代码编辑器,这类工具是图形化的界面。

做小程序就像做PPT一样。把图片、文字、音乐等等东西插入,然后设置它们的效果,编辑好后,使用这类工具直接自动小程序代码,把生成的小程序代码上传到微信审核就可以上线自己的小程序了。

三、专业的微信小程序开发公司这类企业都有专门的技术团队和丰富的开发经验,商家只要把需求提供给公司,然后跟技术进行交流一下,把你的想法和需求说明,就可以开始了。

商家想要找第三方开发合作公司要综合的考察,因为互联网的发展日新月异,公司的发展时间,有没有实力,开发的小程序能不能够满足需求等问题一直困扰着客户。

小程序开发源代码大全的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于小程序开发源代码大全下载、小程序开发源代码大全的信息别忘了在本站进行查找喔。

扫码二维码