Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C2048

C2048 is a Python library that implements the 2048 game written in Rust.

The game loop should look like this

from c2048 import C2048, Move
game = C2048()

while True:
    print(f"Score: {game.score()}")
    print(game)
    # pick a random move
    move = Move.random()
    game.move(move)
    
    if game.has_moved:
        # Probability of getting a 2
        game.spawn_tile(0.9)
        # resets the game.has_moved
        game.reset()
    
    if game.is_win():
        print("You win, max tile: ", game.highest())
        break
    elif game.is_lose():
        print("You lose, max tile: ", game.highest())
        break

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages