Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread Henry Rich
This time seems way too high to me. When I time a + a on 1e7 ints, I get about .03 sec. When I time a { i. 100 on 1e7 ints, I get about the same. This program should be about 14 of those, and thus take around 0.5 sec. 3 sec is way too high. Can you dig into this and see where the time is

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread Ryan Eckbo
Henry's idea made the computation 10 times faster: hands=. |: 53,.~ >:(1e7#7)?52 6!:2 'handvalues=. (HR {~ +)/ hands' 3.08429 HANDTYPE=: <;._2 [0 : 0 BAD High Card One Pair Two Pair Trips Straight Flush Full House Quads Straight Flush ) HANDTYPE {~ _12 (33 b.) 10 {. handvalues NB. r

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread Raul Miller
I think that consecutive values are "folded together". Where possible, I imagine that results which lead to the same poker result structure hit the same index regardless of the individual card values. So it's more compact than a strict representation of combinations. That said, it's definitely not

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread 'Pascal Jasmin' via Programming
That is cool. Carry on. I was just assuming that constructor params were always '' from not looking carefully. - Original Message - From: Michal Wallace To: programm...@jsoftware.com Sent: Sunday, January 3, 2016 10:31 AM Subject: Re: [Jprogramming] feedback wanted for mandelbrowse

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread 'Pascal Jasmin' via Programming
assuming this is the correct result, (HR {~ +)/@:(,&53) 1 5 9 12 20 25 42 8730 it is first looking up the 42+53 index in HR, then looking up 25 + that index... an interesting way to hash. Some optimizations of HR would include making it 0 based. There is probably a +/@:+/\ or */ version of

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Michal Wallace
On Sun, Jan 3, 2016 at 8:37 AM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > mistyped sorry > > > mbrowse_z_ =: conew bind 'mbrowse' Oh. If I do this, then mbrowse'' returns a new namespace, but doesn't actually run the constructor. (f bind y) x -> (f y) (f & y) x ->

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread Raul Miller
If anyone want to play with this, they should have a copy of the HR file: https://github.com/christophschmalhofer/poker/blob/master/XPokerEval/XPokerEval.TwoPlusTwo/HandRanks.dat Or you can download the entire repository from github. You can use the "View Raw" link to download a copy. I was hop

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Michal Wallace
Thanks, David and Cliff, for pointing out the 'number of iterations' thing. I added some keys to change this, and updated the docs. On Sun, Jan 3, 2016 at 6:49 AM, David Lambert wrote: > The program works and is fairly easy to read with the caveats that I had > to read the source to guess for th

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread 'Pascal Jasmin' via Programming
mistyped sorry mbrowse_z_ =: conew bind 'mbrowse' - Original Message - From: Michal Wallace To: programm...@jsoftware.com Sent: Sunday, January 3, 2016 9:03 AM Subject: Re: [Jprogramming] feedback wanted for mandelbrowse tutorial On Sat, Jan 2, 2016 at 9:08 PM, 'Pascal Jasmin' via Pro

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread Henry Rich
(HR {~ +)/"1 hands You will be doing three verb-starts for every atom of input. Better: (HR {~ +)/ |: hands (of course, you could create the array transposed to begin with) Henry Rich On 1/3/2016 9:15 AM, 'Pascal Jasmin' via Programming wrote: (HR {~ +)/@:(,&53) I'm not sure why the sum

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread bill lam
I guess it was a typo and he meant bind. On Jan 3, 2016 10:03 PM, "Michal Wallace" wrote: > On Sat, Jan 2, 2016 at 9:08 PM, 'Pascal Jasmin' via Programming < > programm...@jsoftware.com> wrote: > > > > mbrowse_z_ =: conew bond 'mbrowse' > > > > Thanks for looking. > What's bond? I don't seem to

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread 'Pascal Jasmin' via Programming
(HR {~ +)/@:(,&53) I'm not sure why the sum is a useful index as I don't think its unique, but you are repeating for each card. Perhaps this is intended? (HR {~ +/)@:(,&53) - Original Message - From: Ryan Eckbo To: J-programming forum Sent: Saturday, January 2, 2016 10:56 PM Subjec

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Michal Wallace
On Sat, Jan 2, 2016 at 9:08 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > > mbrowse_z_ =: conew bond 'mbrowse' > Thanks for looking. What's bond? I don't seem to have this conjunction in j804, other than in the 'primitives' package, where it's just an alias for `&`. --

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Linda A Alvord
Here's how I got to my standard palette. viewmat i.8 ]RGB=:255*#:i.8 0 0 0 0 0 255 0 255 0 0 255 255 255 0 0 255 0 255 255 255 0 255 255 255 RGB viewmat i.8 ]GRB=:1 0 2{"1 RGB 0 0 0 0 0 255 255 0 0 255 0 255 0 255 0 0 255 255 255 255

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Cliff Reiter
Nice work. I believe the smoothing that you see is due to the max bound on the number of iterations (24). But as you raise that, things slow down. On 1/2/2016 9:11 PM, Michal Wallace wrote: Hey all. Happy new year! I made a small GUI app for a tutorial video I'm planning: https://github.

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread David Lambert
The program works and is fairly easy to read with the caveats that I had to read the source to guess for the name of the main verb, and experiment to find that mbrowse's arguments are ignored. The "smoothing out after a few zoom steps" issue is caused by too few iterations rather than insuffic

Re: [Jprogramming] feedback wanted for mandelbrowse tutorial

2016-01-03 Thread Linda A Alvord
Pascal, Viewmat is a dyadic verb. All you need is a table of (N,3) of colors like ]P=:3 3$255 0 0 255 255 0 0 0 255 255 0 0 255 255 0 0 0 255 This selects red, yellow and blue from (256x^3) colors. 256x ^3 16777216 Give a child a box with 16,777,216 crayons next Christmas!