Answer by Neil for Shortest path to open a letter lock
Charcoal, 19 bytesI⁻¹³﹪⁻¹³Eθ⁻℅ι℅§ηκ²⁶Try it online! Link is to verbose version of code. Explanation: Similar to @Tbw's method, but subtracts the 13 in a different way to save bytes. (@l4m2's method...
View ArticleAnswer by Neil for Shortest path to open a letter lock
Retina 0.8.2, 90 bytesO$#`.$.%`¶M!`..(.).$&-$1%{`.*?([A-Z])(-?)(#*)\1.*$2$.3T`L`ZL`^.T`ZL`L`.$.-#$&#Try it online! Takes input on separate lines but link is to test suite that splits on commas...
View ArticleAnswer by Xcali for Shortest path to open a letter lock
Perl 5-lF, 48 bytessay+($_=(ord shift@F)-ord)-($_>13)*26for<>=~/./gTry it online!
View ArticleAnswer by Kevin Cruijssen for Shortest path to open a letter lock
05AB1E, 11 bytesÇ`-13+₂%13-Port of @Tbw's Uiua's answer, so also uses negative values for down and positive for up.Try it online or verify all test cases.Explanation:Ç # Convert both strings in the...
View ArticleAnswer by doubleunary for Shortest path to open a letter lock
Google Sheets, 45 bytes=index(mod(code(A1:A4)-code(B1:B4)+13,26)-13)Put the position in cells A1:A4, the combination in cells B1:B4 and the formula in cell C1. The output will be in positive/negative...
View ArticleAnswer by pajonk for Shortest path to open a letter lock
R, 38 bytes\(s,t,`+`=utf8ToInt)(+s-+t--13)%%26-13Attempt This Online!Port of @Tbw's Uiua answer.R, 42 bytes\(s,t)strtoi(paste0(t,57,s),36)%%97%%26-13Attempt This Online!Port of @l4m2's JavaScript...
View ArticleAnswer by Nick Kennedy for Shortest path to open a letter lock
Jelly, 7 bytesO_/æ%13Try it online!A monadic link taking a list of two strings and returning a list of integers with negative integers as down and positive as up.ExplanationO | To codepoints _/ |...
View ArticleAnswer by 138 Aspen for Shortest path to open a letter lock
Scala 3, 78 75 bytesA port of @l4m2's Javascript code in Scala.Saved 3 bytes thanks to the comment of @l4m2(x,y)=>x.zip(y).map{case(c,v)=>Integer.parseInt(s"${c}57${v}",36)%97%26-13}Attempt This...
View ArticleAnswer by Tbw for Shortest path to open a letter lock
APL(Dyalog Unicode), 15 bytes SBCS13-26|13+-⍥⎕UCSTry it on APLgolf!A tacit function which takes strings on the left and right and returns an array of positive and negative values. Port of my Uiua...
View ArticleAnswer by Tbw for Shortest path to open a letter lock
Uiua 0.8.0, 10 bytes SBCS-13◿26+13-Try on Uiua Pad!Outputs positive and negative values.18 bytes SBCS+@a↥0⊃±⌵-13◿26+13-Try on Uiua Pad!Outputs 2 arrays, values and letters. Up is "a" and down is...
View ArticleAnswer by l4m2 for Shortest path to open a letter lock
JavaScript (Node.js), 51 bytesx=>y=>x.map((c,i)=>parseInt(c+57+y[i],36)%97%26-13)Try it online!Output pos/negJavaScript (Node.js), 68...
View ArticleShortest path to open a letter lock
This quite literally came to me in a dream.A common combination padlock design has letters on the dials so you can set the combination to a word. Unfortunately, I can't read, but I can count....
View Article
More Pages to Explore .....