Inspiration
Five-In-A-Row is a common board game in China and very popular around the world. We all love to play this game, but it is too inconvenient to bring the actual game board and chess pieces with us. Therefore, we want to build a CS program that allows us to play the game on computer, which is much more convenient.
What it does
Two players, represented by black and white chess pieces, move alternatively (Black side goes first ) on a board we draw. Whoever first gets 5 consecutive, same-colored chess pieces in a line (row, column, diagonal direction) wins.
How we built it
We use Python to create the project with following steps:
- create_empty_board () creates an empty board, and returns the board;
- draw_board (board) prints the board on the screen;
- valid_move (board, col_no, row_no) judges whether the move is valid;
- player_move (board, current_player) determines which player is going to move and asks for the grid that he wants to move.
- next_player (current_player)enables players to move alternatively;
- full (board)checks if the board is full;
- win (board)sets the winning rule and determines if a winner exists;
- play_five () calls all funtions to play the game.
Challenges
We first encountered difficulties in drawing a square board. We adjusted the space between characters for many times and solved it. Then we had the biggest challenge - setting the winning rules for the game. We need to consider rows, columns and two diagonal directions, and to check if there are 5 consecutive, same-colored chess pieces in one of these places. After multiple attempts, we finally decided to use for loops to accomplish the goal.
Accomplishments that we're proud of
We are proud of ourselves because we never give up reaching the goal! We are proud of ourselves finally solving and conquering all challenges! We are proud of ourselves successfully designing the complete program structure! And of course, we are proud that the program can successfully run!
What we learned
How to apply and combine the knowledge of Python that we have learned into a complicated program; The ability to innovate on the things we have already learned; The spirit of teamwork: cooperation is crucial to acheive goals; The improtance of being persevered and never giving up!
What's next for Five-In-A-Row Board Game
We hope that after further exploration in programming, we can add images to our game and make a web page for it.
Log in or sign up for Devpost to join the conversation.