Rebmu:197个175 168 167字符
生成一系列数字的组合(例如12369从左上到右上到右下),检查组合是否有效,并增加一个计数器(如果有效)。运行可能需要一段时间*。返回解锁手机所需的秒数。
B[[2 13][4 17][6 39][8 79][5 19][5 28][5 37][5 46][a 0]]Fdz[Q1feCb[st[a]paStsC/1 Qa^Qa^e?NNfiAtsC/2 e?NNfiArvTSc/2]]rpJ987653088[StsADj1233iA^e?SuqSf[++K]]adKmp30dvK 5
取消评论:
; for each subarray c:
; the sequences c/2 and c/3 are invalid before the point c/1 is pressed
; a 0 - a is never in the sequence, therefore 0 is always invalid
b: [[2 13] [4 17] [6 39] [8 79] [5 19] [5 28] [5 37] [5 46] [a 0]]
; checks (most) conditions of validity
f: dz[
; set q to 1
q: 1
; foreach array in b as c
fe c b [
; set a to be portion of s before c/1
st [a] pa s ts c/1
; q = q and (a does not contain c/2) and (a does not contain reverse of c/2)
q: a^ q
a^ e? nn fi a ts c/2
e? nn fi a ts rv c/2
]
]
; repeat 98765308 times, with j = 1 to 98765308
; 987653088 = 987654321 (largest valid combination) - 1234 (smallest valid combination) + 1
rp j 987653088 [
; set s to j+1233 (smallest valid combination - 1) as a string
s: ts ad j 1233
; if f returns trues and s does not contain duplicates, increment k
i a^ e? s uq s
f
[++ k]
]
; print k (number of combinations) + 30 * (k/5) -> number of seconds needed
ad k mp 30 dv k 5
程序从1循环到(987654321-1233),检查1233+循环计数器(因此检查1234到987654321)。
如果将数字987653088
替换为9876-1233
或8643
,则程序将找到所有4点组合所用的时间。
输出9876-1233=8643
(4点组合):
>> rebmu %combinations.rebmu
== 11344
输出98765-1233=97532
(4点和5点组合):
>> rebmu %combinations.rebmu
== 61426
987654-1233=986421
(4、5、6点组合)的输出:
>> rebmu %combinations.rebmu
== 243532
* 4/5点花了我大约8秒钟来跑;4-6耗时约77秒。可能需要约24小时或更长时间,具体取决于谁运行此操作来计算4-9点组合的组合数量。