單機版時距量測軟體 (需要一點DIY喔) - 魔術方塊

William avatar
By William
at 2008-09-20T11:59

Table of Contents

這裡提供一個程式碼,讓想要有免費而已且不用連上網路的計時器的玩家

能夠有另一種選擇。請看以下步驟。


首先請先新增一個Excel檔



打開它



左下角有分頁標籤 (例如: sheet1, sheet2...)



在分頁標籤上面按右鍵



選擇「檢視程式碼」



會看到一塊視窗是為了寫VBA用的



在左手邊也有sheet1的標籤



在標籤上按右鍵,選擇新增模組



找到新增的模組雙按它 (按兩下)



在空白處貼上程式碼



按左上角的存檔圖案



這樣主功能就完成了!


建議能夠用一個美工圖案,連結到巨集,以按鈕的方式來操作會比較方便。

這次我把scrambles 的亂數產生公式檢查了一遍,如果有出現奇怪的scramble

麻煩可以站內信告訴我。


使用方法:

我盡量說明怎樣用Excel上面的美工圖案做按鈕。

請先選擇一個美工圖案,並且放到活頁簿空白處。

按右鍵,選擇指定巨集。把指定的巨集選為「CubeCounter」。

這樣就可以用滑鼠按按鈕啟動計時了。


真的看不我的按鈕製作說明,可以去點選巨集,直接執行「CubeCounter」。

但是這樣很麻煩... 。


敲空白鍵可以代替滑鼠去按對話窗的「確定」。這樣方塊塊解完的時候就可以用

敲空白鍵的方式結束計時。


其實我還自己寫了「記錄」按鈕的功能。不過先試試看有沒有人會用CubeCounter吧。


以下code:


---不要複製我,複製下面的部分---


Sub CubeCounter()
Dim scramble As Integer '決定scrambles所使用的整數變數
Dim subscramble As Integer '決定scrambles所使用的整數變數
Dim scrtime As Integer '決定length of scrambles所使用的整數變數
Dim scrguard1 As String '為了避免重複轉同一方向所使用的整數變數
Dim scrguard2 As String '同上
Dim scrguarda As Integer '同上
Dim scrguardb As Integer '同上
Dim scrstring As String '顯示scrambles給使用者的字串變數
Dim scrpassto As String '為了接續(scramble)變數所產生的轉法字串所使用的字
串變數

scrguarda = 0 'Reset Variable
scrguardb = 0

Dim mybtn As Integer
Dim myMsg As String, myTitle As String

Worksheets(1).Activate
Range("A1") = "Length:"
Range("A2") = "scramble:"
Range("G7") = "剛剛的秒數:"
Range("I5") = "最慢:"
Range("I6") = "最快:"
Range("I7") = "平均秒數"
Range("K7") = "資料筆數"
scrtime = Worksheets(1).Range("B1") '取得length of scramble

'
'產生亂數scramble表
'
Do While scrtime > 0
scrtime = scrtime - 1
scrpassto = ""

Randomize

scramble = Int(Rnd() * 9 + 1)
subscramble = Int(Rnd() * 3 + 1)

Select Case scramble
Case 1
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda <> 7 Then
Select Case subscramble
Case 1
If scrguard1 <> "L' " Then
scrpassto = "R "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 2
If scrguard1 <> "L " Then
scrpassto = "R' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 3
If scrguard1 <> "2L " Then
scrpassto = "2R "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
End Select
Else
scrtime = scrtime + 1
End If
Case 2
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda <> 7 Then
Select Case subscramble
Case 1
If scrguard1 <> "R' " Then
scrpassto = "L "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 2
If scrguard1 <> "R " Then
scrpassto = "L' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 3
If scrguard1 <> "2R " Then
scrpassto = "2L "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
End Select
Else
scrtime = scrtime + 1
End If
Case 3
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda <> 8 Then
Select Case subscramble
Case 1
If scrguard1 <> "D' " Then
scrpassto = "U "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 2
If scrguard1 <> "D " Then
scrpassto = "U' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 3
If scrguard1 <> "2D " Then
scrpassto = "2U "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
End Select
Else
scrtime = scrtime + 1
End If
Case 4
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda <> 8 Then
Select Case subscramble
Case 1
If scrguard1 = "U' " Then
scrpassto = "D "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 2
If scrguard1 = "U " Then
scrpassto = "D' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 3
If scrguard1 = "2U " Then
scrpassto = "2D "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
End Select
Else
scrtime = scrtime + 1
End If
Case 5
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda <> 9 Then
Select Case subscramble
Case 1
If scrguard1 <> "B' " Then
scrpassto = "F "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 2
If scrguard1 <> "B " Then
scrpassto = "F' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 3
If scrguard1 <> "2B " Then
scrpassto = "2F "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
End Select
Else
scrtime = scrtime + 1
End If
Case 6
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda <> 9 Then
Select Case subscramble
Case 1
If scrguard1 <> "F' " Then
scrpassto = "B "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 2
If scrguard1 <> "F " Then
scrpassto = "B' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
Case 3
If scrguard1 <> "2F " Then
scrpassto = "2B "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Else
scrtime = scrtime + 1
End If
End Select
Else
scrtime = scrtime + 1
End If
Case 7
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda = 1 Or scrguardb = 1 Or scrguarda = 2 Or
scrguardb = 2 Then
scrtime = scrtime + 1
Else
Select Case subscramble
Case 1
scrpassto = "M "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Case 2
scrpassto = "M' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Case 3
scrpassto = "2M "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
End Select
End If
Case 8
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda = 3 Or scrguardb = 3 Or scrguarda = 4 Or
scrguardb = 4 Then
scrtime = scrtime + 1
Else
Select Case subscramble
Case 1
scrpassto = "E "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Case 2
scrpassto = "E' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Case 3
scrpassto = "2E "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
End Select
End If
Case 9
If scramble = scrguarda Or scramble = scrguardb Then
scrtime = scrtime + 1
ElseIf scrguarda = 5 Or scrguardb = 5 Or scrguarda = 6 Or
scrguardb = 6 Then
scrtime = scrtime + 1
Else
Select Case subscramble
Case 1
scrpassto = "S "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Case 2
scrpassto = "S' "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
Case 3
scrpassto = "2S "
scrstring = scrstring + scrpassto
scrguard2 = scrguard1
scrguard1 = scrpassto
scrguardb = scrguarda
scrguarda = scramble
End Select
End If
End Select

Worksheets(1).Range("B2") = scrstring
Range("C1") = scrtime
Loop

Worksheets(1).Range("B2") = scrstring

End Sub



--

All Comments

Frederic avatar
By Frederic
at 2008-09-22T11:11
推...
Dorothy avatar
By Dorothy
at 2008-09-24T18:55
推..
Audriana avatar
By Audriana
at 2008-09-28T11:01
推 我下次來寫c++版本好了...
Catherine avatar
By Catherine
at 2008-10-03T07:28
推推推...
Doris avatar
By Doris
at 2008-10-07T17:12
推... 原PO專業
Candice avatar
By Candice
at 2008-10-12T01:36
好用!!快出可以記錄的版本吧
Suhail Hany avatar
By Suhail Hany
at 2008-10-14T04:27
哈...正需要可以計時的軟體...感謝

影片診療

Hedwig avatar
By Hedwig
at 2008-09-20T10:41
在下最近玩單手 可是速度總是快不起來... 應該是手法的問題吧 所以放上影片給各位大大診療 都是用之前板友提供的superSC U2 L R D2 Uand#39; R2 F2 Rand#39; Dand#39; Land#39; Dand#39; F D U2 Rand#39; D U2 Band ...

CS rubik's計畫 - 在cs中噴滿方塊!

Emily avatar
By Emily
at 2008-09-20T03:29
板上許多人最近都在回味cs電玩 但…我們是方塊版啊! 所以不能忘本! 來吧! Rubikand#39;s PTT專用cs logo! 我今天試做了幾張,將*.bmp放置在cstrike\logos底下即可使用 進入game選項,設定完logo後,下次進入場地中才會套用! http://jfy. ...

最近挖坑哇上癮了....

Eden avatar
By Eden
at 2008-09-20T00:44
主要挖 1.sq-1 (黑白紅綠透) 2.superSQ-1 (黑白)_ 3.國甲3*3 (黑白) 4.國丙3*3 ( 黑 白 粉紅 藍 綠 透夜 透藍 透綠) 5.全封閉3*3 (黑白粉紅) 6.megaminx(仿的)(黑) 通 ...

gan90134

Charlotte avatar
By Charlotte
at 2008-09-20T00:30
ID: gan90134 如何稱呼: 呱呱 大家都這麼叫 性別:男生 方塊年齡:2個月吧? 主要方法: LBL 還在學啦XD 3x3 最佳紀錄(non-lucky):61.0 sec 3x3 最佳平均時間:80 sec 吧!! 出沒地點:平日台中 假日斗六 對方塊的哪一項最有興趣? 速度 ...

這禮拜有沒有台中的版聚阿??

Joseph avatar
By Joseph
at 2008-09-20T00:22
這星期六會到台中去 不知道有沒有板聚可以跟 我希望可以找到人來幫我修V6.atat -- 每個人心中都有一個大叔……那邊那個有啤酒肚穿汗衫加藍白拖鞋的大叔 沒錯!就是在說你啊!喂!大叔!你別走啊!你走了我的心中就沒有大叔了啊! 這樣我的心會空虛到發出喀擦叩的回音吶…… 有啤酒肚穿汗衫加藍白拖鞋的大 ...