Questions tagged [2048]

2048 is an open source tile-based puzzle game. Questions with this tag should be either about implementing the game or implementing solving strategies. Ask on https://gamedev.stackexchange.com/ if it's a specific game development issue. Ask on https://gaming.stackexchange.com/ if it is about playing the game.

2048 is an open-source app created by Gabriele Cirulli, an Italian developer, as a clone of 1024. The game is a 4x4 grid that starts out with two tiles. Each tile is either a 2 or a 4. When the player swipes either up, down, left, or right, all of the tiles move in that direction and a new tile appears in a random spot. When two tiles of the same number are pushed together, they merge and form a new tile with twice the value. The object of the game is to form at least one tile with a value of 2048.

Questions with this tag should be either about implementing the game or implementing solving strategies. Ask on https://gamedev.stackexchange.com/ if it's a specific game development issue. Ask on https://gaming.stackexchange.com/ if it is about playing the game.

62 questions
2057
votes
14 answers

What is the optimal algorithm for the game 2048?

I have recently stumbled upon the game 2048. You merge similar tiles by moving them in any of the four directions to make "bigger" tiles. After each move, a new tile appears at random empty position with a value of either 2 or 4. The game terminates…
nitish712
  • 19,504
  • 5
  • 26
  • 34
17
votes
2 answers

Python: Justifying NumPy array

Please I am a bit new to Python and it has been nice, I could comment that python is very sexy till I needed to shift content of a 4x4 matrix which I want to use in building a 2048 game demo of the game is here I have this function def…
Akins Nazri
  • 307
  • 3
  • 10
4
votes
0 answers

What is the optimal algorithm for the Bicoloured 2048 game?

I made a new variant of the famous 2048 game. In this variant there are two types of tiles (2 and 3) that need to be merged separately. This makes the game considerably harder than the original. I was wondering what is the optimal algorithm for…
4
votes
1 answer

2048 game - AI can't score more that 256 average

I'm trying to implement AI for 2048 with MiniMax and Alpha-Beta pruning, based on a snake strategy (see this paper), which seems to be the best as a single heuristics. Unfortunately, AI makes 256 in most games, what is not much better than empty…
3
votes
2 answers

2048 : Strange behaviour of reduceRight in map with lodash/fp

The following code is the beginning of an attempt to make my version of 2048 (the game) using lodash-fp. I'm used to regular lodash, but this is my first contact with the fp flavor. It implements the action of pushing to the right the tiles of one…
3
votes
2 answers

2048 change check method java

I am trying to write a 2048 game in java. I am trying to make it so it checks if the board has been changed, and if it was changed it will add to the move counter and add a number to the board. Otherwise it should not do anything. I am running into…
CRT TV
  • 185
  • 2
  • 8
2
votes
3 answers

How can I implement the merge functionality for 2048

I am trying to implement the game 2048 using JavaScript. I am using a two-dimensional array to represent the board. For each row, it is represented using an array of integers. Here I am focused on implementing the merge left functionality i.e. the…
Joji
  • 4,703
  • 7
  • 41
  • 86
2
votes
1 answer

TensorFlow neural network as an API?

I am in the process of writing an AI for the game 2048. At the moment, I can pull the game state from the browser and send moves to the game, but I don't know how to integrate that with TensorFlow. The nature of the project isn't conducive to…
1
vote
1 answer

failed to resolve some method of tkinter

I am creating 2048 game on python with tkinter but I have a issue I don't know what is wrong in left, right, up and down methods created in PageOne class. In another class (StartPage), bind function calls these methods but this don't work So I don't…
1
vote
1 answer

How to run a loop in the background while running other code in python

I have a python script that (somewhat) plays 2048. The way it works is it presses left, detects if there has been a change or not, and if there hasn't (AKA the move didn't work) it presses up, if that doesn't work it presses down, etc.. If there had…
1
vote
2 answers

Can't pass 1d array into a method because there is a 2d array parameter

I can't pass the 1d array into the method because there is a 2d array parameter. I can't remove the 2d array parameter because my 2048 game board runs on that 2d array board subject. Is there a workaround? I want the slideUp to work on temp and…
1
vote
3 answers

CSS, divs moving around on content update

I'm trying to code 2048 using HTML/ CSS/ JS I got the layout of the grid using this Html:
Majd
  • 328
  • 4
  • 12
1
vote
2 answers

error while converting java.awt.geom.Rectangle2D to javafx.geometry.Rectangle2D

Rectangle2D bounds =g.getFontMetrics().getStringBounds(message,g); i got this error how can i solve it ! Type mismatch: cannot convert from java.awt.geom.Rectangle2D to javafx.geometry.Rectangle2D
Sa_IS
  • 33
  • 4
1
vote
2 answers

Filling 2D Array with 2 values from a random list (2048 Game)

I am trying to recreate the 2048 game and I have hit a brick wall and am stumped. I have made my grid with a 2d array and it seems to be working okay. I have then made a method to store an list of empty/free space in this grid/array so that the two…
1
vote
1 answer

2048 game in Python

As a beginner I started to code a 2048 game. I made the matrix and filled it with 0's. Then I wanted to write a function which loops trough the whole matrix and find all the 0 values. Then save the coordinates of the 0 values and later replace them…
D.Tomi
  • 71
  • 4
1
2 3 4 5