#!/usr/bin/perl -w use strict; $_="qwertyuiopasdfghjklzxcvbnm "; my@b=(m{(.{10})(.{9})(.*)});@b =map{my@a=split//;$_=\@a;}@b; $_="01042222203331033344022222" ."2210433333011333022220430222" ."1030443333011330222222203033" ."3334024022102222204330133333" ."0122222030";my@c=split//;my$a =6;my$b=1;for(@c){$b--if($_==1) ;$a--if($_==2);$a++if($_==3); $b++if($_==4);print @{$b[$b]}[$a] if($_==0);}
Quite easy to deconstruct I think. An interestiung way to japh though....

Replies are listed 'Best First'.
Re: Fun and Games
by tachyon (Chancellor) on May 18, 2001 at 15:53 UTC
    Yup, pretty easy to deconstruct. You use quite a bit of superfluous syntax by the way. How did you work the encoding in the first place?
     
    tachyon
    $_="qwertyuiopasdfghjklzxcvbnm "; # string @b=(m{(.{10})(.{9})(.*)}); # @b = (qwertyuiop, asdfghjkl, 'zxc +vbnm '); @b=map{my@a=split//;$_=\@a;}@b; # this line makes a 2D array #net effect of above code is to make a 2D array of letters: # we could avoid the temp array @a by using: @b = ('qwertyuiop', 'asdfghjkl', 'zxcvbnm '); @b = map {[split//]}@b; # or alternatively we could: @a = ('qwertyuiop', 'asdfghjkl', 'zxcvbnm '); for (@a) {push @b, [split'',$_]} # we could even: @b = ( ['q','w','e','r','t','y','u','i','o','p'], ['a','s','d','f','g','h','j','k','l'], ['z','x','c','v','b','n','m',' '] ); $_="010422222033310333440222222210433333011333022220430222103044333301 +133022222220303333340240221022222043301333330122222030"; my@c=split//; # @c is simply an array of the values above 0..4 my$a=6;my$b=1; # init values for(@c){ $b--if($_==1); $a--if($_==2); $a++if($_==3); $b++if($_==4); # all we are doing is grubbing out the chars from the 2D array # based on the index in @c, I don't like this syntax much: print @{$b[$b]}[$a]if($_==0); # this array addressing syntax is cleaner I think print $b[$b][$a] unless $_; # you could also do this -> print @b->[$b][$a] unless $_; }
      Maybe you missed the most obvious thing here. The 2d array is a map of my keyboard.

      1,2,3 & 4 move around the keyboad. 0 presses a key.