You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created the board game, "Connect Four", using the programming language Python. The entire project was created all on one file. This was a project I chose to develop during my spare time as this was not a common project constructed by other developers. The program follows all rules of the game, where players can win by either having 4 in a row horizontally, vertically, or diagonally. The dimensions for this particular game is a 6x7 board. In other words, the board is designed as 6 rows and 7 columns. Therefore, I initialized a nested list called board that contains the 7 columns as elements, and the 6 rows within each element.
Determining the logic for a player to have 4 in a row diagonally proved to be the most challenging in my opinion. The best solution was to view this as positive and negative slopes since these diagonals were
10
+
either from the bottom left to top right, or the top left to bottom right. Afterwards, I created two separate boards to determine all possible coordinates that can be starting points to create 4 in a row as shown
What I noticed is the positive slope starting points are from rows 4-6 and columns 1-4, while the negatiive slope starting points are from rows 1-3 and columns 1-4. Therefore, each type of slope has its own
37
+
function and nested for loop that iterates through only the possible starting points.
Copy file name to clipboardExpand all lines: README.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,9 @@ More information on contributing and the general code of conduct for discussion
49
49
| Blackjack |[Blackjack](https://github.com/DhanushNehru/Python-Scripts/tree/master/Blackjack)| A game of Blackjack - let's get a 21. |
50
50
| Chessboard |[Chessboard](https://github.com/DhanushNehru/Python-Scripts/tree/master/Chess%20Board)| Creates a chessboard using matplotlib. |
51
51
| Compound Interest Calculator |[Compound Interest Calculator](https://github.com/DhanushNehru/Python-Scripts/tree/master/Calculate%20Compound%20Interest)| A Python script to calculate compound interest. |
52
-
| Countdown Timer |[Countdown Timer](https://github.com/DhanushNehru/Python-Scripts/tree/master/Countdown%20Timer)| Displays a message when the Input time elapses. |
53
52
| Convert Temperature |[Convert Temperature](https://github.com/DhanushNehru/Python-Scripts/tree/master/Convert%20Temperature)| A python script to convert temperature between Fahreheit, Celsius and Kelvin |
53
+
| Connect Four |[Connect Four](https://github.com/DhanushNehru/Python-Scripts/tree/master/Connect%20Four)| A Python script for the board game Connect Four, which can be played by 1-2 players |
54
+
| Countdown Timer |[Countdown Timer](https://github.com/DhanushNehru/Python-Scripts/tree/master/Countdown%20Timer)| Displays a message when the Input time elapses. |
54
55
| Crop Images |[Crop Images](https://github.com/DhanushNehru/Python-Scripts/tree/master/Crop%20Images)| A Python script to crop a given image. |
55
56
| CSV to Excel |[CSV to Excel](https://github.com/DhanushNehru/Python-Scripts/tree/master/CSV%20to%20Excel)| A Python script to convert a CSV to an Excel file. |
56
57
| Currency Script |[Currency Script](https://github.com/DhanushNehru/Python-Scripts/tree/master/Currency%20Script)| A Python script to convert the currency of one country to that of another. |
@@ -110,7 +111,7 @@ More information on contributing and the general code of conduct for discussion
110
111
| PDF to Audio |[PDF to Audio](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20Audio)| Converts PDF to audio. |
111
112
| PDF to Text |[PDF to text](https://github.com/DhanushNehru/Python-Scripts/tree/master/PDF%20to%20text)| Converts PDF to text. |
112
113
| PDF merger and splitter |[PDF Merger and Splitter](https://github.com/AbhijitMotekar99/Python-Scripts/blob/master/PDF%20Merger%20and%20Splitter/PDF%20Merger%20and%20Splitter.py)| Create a tool that can merge multiple PDF files into one or split a single PDF into separate pages. |
113
-
| Pizza Order |[Pizza Order](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pizza%20Order)| An algorithm designed to handle pizza orders from customers with accurate receipts and calculations. |
114
+
| Pizza Order |[Pizza Order](https://github.com/DhanushNehru/Python-Scripts/tree/master/Pizza%20Order)| An algorithm designed to handle pizza orders from customers with accurate receipts and calculations. |
114
115
| Planet Simulation |[Planet Simulation](https://github.com/DhanushNehru/Python-Scripts/tree/master/Planet%20Simulation)| A simulation of several planets rotating around the sun. |
115
116
| Playlist Exchange |[Playlist Exchange](https://github.com/DhanushNehru/Python-Scripts/tree/master/Playlist%20Exchange)| A Python script to exchange songs and playlists between Spotify and Python. |
116
117
| Pigeonhole Sort |[Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole)| The pigeonhole sort algorithm to sort your arrays efficiently! |
0 commit comments