Day 11's **question** made my head hurt. I couldn't understand the rules,
so I mentioned it to my honey and she expressed an interest in
understanding the question. Before I new it, she had the answers using
paper and pencil in much less time than I could have programmed the
problem, even without
On Fri, Dec 11, 2015 at 11:11 PM, Raul Miller wrote:
> Is this enough to make clear what was happening there?
>
Thanks -- in the end I understood it well enough to see that it had a bug,
and create a correct alternative, so I'm feeling pretty good about it now.
-
On Dec 12, 2015 3:29 AM, "Ryan Eckbo" wrote:
>
> One fix is to hardcode the number of letters:
>
>inc=: >:&.(26 26 26 26.)&.(alpha&i.)
>inc 'axyz'
> axza
>
That is what I did with this adverb
ex: 0 1 -: (2 nextLetter) (0,0)
ex: 1 0 -: (2 nextLetter) (0,25)
nextLetter=: (1 : '(((m#26)
You're right that it's buggy, because as Raul and Pascal have hinted at,
'a' is acting as a 0
-- so each string is implicitly preceded by an 'a'. Another consequence
is that any password
beginning with an 'a' will be beheaded:
inc 'z' NB. 'z' equivalent to 'az'
ba
inc 'axyz' NB. behead
On Fri, Dec 11, 2015 at 10:49 PM, Geoff Canyon wrote:
> On Fri, Dec 11, 2015 at 6:56 PM, Ryan Eckbo wrote:
>> inc=: >:&.(26.)&.(alpha&i.)
>>
>
> I get:
>inc 'a'
> b
>inc 'z'
> ba
>inc 'y'
> z
>
> And my grasp of J isn't strong enough to figure out why.
Assuming u and v are verbs, a
inc 'z'
ba
1 0 base 26.
for the problem, this isn't an issue as there is no wraparound to the first
char of the input.
- Original Message -
From: Geoff Canyon
To: programm...@jsoftware.com
Sent: Friday, December 11, 2015 10:49 PM
Subject: Re: [Jprogramming] adve
nice! looks clean
On Dec 11, 2015 6:56 PM, "Ryan Eckbo" wrote:
> Here's my version (&. is one of my favourite J operators):
>
> pass=:'hxbxwxba'
> alpha=: a.{~ 97+i.26
> inc=: >:&.(26.)&.(alpha&i.)
> nobad=: -.@:(+./)@:('iol'&e.)
> strt=: +./@:(3 (0 1 2 -: ([ - {.)@:(alpha&i.))\ ]) NB. this is
On Fri, Dec 11, 2015 at 6:56 PM, Ryan Eckbo wrote:
> inc=: >:&.(26.)&.(alpha&i.)
>
I get:
inc 'a'
b
inc 'z'
ba
inc 'y'
z
And my grasp of J isn't strong enough to figure out why. I came up with
this alternative that seems to work:
inc =: ((26&|)@>:)&.(alpha&i.)
Perhaps that could
Here's my version (&. is one of my favourite J operators):
pass=:'hxbxwxba'
alpha=: a.{~ 97+i.26
inc=: >:&.(26.)&.(alpha&i.)
nobad=: -.@:(+./)@:('iol'&e.)
strt=: +./@:(3 (0 1 2 -: ([ - {.)@:(alpha&i.))\ ]) NB. this is ugly
pairs=:1&<@:#@:~.@:((#~ ,&0) (2 -:/\ ]))
good=: pairs *. strt *. nobad
s
Such a pity J is not too popular on github.
Anyway, here's my solution too. In general, I don't like to use tacit defs
everywhere. Procedural logic is much more clear and easier to read and
understand and not always slower.
NB. next good password http://adventofcode.com/day/11
ilo =: (+./)@(8 11
my solution for day 11:
https://gist.github.com/joebo/49e9ac513c2dcac3b012
NB. creates and documents a function
NB. could be improved to split out example
NB. or automatically assert on the example
NB. originally from
http://www.jsoftware.com/pipermail/programming/2014-July/038316.html
func=: 3
Because of this difficulty, I invented a new programming language.
Puzzle solver may be found at
http://forums.devshed.com/programming-languages-139/reversed-972280.html#post2963935
Date: Fri, 11 Dec 2015 02:48:25 -0500
From: David Lambert
To: programming
Subject: [Jprogramming] adventofcode
Original Message -
> From: David Lambert
> To: programming
> Sent: Friday, December 11, 2015 2:48 AM
> Subject: [Jprogramming] adventofcode 11
>
> In the session below, the final sentence
> valid A
> runs "forever". Why?
>
> $ ijconsole
>
> J
another workaround
(_1 _1 E.&,: (2 -/\ ])) a2v'abcdddoz'
1 1 0 0 0 0 0
- Original Message -
From: 'Pascal Jasmin' via Programming
To: "programm...@jsoftware.com"
Sent: Friday, December 11, 2015 9:48 AM
Subject: Re: [Jprogramming] adventofcode
\ ]) a2v'abcdddoz'
- Original Message -
From: David Lambert
To: programming
Sent: Friday, December 11, 2015 2:48 AM
Subject: [Jprogramming] adventofcode 11
In the session below, the final sentence
valid A
runs "forever". Why?
$ ijconsole
JVERSION
Engine: j803/
Applying straight the following pattern is the killerwhen using _1 _1 E. y
2 -/\0 1 2 3 3 3 14 25
_1 _1 _1 0 0 _11 _11
There is a bug mentioned in nuvoc E. (so who knows).
Op 11-12-2015 om 08:48 schreef David Lambert:
In the session below, the final sentence
valid A
runs "forever". Wh
In the session below, the final sentence
valid A
runs "forever". Why?
$ ijconsole
JVERSION
Engine: j803/2014-10-19-11:11:11
Library: 8.04.13
Platform: Linux 64
Installer: unknown
InstallPath: /usr/share/j/8.0.4
LC=: 26}.Alpha_j_
a2v=: _8{.LC&i.
NB. these tests apply to numerical
17 matches
Mail list logo