@@ -245,7 +245,7 @@ C.commands = {
245245 self .notepad = n and bit32.bxor (self .commandIndex or self .notepad , n ) or bit32.bnot (self .commandIndex or self .notepad )
246246 end ,
247247 [' ¬' ] = function (self , n )
248- self .notepad = (n or self .notepad ) and 0 or 1
248+ self .notepad = (n or self .notepad ) == 0 and 1 or 0
249249 end ,
250250
251251 [' >n' ] = function (self , n )
@@ -285,6 +285,8 @@ C.commands = {
285285 else
286286 label .args = nil
287287 end
288+
289+ label .index = self .commandIndex
288290 end ,
289291 [' )' ] = function (self , n )
290292 local label = table.remove (self .loops )
@@ -299,8 +301,8 @@ C.commands = {
299301 end
300302 end
301303 end ,
302- [' ?n ' ] = function (self , n )
303- if n == 0 then
304+ [' ?' ] = function (self , n )
305+ if ( n or self . notepad ) == 0 then
304306 self .conditionFailed = true
305307 if not self .options .experimental then
306308 self :skipcmd ()
@@ -377,6 +379,21 @@ C.commands = {
377379 [' ■' ] = function (self , n )
378380 self .cube = Cube .new (n )
379381 end ,
382+ [' fi' ] = function (self , n )
383+ self .cube :setFace (self .commandIndex , n )
384+ end ,
385+
386+ [' p' ] = function (self , n )
387+ n = n or self .notepad
388+ local sqrt = math.sqrt (n )
389+ for i = 2 , sqrt do
390+ if i % n == 0 then
391+ self .notepad = 0
392+ return
393+ end
394+ end
395+ self .notepad = 1
396+ end ,
380397
381398 [' #x' ] = function (self , n )
382399 print (self .cube :tostring ())
@@ -400,6 +417,13 @@ C.commands = table.iterator(C.commands)
400417 end
401418 end
402419
420+ if args :match (" i" ) then
421+ local f = func
422+ func = function (self , n )
423+ return self .commandIndex and f (self , n ) or nil
424+ end
425+ end
426+
403427 return cmd , args , func
404428 end )
405429 :totable ()
0 commit comments