Question: please read the instructions very carefully. this needs to be done in PYTHON. the sample output is in the bottom pictures as well! thank you!

please read the instructions very carefully. this needs to be done in PYTHON. the sample output is in the bottom pictures as well! thank you!
please read the instructions very carefully. this needs to be done in
PYTHON. the sample output is in the bottom pictures as well! thank
you! This lab is designed to introduce students to 2-D lists by
recreating one of everyone's favorite childhood games: Connect-Four. You will loop through

This lab is designed to introduce students to 2-D lists by recreating one of everyone's favorite childhood games: Connect-Four. You will loop through lists and manipulate them. Your end product should be robust enough to not have a single out-of-bounds exception. Specification You will first start by asking the user for what they wish the height and length of the board to be: What would you Tike the height of the board to be? 4 What would you like the length of the board to be? 5 Then you will print the empty board: And tell the players what their tokens are: Player 1: x Player 2: 0 The players will take turns placing their tokens by choosing columns... Player 1: which column would you like to choose? 0 Player 2: Which colunn would you like to choose? 3 until one of them wins! Player 1: Which column would you Tike to choose? 0 x x0= 000 Player 1 won the gamel PTayer 2: Which column would you like to choose? 2 o 0 x00x x000x x0 Draw. Nobody wins. Elements in the 20-list should be accessible via row-major indexing (board[row[[column]). In addition, you should follow the structure by storing the chips (e.g., inserting ' x ' in column 0 and then inserting ' 0 ' in column 2) in a 2D list starting from row 0 : When printing the board, you should print the board upside down (by printing from the last row which is row 3 in our example). So that your output on the console after calling print board(board) would be: Assumptions Students can assume that: - the user will choose for the board dimensions to be 44 or greater. - the user will input a valid column number (from 0 to length-1). - the column that the user chooses to place their token into has space (it is not filled already by other tokens). - players can only win vertically or horizontally, but not diagonally. Required Methods defprint_board(board) This will take in the 2D character list for the board and print the board. def initialize_board(num_rows, num_cols) This will take in the num_row and num_cols from user input and this will set each spot in the list to A 2 D character list with each spot set to be "." will be retumed. 2 def insert_chip(board, col, chip_type) This will take in the 2D character list for the board. This function places the token ( x ' or 0 ' denoted as 'chip_type') in the column that the user has chosen. Will find the next available spot in that column if: there are already tokens there. The row that the token is placed in is returned. def check if winner(board, col, row, chip_type) This will take in the 2D character list for the board. After a token is added, checks whether the token in this location, of the specified chip type, creates four in a row. Will return True if someone won, and False otherwise. Hint: Implement the methods in this order. () Submissions NOTE: Your output must match the example output 'exactly'. If it does not, you will not recerve full credit for your submission! File: connect_four.py Method: Submit on ZyLabs Sample Output What would you 12k the height of the board to be? 4 What would you like the lengch of the board to be? 5 Player 1: x Player 2: 0 Player 1: Which column would you 11ke to ohoose? 0 Player 2: Which column would you like to chooge? 3 x0 3 Player 1: Which column would you like to choose? 0 11 x1 x0 Player 2: Which column would you like to choose? 1 1 1 x x00 Player 1: Which column would you like co choose? 0 x x00= Player 2: Which column would you 11ke to chooge? 4 x x x00 Player 1: Which column would you 21ke to choose? 2. 1 x x1 xx0 Player 2: Which column would you like to choose? 2 x x0= x0 Player 1: Which column would you like to choose? 0 xx x2 x0 xx00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!