Java连连看代码。广度优先搜索算法实现最小拐弯数高手留下qq
整理:yaobaiwang.com 时间:07月05日
[连连看游戏程序主要功能是可以实现什么]连连看游戏程序主要功能是可以实现什么,连连看的规则:////// 简单连连看游戏//////#include#include#include#define ROW 4 //行数目#define COL 4 #define ICO_NUM 5//游戏图...+阅读
Java连连看代码。广度优先搜索算法实现最小拐弯数高手留下qq
import javax.swing.*;import java.awt.*;import java.awt.event.*;public class lianliankan implements ActionListener{JFrame mainFrame; //主面板Container thisContainer;JPanel centerPanel,southPanel,northPanel; //子面板JButton diamondsButton[][] = new JButton[6][5];//游戏按钮数组JButton exitButton,resetButton,newlyButton; //退出,重列,重新开始按钮 JLabel fractionLable=new JLabel("0"); //分数标签JButton firstButton,secondButton; //分别记录两次被选中的按钮int grid[][] = new int[8][7];//储存游戏按钮位置static boolean pressInformation=false; //判断是否有按钮被选中int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标 int i,j,k,n;//消除方法控制public void init(){mainFrame=new JFrame("JKJ连连看");thisContainer = mainFrame.getContentPane();thisContainer.setLayout(new BorderLayout());centerPanel=new JPanel();southPanel=new JPanel();northPanel=new JPanel();thisContainer.add(centerPanel,"Center");thisContainer.add(southPanel,"South");thisContainer.add(northPanel,"North");centerPanel.setLayout(new GridLayout(6,5));for(int cols = 0;cols
连连看中的计时器积分器的源代码
//java编写的计时器://import java.util.TimerTask; import java.util.Calendar; public class MyTask extends TimerTask { private static final int C_SCHEDULE_HOUR = 15; private static boolean isRunning = false; public MyTask() { } public void run() { Calendar cal = Calendar.getInstance(); if (!isRunning) { //if (C_SCHEDULE_HOUR == cal.get(Calendar.HOUR_OF_DAY)) { isRunning = true; System.out.println(new java.util.Date() + " 游戏开始"); for (int i = 0 ; i
急连连看简单vb程序
给你段代码吧,直接复制粘贴到文本文件,改名为1.frm即可运行(关于连线的判断自己需要加一段算法代码,本程序中没写):VERSION 5.00Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "Form1" ClientHeight = 7680 ClientLeft = 45 ClientTop = 435 ClientWidth = 7170 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 7680 ScaleWidth = 7170 StartUpPosition = 3 '窗口缺省 Begin VB.Timer Timer1 Left = 6720 Top = 2880 End Begin VB.ComboBox dengji Height = 300 Left = 4680 Style = 2 'Dropdown List TabIndex = 6 Top = 720 Width = 1935 End Begin VB.CommandButton Jieshu Caption = "结束游戏" Height = 495 Left = 1800 TabIndex = 5 Top = 600 Width = 1215 End Begin VB.PictureBox P1 Appearance = 0 'Flat BackColor = &H00000000& ForeColor = &H80000008& Height = 255 Left = 240 ScaleHeight = 225 ScaleWidth = 6585 TabIndex = 4 Top = 240 Width = 6615 End Begin VB.PictureBox p0 Appearance = 0 'Flat BackColor = &H80000005& ForeColor = &H80000008& Height = 255 Left = 240 ScaleHeight = 225 ScaleWidth = 6585 TabIndex = 3 Top = 240 Width = 6615 End Begin VB.Frame Frame1 Height = 6255 Left = 360 TabIndex = 1 Top = 1200 Width = 6255 Begin VB.PictureBox nPic BackColor = &H008080FF& BorderStyle = 0 'None Height = 615 Index = 0 Left = 360 ScaleHeight = 615 ScaleWidth = 105 TabIndex = 2 Top = 240 Visible = 0 'False Width = 100 End End Begin VB.CommandButton kaishi Caption = "开始游戏" Height = 495 Left = 240 TabIndex = 0 Top = 600 Width = 1335 End Begin VB.Label Label1 Caption = "难度等级" Height = 255 Left = 3720 TabIndex = 7 Top = 720 Width = 855 EndEndAttribute VB_Name = "Form1"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalseDim tmp() As Integer '假设有10种类别的图片,本数组用以记录每组图片加载的次数Dim pic(10) As ColorConstantsDim tCnt As IntegerDim Fhit As ColorConstantsDim FhitIndex As LongPrivate Sub Command1_Click()End SubPrivate Sub jieshu_Click() Timer1.Enabled = False dengji.Enabled = True P1.Width = p0.Width Jieshu.Enabled = False kaishi.Enabled = TrueEnd SubPrivate Sub Form_Initialize() Dim i As Integer For i = 1 To 10 pic(i) = RGB(Int(Rnd * 255), Int(Rnd * 255), Int(Rnd * 255)) Next i dengji.Clear For i = 3 To 1 Step -1 dengji.AddItem i & "分钟" Next i dengji.ListIndex = 0 Timer1.Interval = 1000 Timer1.Enabled = False Jieshu.Enabled = FalseEnd SubPrivate Sub Form_Load() 'IntPicEnd Sub'初始化控件数组Private Sub IntPic() Dim i As Integer ReDim tmp(10) As Integer nPic(0).Move 200, 200, 500, 500 nPic(0).Visible = False For i = 1 To 100 If ExistPic(nPic(i)) Then Unload nPic(i) Load nPic(i) nPic(i).Visible = True nPic(i).Width = 500 nPic(i).BackColor = pic(LoadPic) nPic(i).Top = (i Mod 10) * (500 + 100) + 200 nPic(i).Left = ((i - 1) \ 10) * (500 + 100) + 200 nPic(i).Visible = True Next iEnd Sub'判断控件是否存在Function ExistPic(obj As PictureBox) As Boolean On Error GoTo errobj obj.Move obj.Left ExistPic = True Exit Functionerrobj: ExistPic = FalseEnd Function'随机赋予控件颜色,可更改为指定的图片Private Function LoadPic() Dim ntmp As Integer Do ntmp = Int(Rnd * 10) + 1 If tmp(ntmp) LoadPic = ntmp tmp(ntmp) = tmp(ntmp) + 1 Exit Do End If LoopEnd FunctionPrivate Sub kaishi_Click() tCnt = 0 IntPic Timer1.Enabled = True dengji.Enabled = False kaishi.Enabled = False Jieshu.Enabled = TrueEnd SubPrivate Sub nPic_Click(Index As Integer) If Fhit = 0 Then Fhit = nPic(Index).BackColor FhitIndex = Index nPic(Index).BorderStyle = 1 ElseIf Fhit = nPic(Index).BackColor And Index FhitIndex Then nPic(FhitIndex).Visible = False nPic(Index).Visible = False FhitIndex = 0 Fhit = 0 nPic(Index).BorderStyle = 1 nPic(FhitIndex).BorderStyle = 0 Else Fhit = nPic(Index).BackColor nPic(FhitIndex).BorderStyle = 0 nPic(Index).BorderStyle = 1 FhitIndex = Index End If Debug.Print FhitEnd SubPrivate Sub Timer1_Timer() If tCnt >Val(dengji.Text) * 60 Then MsgBox "游戏结束" Timer1.Enabled = False Exit Sub End If tCnt = tCnt + 1 P1.Width = p0.Width * (1 - Format((tCnt / (Val(dengji.Text) * 60)), "0.000"))End Sub
易语言连连看源码
建立图框组。 只能知道找图的。不能用修改器。。代码如下.版本 2.支持库 BmpOperate.支持库 xplib.支持库 shellEx.支持库 dp1.程序集 窗口程序集1.程序集变量 方块数据, 方块数据, , "19,11".程序集变量 位图, 位图.程序集变量 热键1, 整数型.程序集变量 热键, 整数型.程序集变量 方块数量, 整数型, , , 底图里方块的数量.程序集变量 窗口矩形, 矩形_.程序集变量 背景图字节集, 字节集.子程序 __启动窗口_创建完毕.局部变量 x, 整数型.局部变量 y, 整数型XP风格(1)热键 = 注册热键 (_启动窗口.取窗口句柄 (), 标签1.取窗口句柄 (), 0, #F4键).子程序 _按钮1_被单击.局部变量 a, 字节集窗口句柄 = 查找顶级窗口 (0, “QQ游戏 - 连连看角色版”)a = 快照 (窗口句柄, , )位图.创建 (800, 600, 位图.取位深度 (), )位图.载入数据 (a)图像种类 = 0.子程序 取临时位图数据, 字节集.参数 x, 整数型.参数 y, 整数型.局部变量 临时位图1, 位图.局部变量 x1, 整数型.局部变量 y1, 整数型.局部变量 x2, 整数型.局部变量 y2, 整数型.局部变量 ys, 整数型临时位图1.创建 (26, 30, 位图.取位深度 (), )x2 = 0y2 = 0.变量循环首 (14 + (x - 1) * 31, 14 + (x - 1) * 31 + 26, 1, x1) y2 = 0 .变量循环首 (181 + (y - 1) * 35 + 4, 181 + (y - 1) * 35 + 34, 1, y1) ys = 位图.取某点颜色 (x1, y1) 临时位图1.置某点颜色 (x2, y2, ys) y2 = y2 + 1 .变量循环尾 () x2 = x2 + 1.变量循环尾 ().如果真 (取字节集长度 (压缩数据 (临时位图1.取位图数据 ())) 背景图字节集 = 临时位图1.取位图数据 ().如果真结束返回 (临时位图1.取位图数据 ()).子程序 _按钮2_被单击.局部变量 x, 整数型.局部变量 y, 整数型.局部变量 临时位图, 位图.局部变量 数据号, 整数型.局部变量 临时数据, 字节集.局部变量 临时数据1, 字节集.局部变量 a, 整数型...
以下为关联内容:
一连连看算法 C语言一连连看算法 C语言,如何用C写连连看??????????第一个如果严格按照连连看的规则来做其实很简单。因为连连看里所有的空白方格都是相连的,不会出现某个空白方格被围住的情况发生。所以要...
QQ玩连连看高手来教你怎么玩QQ玩连连看高手来教你怎么玩,怎样玩连连看:速度好,在连连看过程中确实能带来很多方便。因为连连看是一接一式消除图片的,若第一个未被消除,那么接下来那个也是不能被消除的。速度...
怎么用java写一个小游戏连连看怎么用java写一个小游戏连连看,连连看游戏的java源代码程序!package mybase.programe;/** lianliankan总体算法思路:由两个确定的按钮。若这两个按钮的数字相等,就开始找它们相...
java语言编写一个连连看。java语言编写一个连连看,一个用java语言编写的图片连连看游戏有没有大神肯教啊:import java.awt.BorderLayout; import java.awt.Container; import java.awt.GridLayout; imp...
连连看游戏的java源代码程序!连连看游戏的java源代码程序!能不能帮我用VB制作一个简单的连连看游戏呀:import java.util.*; public class bycomma{ public static String[] splitStringByComma(String sou...
Java小游戏连连看中重列部分的代码Java小游戏连连看中重列部分的代码,连连看新手如何快速学会:import javax.swing.*;import java.awt.*;import java.awt.event.*;public class lianliankan implements ActionL...
连连看java代码连连看java代码,连连看游戏的java源代码程序!diamondsButton[cols][rows] = new JButton(String .valueOf(grid[cols + 1][rows + 1])); 这句话是用来设置连连看的图的。它只...
连连看游戏寻路算法cc连连看游戏寻路算法cc,一连连看算法 C语言:连连看核心算法如下: #includeusing namespace std; int board[102][102]; int nRowCount, nColCount; bool isHorizontalLineValid(...
连连看JAVA源代码怎么用java写一个小游戏连连看:连连看java源代码 2007-11-01 02:25 import javax.swing.*; import java.awt.*; import java.awt.event.*; public class lianliankan impleme...