Making 2048 From Scratch

A little bit of background, I am currently taking a course through Code Academy learning how to code in python and this is my first free form project. Armed with my limited coding knowledge and the task to create something I hatched a plan. Code Academy suggested remaking a game like Blackjack or Tic-Tac-Toe but I wanted to do something different. So I decided to make a game that I have played but never beaten, and what I landed on is 2048. The game is simple enough but even then I ran into a few challenges.

The hardest part to code was pushing the all the numbers in every direction. To do this I programed pushing numbers to the left by appending all non zero numbers than adding zero to maintain 4 numbers in the list. To move to the right I reversed the list before I compacted then after to make it look normal. Movement up and down was a bit more complicated but I achieved this by creating a temporary list with the nth value in every list, pushing it left or right, then decoding it. Anyways here it is.

SamZombie / Terminal-2048-python-project

Terminal-2048-python-project

Code Academy Portfolio Project 1 This is a recreation of 2048 by Gabriele Cirulli for a coding challenge


View on GitHub

I had a lot of fun coding this and not only did I test my coding abilities but I learned about uploading to GitHub and blogging on this website!

原文链接:Making 2048 From Scratch

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容