I encoded both ABC & XYZ as 0 1 2 and used 3x3 score-tables, different ones for each part, 0 _1 _2 |."0 1 ] 3 6 0 for pt 1, 0 1 2 |."0 1 ] 3 1 2 for pt 2
There was an extra item to add in each part, corresponding to the chosen play, rock/paper/scissors, in pt 1, and the specified result, lose/draw/win in pt 2. Cheers, Mike Sent from my iPad > On 2 Dec 2022, at 17:40, Jaume <greenni...@gmail.com> wrote: > > Hello again > I managed to solve it, but I don't like it much, so feel free to educate me. > > Reading the file, and evaluating the result is something that looked nice: > > p =. 1!:1<'day02.input' > > +/>ev each cutopen p > > xxxx > > +/>ev2 each cutopen p > > xxxx > > Now are the evaluating functions. I really don't like how they are done. > I'd even prefer to create a table and search in it, but I don't know how. > So a select. is used. > > > ev=: 3 : 0 > > select. y > > case. 'A X' do. > > 4 > > case. 'A Y' do. > > 8 > > case. 'A Z' do. > > 3 > > case. 'B X' do. > > 1 > > case. 'B Y' do. > > 5 > > case. 'B Z' do. > > 9 > > case. 'C X' do. > > 7 > > case. 'C Y' do. > > 2 > > case. 'C Z' do. > > 6 > > end. > > ) > > > And the same with different numbers for ev2. > > Would this be an appropriate way to approach the problem? Is there a > "better" way? > > > Thanks. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm