2048 game codes(console)

2048 game codes(console)

Postby bhishan » Tue Jul 01, 2014 1:40 pm

This post explains on making a 2048 game(console).
http://www.thetaranights.com/make-a-2048-game-in-python/
bhishan
 
Posts: 20
Joined: Sun May 18, 2014 7:57 am
Location: Kathmandu, Nepal

Re: 2048 game codes(console)

Postby metulburr » Tue Jul 01, 2014 3:56 pm

New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1560
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: 2048 game codes(console)

Postby bhishan » Tue Jul 01, 2014 4:03 pm

Thanks for the link. I will go through it sometimes. :)
bhishan
 
Posts: 20
Joined: Sun May 18, 2014 7:57 am
Location: Kathmandu, Nepal

Re: 2048 game codes(console)

Postby Mekire » Tue Jul 01, 2014 11:45 pm

Woah. This seems to be a common mistake, but there is absolutely no benefit to a function if you just throw all your logic inside it. A good rule of thumb is to make your functions have a single purpose and be small enough that they can be completely visible without scrolling. You should be able to find a more logical way to slide your numbers in each direction than manualling writing out each option. There is currently a lot of repitition in that function.

-Mek
User avatar
Mekire
 
Posts: 1123
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: 2048 game codes(console)

Postby bhishan » Wed Jul 02, 2014 12:26 am

Thanks for the suggestion. I'll split the function. About repititions, will you point some so that I can improve and make it shorter.
bhishan
 
Posts: 20
Joined: Sun May 18, 2014 7:57 am
Location: Kathmandu, Nepal

Re: 2048 game codes(console)

Postby Mekire » Wed Jul 02, 2014 12:47 am

Mettulbur already pointed you to my repo. Start there. I did just test your program though, and a few issues. The indentation, at least on your site, is messed up a bit, so the program won't run without some editing. After I fixed the indentation however, I tested it, and your rows don't seem to slide correctly.

-Mek
User avatar
Mekire
 
Posts: 1123
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: 2048 game codes(console)

Postby bhishan » Wed Jul 02, 2014 1:48 am

I will replace the code with the copy I have so I think thats done for the indentation. The sliding issue may have come due to intro to input other than (w,s,a,d), I will check for the program to do nothing if keys other than those mentioned above are used. Thanks for your time.
bhishan
 
Posts: 20
Joined: Sun May 18, 2014 7:57 am
Location: Kathmandu, Nepal


Return to Game Development

Who is online

Users browsing this forum: No registered users and 2 guests