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. Canvas can include images as well. It is not an issue that you cannot render images in canvas. IT is very much possible and also attaching callbacks and events is not an big issue .Food force is very much possible in JavaScript as well but will need some issues to be sorted out.
    Crumbs iOS App



    ReplyDelete
  3. awesome blog it's very nice and useful i got many more information it's really nice i like your blog styleweb design company in velachery

    ReplyDelete
  4. Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
    web designing classes in chennai | web designing training institute in chennai
    web designing and development course in chennai | web designing courses in Chennai
    best institute for web designing in chennai | web designing course with placement in chennai
    Web Designing Class
    web designing course
    best institute for web designing
    website design course | Web designing course in Chennai

    ReplyDelete

Post a Comment

Popular posts from this blog

Beginner's guide to Solving the N-Queens problem using backtracking method

Guide to Solving Maximal Subarray Problem using Kadane's Algorithm

Developing Minesweeper using Java