Giter VIP home page Giter VIP logo

nim's Introduction

107project-tripeny-sunde-katz

Build Instructions

This game requires Python, PyGame, and NumPy.

To play the game, download the project files and run using the terminal command python Game.py inside the game folder.

About

We will be examining the classic game Nim and how it can be implemented in Python. This will include a user interface to play these games.

The game nim can be implemented using a list. The game has n different "piles", each with a positive number of coins. Two players alternate taking turns, each player removing any number of coins from exactly one pile. For example, one may move the board [3, 5, 7] to the board [3, 2, 7] by removing 3 coins from pile 2. However, one may not move the board [3, 5, 7] to [1, 3, 7] because multiple columns are changed. A player wins when they move to a zero board, [0, 0, 0] such that the other player can't remove any coins.

After implementing nim, we could explore other game formats using different data structures. Fore example, using a set, the board {3, 5, 7} could be changed to {3, 5, 5}, but since sets have no unique elements this is {3, 5}.

The game could also be implemented using queue, stack, or priority queue. Each different implementation would have have different strategies. Examing the game structure and the winning strategy can help students to understand the differences between various data structures.

Sources: https://arxiv.org/pdf/1605.06327.pdf This source describes the game and certain strategies, but has no code to play the games.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.