Our New 2048 Game is mainly implemented by Python List. It is based on Python 利用列表就可以实现新2048游戏(代码可以直接运行)
-
'2048' is a classic game, but the constant change of the graphics in the matrix makes it difficult.
-
The New 2048 takes a card-like approach, with each column descending as the number of CARDS increases, which can be done with a list.
-
Suppose there are 5 columns in total where CARDS can be played. As the new CARDS arrive, they need to be placed below the lowest card in any column. When the new CARDS are equal to the original lowest card:
- Two CARDS disappear
- Add the two values to create a new card value
- If it is consistent with the original penultimate sheet, continue step 1.2.
- Every time a new card appears, it's any one of the 2,4,8,16,32,64,bombs, every time it's eliminated, you get a score.
- You get points for each elimination; For each 2048 created, gain extra points and clear all CARDS in the column; Every time you get a bomb, all the CARDS in that column disappear.
- When all the columns reach the maximum length, the player judges negative. When all card values have been issued and the player still has room to properly enter the card, the player wins.
- Python
- Numpy
You can run it directly:
python new2048.py
You can change the total number of cards and the max length of each column.
demo = New2048(card_num=100)
demo = New2048(card_num=100,max_len=6)
Enjoy it now!