PvP Chain reaction game using Python


At last, I've taken time and ventured a little deeper into the Python language! I used the Tkinter package to develop a rip-off of an android game called chain-reaction. It's a simple multiplayer board game in which the first person to occupy all the blocks on the board or of the opponent(s) wins. Try downloading and playing the game with your friends, it's FUN!

Here's a video of the game I've developed(I've set the number of players to 4 and board dimensions are 6*8):



Coming to the coding, I actually enjoyed the process of writing code much more in Python compared to any other previous languages that I've used. Maybe it is due to the fact that it's the first high-level language that I got my hands on. I'd never worked with Tkinter package before. It was quite easy to understand and I was able to build the game in roughly in four hours. I think that just a little effort is enough for anyone to understand how to use the tkinter package.

Talking about the game it's quite simple to understand it if you play it. Simply speaking, if a block reaches its maximum capacity then it diffuses the contents to its neighbors(North, East, West, and South). A little bit knowledge about recursion can help you code the game with ease.

Here's the code for the game:

I could have used the random package to implement a bot(an opponent) that randomly selects tiles and make the game a little more interesting. But my aim was to just fiddle with the tkinter and I'm happy with the end result.

If you have a Python IDE go ahead and try to run the code and have fun :) (You can modify the code to adjust number of players and the dimensions of the board)

Comments

  1. What is the name of the package you imported? "tkinter" has like 8 different packages and I don't know which package to install in my repositories.
    Thanks!!!

    ReplyDelete
    Replies
    1. I don't remember installing anything extra. The tkinter library was there downloaded by default. I'm afraid I can't help you with your question. Just do trial and error :-)

      Delete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Thanks for this. This is the simplest explanation I can understand given the tons of Explanation here. teen misty blazer

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment

Popular posts from this blog

2048 using C++

Guide to Solving Maximal Subarray Problem using Kadane's Algorithm