名称:スピード
*
*
*
*
*
*
*
ゲームの目的:同じ牌をクリックするとその牌が裏向きになります。
なるべく短時間で全ての牌を裏返してください。
全部裏返すと所要時間が表示されます。
ゲームの開始:「START」をクリックする。
※ゲームを中止するときには「中止」を2回クリックしてください。
ダウンロード:SPEED.lzhをダウンロード
スピードのコード:
Call Init()
MsgBox("ゲームを始めます")
%BlankCell=0
%StartTime = ThisTime()
Do While %BlankCell <108
Set %FirstCell = Range?
Set %SecondCell = Range?
If %FirstCell ="中止" Or %SecondCell ="中止"Then
MsgBox("ゲームを中止します。")
Stop
End If
%X1 = Col(%FirstCell)
%Y1 = Row(%FirstCell)
%X2 = Col(%SecondCell)
%Y2 = Row(%SecondCell)
If Cells(%Y1, %X1)=Cells(%Y2, %X2) Then
%FirstCell.Clear(1, false, false, false)
%SecondCell.Clear(1, false, false, false)
%FirstCell.CellStyle.BackColor = RGB(204, 153, 0)
%SecondCell.CellStyle.BackColor = RGB(204, 153, 0)
%BlankCell=%BlankCell+2
End If
Loop
%EndTime = ThisTime()
%ElapsedTime =%EndTime-%StartTime
%MyMsg=Minute(%ElapsedTime) & " 分" & Second(%ElapsedTime) & " 秒かかりました。"
MsgBox(%MyMsg)
Sub Init()
declare variable Pai(108) As String
declare variable Temp As String
declare variable Moji As String
declare variable X as Integer
declare variable Y as Integer
declare variable i as Integer
Pai()={"一索","二索","三索","四索","五索","六索","七索","八索","九索",\\
"一索","二索","三索","四索","五索","六索","七索","八索","九索", \\
"一索","二索","三索","四索","五索","六索","七索","八索","九索",\\
"一索","二索","三索","四索","五索","六索","七索","八索","九索",\\
"一筒","二筒","三筒","四筒","五筒","六筒","七筒","八筒","九筒",\\
"一筒","二筒","三筒","四筒","五筒","六筒","七筒","八筒","九筒",\\
"一筒","二筒","三筒","四筒","五筒","六筒","七筒","八筒","九筒",\\
"一筒","二筒","三筒","四筒","五筒","六筒","七筒","八筒","九筒",\\
"一萬","二萬","三萬","四萬","五萬","六萬","七萬","八萬","九萬",\\
"一萬","二萬","三萬","四萬","五萬","六萬","七萬","八萬","九萬",\\
"一萬","二萬","三萬","四萬","五萬","六萬","七萬","八萬","九萬",\\
"一萬","二萬","三萬","四萬","五萬","六萬","七萬","八萬","九萬"}
Range("D6:O14").Clear(1, false, false, false)
Range("D6:O14").CellStyle.BackColor = RGB(204, 153, 0)
MsgBox("ゲームを始めます")
!!シャッフル
Randomize(ThisTime())
For i = 1 TO 1000
X = Int(Rand() * 108)+1
Y = Int(Rand() * 108)+1
Temp=Pai(x)
Pai(x) =Pai(y)
Pai(y)=Temp
Next
i=1
For y = 6 To 14
For x = 4 To 15
Cells(y, x) = Pai(i)
Moji = Right(Pai(i),1)
select case Moji
Case "萬"
Cells(y, x).CellStyle.BackColor = RGB(204, 255, 255)
Case "筒"
Cells(y, x).CellStyle.BackColor = RGB(255, 204, 204)
Case "索"
Cells(y, x).CellStyle.BackColor = RGB(204, 255, 153)
End Select
i = i +1
Next
Next
End Sub
最近のコメント