Share your repls and programming experiences

← Back to all posts
Welcome to: 2048 in Python!

But its janky

Hi! You read the title im guessing, its the game 2048. This is a game where you use the arrow keys (Or WASD) to move around pieces in a board, and if you combine two like things (like 1 and 1) it creates a bigger number (In this case 2). Your goal is to keep the board as clear as possible, all the while getting as many points as possible! The higher numbers you combine, the more points you get!

# Important things

1) Once the screen is full, it is game over, even if you can make a move. So make sure to clear the screen!

2) For all you people that are going to scream at me in the comments, yes i did use 1,2,3 etc instead of 2,4,8 etc. The reason is because i didn't feel like dealing with multi digits (16,128 and others). So i just used 1-9. Also there is a 0, and if you actually make it to that and combine them it just gives you another 0

### Also

Dont hold the arrow keys... Not only is it bad, you can get these

Which is just annoying

PattanAhmed (1233)

Hi, @Muffinlavania
Can you just help me with some little thing...
in Pygame!

Thanks!

Muffinlavania (1390)

@PattanAhmed ooooooooooooof i dont really know pygame but yea sure, ill give it a shot
You might have to teach me a few things though so yeaaaaaa.
Also right now im in school, so i cant really do anything unless its going to be less than half an hour, in that case i can do it in ten minutes, or 1pm for me. If its longer, then i can do stuff at about 4pm for me, or in about 3 hours

PattanAhmed (1233)

@Muffinlavania Ok, Good!
I will invite you there!

ReplitRidge (0)

Really nice job muffinlovania.
but in 2048, numbers go up in this fashion: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048. not this: 1, 2, 3, 4, 5, 6...2048. I was wondering if you could fix this?

ReplitRidge (0)

@Muffinlavania oh ok lol, I didn't notice that. it just ticked me off at first

Muffinlavania (1390)

ReplitRidge (0)

@Muffinlavania I think you mean predicted, haha

mamamia5x (69)

Still had moves to go, but I got game over.

Muffinlavania (1390)

@mamamia5x did you read the post?......

mamamia5x (69)

@Muffinlavania Yeah, I realized after I posted it. There has to be a way to fix it tho. Good work tho

mamamia5x (69)

@Muffinlavania Yeah, I realized after I posted it. There has to be a way to fix it tho. Good work tho

I'm kinda confused on why it dies when the whole grid is filled but there are still potential moves. I got 3030 cool game

JasonLiu19 (39)

@pleasestop its in the instructions, it was intentional

JasonLiu19 (39)

@JasonLiu19 how do i get to 8 but only ~4000 score?

jlpoweregg (2)

YES!!! BEST SCORE I'VE GOTTEN

Muffinlavania (1390)

jlpoweregg (2)

@Muffinlavania I found a strategy for this game

jlpoweregg (2)

@Muffinlavania so when you don't know what to do, just to up, down, right, left, up, down, etc. Until you find a way to combine things, it works really well, but if you spam up, down, etc. then you will lose.

jlpoweregg (2)

@Muffinlavania I upvoted this, this is SUPER cool, really good for wasting your time, awesome!

jlpoweregg (2)

@Muffinlavania just wasted some more time to do this

jlpoweregg (2)

@Muffinlavania I went through all your project posts upvoted all the cool ones (aka everything), except UNO because it's locked

Muffinlavania (1390)

@jlpoweregg wait why is it locked??????

jlpoweregg (2)

@Muffinlavania I don't know, it just is locked and you can't comment or upvote

DarkswordsmanJG (14)

I have no idea what is going on

Muffinlavania (1390)

@DarkswordsmanJG so you use the arrow keys, and this moves all te pieces in that direction. If it hits a piece that is the same as it (1 hits a 1 or 2 hits a 2), then it combines to make a bigger number (1 and 1 is 2, 2 and 2 is 3). Your goal is to combine as many pieces as possible, while more appear each turn. If the board fills up you lose!

DarkswordsmanJG (14)

@Muffinlavania oh thanks a lot, I get it now

Axrevyn (265)

It is a little janky. It also sometimes places two tiles in one turn, not sure if that was intentional.

Muffinlavania (1390)

@Axrevyn yea that was, there a 1/3 chance for that to happen.

Also it is jank

Muffinlavania (1390)

@AustinZhang1 bruh thats a high score (How did you do that....)

JBYT27 (426)

Hooray, plus nice game!

Muffinlavania (1390)

@JBYT27 ooooooof you beat me by 100 points

JBYT27 (426)

I just have a quick question, do you have any idea why the symbol pops up? Just curious @Muffinlavania

Muffinlavania (1390)

@JBYT27 what the `??` things? I think it is because it gets joined with an escape code, basically putting an escape code in an escape code? Maybe thats it, and repl says nou

JBYT27 (426)

Ok, thx! I was just curious :D @Muffinlavania

Muffinlavania (1390)

@ch1cken what? I already said in the post that it exits no matter what, but are posting for your high score?

realTronsi (761)

I only read the arrow keys part lol I need to read the post next time

TsunamiOrSumth (264)

i will fanboy for muffin

Muffinlavania (1390)

@tsunami21 but hey, i just wanna dieeee

TsunamiOrSumth (264)

@Muffinlavania (more inaudible estatic fanboy screaming)

realTronsi (761)

@Muffinlavania ~~ p o o p s i m u l a t o r ~~

realTronsi (761)

@Muffinlavania thats the only cursed memory I have of repl

Muffinlavania (1390)

@realTronsi well at least its a blursed one