|
![](/i/fill.gif) |
On 2014-07-30 11:54 AM, scott wrote:>>
http://en.wikipedia.org/wiki/2048_(video_game)
>
> It's open source, so I can answer my own question, the value of the new
> tile that is randomly generated is chosen thus:
>
> var value = Math.random() < 0.9 ? 2 : 4;
>
> So it's a 90% chance of a 2, 10% chance of a 4. Interesting.
Yes, interesting indeed. My implementation makes it a 50-50 chance of
getting either a 2 or a 4. Perhaps I should change my game to match.
>
>> Looks very good - nice work!
>> I'd be interested to see how it was written, and what the AI logic is.
>> How does the game determine what direction to slide the tiles?
>> Generating the
>> highest value tile, or combining the most tiles? (I'm leaning toward
>> the latter)
>
> Yes I wondered that too, it looks like the answer lies in the "move"
> function of "game_manager.js", but I don't have time to try and
> understand it right now.
>
I don't believe the open source implementation above includes a solver.
My algorithm is based on the one here:
http://2048strategy.com/2048-strategy/
This web page, however, doesn't include details on how to calculate
monotonicity and smoothness. In my implementation, monotonicity is
weighted by the values of the cells and the smoothness uses a different
algorithm. It's pretty effective, though.
David Buck
Post a reply to this message
|
![](/i/fill.gif) |