Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the board
Thread view  Mix view  Order
Laaca

Homepage

Czech republic,
25.07.2022, 00:46
 

Rule in the 2048 game (Developers)

Hello! Only today I discovered the game 2048
It is really very nice and very addictive game. And simple enough for DOS port. There even already exist a pretty DOS port. And what is kind for me, it is done in pascal and it is compilable in Turbo pascal, Freepascal and even TMT pascal.
I am considering a reimplementation in graphic mode but I do not understand the rule about placing a new cells in the board.
In the DOS source it is in function boardPlace in the ENGINE.INC.
What the function does: in the random free cell on the board places a new cell - which in the 90% probability is the cell "2" and in the 10% probability cell "4".
My question is: This is the same algorithm like in the original implementation?

---
DOS-u-akbar!

jadoxa

Homepage E-mail

Queensland, Australia,
25.07.2022, 03:22

@ Laaca

Rule in the 2048 game

> What the function does: in the random free cell on the board places a new
> cell - which in the 90% probability is the cell "2" and in the 10%
> probability cell "4".
> My question is: This is the same algorithm like in the original
> implementation?

Yes.

GameManager.prototype.addRandomTile = function() {
    if (this.grid.cellsAvailable()) {
        var e = Math.random() < .9 ? 2 : 4,
            t = new Tile(this.grid.randomAvailableCell(), e);
        this.grid.insertTile(t)
    }
},

bretjohn

Homepage E-mail

Rio Rancho, NM,
25.07.2022, 22:39

@ Laaca

Rule in the 2048 game

I just downloaded an played with this for a few minutes. While it would be somewhat interesting to make a graphics version of it for DOS, I don't think that would really add anything useful.

I would rather see the current version "fixed up". A couple of obvious things I see missing in the current version are that it only accepts the WASD keys for movement when it should really accept either those keys or the arrow keys, and the fact that there is no help to figure out how to play the game, what the goal of the game is, or how the scoring works. I had to look online to figure out what the point of the game is even supposed to be when that should be included in the game.

It probably should even include a "demo" game so you could watch the computer play for a little while. This could either be the computer playing well (which would mean developing and implementing a sound strategy in software) or just having the computer movements be random.

Back to the board
Thread view  Mix view  Order
22049 Postings in 2034 Threads, 396 registered users, 74 users online (0 registered, 74 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum