Hi Brian,
Are you using the latest version of 2048? Raul identified incorrect
behaviour in the initial version I released which was corrected in version
1.0.1

load 'pacman'

'search' jpkg '2048'

┌──────────┬─────┬─────┬─────────┐

│games/2048│1.0.1│1.0.1│2048 game│

└──────────┴─────┴─────┴─────────┘


Below is a slightly simpler version of your corner. Running it I have got
scores of over 6000.



corner=: monad define

while. _1 ~: 18!:0 grd do.

Start=. Grid__grd

right__grd ''

down__grd ''

if. Grid__grd -: Start do. NB. see if right/down didn't do anything

up__grd ''

end.

Count =: Count + 1

if. Count >: y do. break. end. NB. This is just a failsafe

end.

)


On Tue, Jul 5, 2016 at 9:35 AM, Brian Schott <[email protected]> wrote:

> I have been spending a little more time than I would like to admit with
> 2048 since you released it. And just this weekend I discovered the
> following link which mentions a rather simple strategy for doing well at
> 2048, referred to as "The Corner Strategy" therein. If you don't want to
> read the article, the strategy is summarized there as follows.
>
> "Tap Right and Down in alternating order until you can’t move. Then press
> Up. Repeat."
>
> https://nbickford.wordpress.com/2014/04/18/how-to-beat-threes-and-2048/
>
>
> Well, I have tried adding the following snippet of code to the jconsole
> session to see if I could automate The Corner Strategy. The code is very
> primitive and I struggle to understand how to make it so kludgy in the
> context of the locale-defined code environment. For example I was unable to
> just use the verb compress_g2048_=: -.&0 and had to redefine it in the base
> locale to make my kludge work.
>
> load'games/2048'
>
> Count =: 0
> compress=: -.&0   NB. I wish I could see an easy way
> NB.          to just use the existing compress_g2048_
> corner=: monad define
> while. 1 do.
> right__grd ''
> down__grd ''
> r =. Grid__grd -: mergerow_g2048_ toRight_g2048_ Grid__grd
> d =. Grid__grd -: mergerow_g2048_ toDown_g2048_ Grid__grd
> if. r *. d  NB. to see if no right or down will work
> do. up__grd ''
> end.
> Count =: Count + 1
> if. Count >: y do. break. end.  NB. This is just a failsafe
> NB.  because I could not tell a better way to stop a
> NB.  runaway simulation
> end.
> )
>
>
> Note 'To run the code'
>    Count=: 0
>    grd=: g2048Con ''
>    corner 2000   NB. 2000 is just a large number I chose
>    count             NB. this is after the "simulation"
> NB. repeat?
> )
>
> I am surprised at the apparently poor behavior of The Corner Strategy in my
> simulation and am wondering if I have something wrong.
> By poor behavior, I mean that the Count only gets to about 100 or 200 and
> then each simulation quits (with 2 different error messages, btw). And so
> far no simulation has done really well, only max Scores of about 4000.
>
>
>
> On Tue, Jun 21, 2016 at 3:54 AM, Ric Sherlock <[email protected]> wrote:
>
> > I've added a Wd-based UI to the Rosetta code task 2048 engine
> > <http://rosettacode.org/wiki/2048#J> and released it as an addon.
> >
> > Install via the Package Manager
> > Run using:
> >    load 'games/2048'
> >
> > or load the desired UI directly
> >    load 'games/2048/ui_wd'
> >    load 'games/2048/ui_console'
> >
> > Enjoy!
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
>
> --
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to