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
0
votes
0 answers

Creating 2048 GAME in java using only the console

I hope i find someone to help finish the game ( 2048 )., since I'm in a computing programmer for only 2 month it's been difficult for me to do it. The basis of this game that the user can choose what ever dimension he wants, and i kind of figured it…
0
votes
1 answer

Printing 2048 board in python with spacing with standard libraries

I want to print a 2048 board with proper spacing. I was able to reach till here. ╔═══╤═══╤═══╤═══╗ ║ 1 │ 2 │ 3 │ 4 ║ ╟───┼───┼───┼───╢ ║ 3 │ 2 │ 4 │ 5 ║ ╟───┼───┼───┼───╢ ║ 1 │ 1 │ 4 │ 2 ║ ╟───┼───┼───┼───╢ ║ 6 │ 5 │ 4 │ 3 ║ ╚═══╧═══╧═══╧═══╝ But…
0
votes
0 answers

What is an alternative method to replace grayscale value?

I am trying to make a bot to read the data from the game, 2048, and decide the best movement. I have preset the grayscale value for every number. But unfortunately, the grayscale value for an empty slot and the number 512 is the same. Are there any…
smljiaooo
  • 1
  • 1
0
votes
0 answers

Making 2048 game faster

Is there a way to make my 2048 game run faster? I made a setting called high speed mode so that if moves were made really fast I would just skip the spawning, combining and moving animations, however even with that I am still usually one or two…
0
votes
0 answers

Why does my 2048-style game stop working after 128?

For fun, I'm making a 2048-style combine-and-display program. Every outer loop, it adds a 2 to the 0-index of an integer array list. In an inner for-loop, it checks to see if the value of the index is the same as the value of the index above it; if…
Quintis555
  • 659
  • 3
  • 11
  • 16
0
votes
0 answers

2048 game movement assistance java

I started making this extremely simple 2048 game, without graphics and stuff (only array), and made the board : import java.util.*; public class GameBoard { String [][] GameBoard; void justprint(String s, int n) //(ignore, just a function that…
Kian Shah
  • 1
  • 1
0
votes
0 answers

Only moving DOWN when plays 2048 automatically with Selenium

I am trying to play 2048 automatically with Selenium as directed in Automate the Boring Stuff. But every move is DOWN no matter what argument I send to send_keys(). Here is the code: from selenium.webdriver.common.keys import Keys from selenium…
Ryan-Rguo
  • 31
  • 2
0
votes
1 answer

How to merge/shift rows/columns up or down basis 2048 game

I need some help creating 2 functions push_up and push_down (think 2048 game), I've managed to create functions that would push the values left and right and then sum them together if they are of equal value. For example, [2,2,0,0] would return as…
Ninja01
  • 13
  • 2
0
votes
0 answers

Hi, im making 2048 using python and a graphics library and need some assistance

i'm using python and need to use an array to make 2048. i am trying to figure out how to make the mechanism to create the moving of numbers in an array to remove the zero's and add two of the same number up. I've looked online but can't find…
0
votes
0 answers

2048 Game - Trigger key events in the console?

I'm trying to trigger key events in the Chrome console but nothing seems to work. I want to trigger any of the arrow keys programmatically (for an experiment). I've tried this (among many other things) window.dispatchEvent(new Event('keypress',…
gatzkerob
  • 877
  • 2
  • 12
  • 32
0
votes
0 answers

Modifying interface with key interactions in javafx

I'm trying to code a 2048 game using JavaFX and I'm facing a problem. @Override public void start(Stage primaryStage){ primaryStage.setResizable(false); Scene scene = new Scene(firstContent()); primaryStage.setScene(scene); …
Bruh
  • 147
  • 6
0
votes
1 answer

Try to make 2048 game in React. Data in the state is mutated when it should not have been

This is my code repo https://github.com/540376482yzb/2048game_react This is my live demo https://objective-fermat-0343a3.netlify.com/ The current state of the game only goes left and right. However it generates new number on left arrow key pressed…
0
votes
0 answers

How to assign images in pygame

So I'm doing the 2048 game in python (pygame) and it's already working but I wanted to replace the numbers with some images I made and I can't do it. I would really appreciate if someone would help me. Thanks in advance. I tried this (where j and k…
youknowwho
  • 33
  • 7
0
votes
1 answer

A function about checking whether the game is over in 2048 game

I took some days to code 2048 game. And now I made most of the functions but one, testing whether the game is over. To code this game, my idea is to merge the same numbers first with the function up(down, left or right)_merge and make all the…
Theodore Tang
  • 831
  • 2
  • 21
  • 42
0
votes
2 answers

C in 2048,problems with moving

I am making 2048 game in C and I need help. Moves are made by pressing W,A,S,D keys e.g. W is for moving up, S for down. However, after every letter you have to press enter to accept it. How can I make it work without pressing enter?