Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help putting this into python def better board(size, zeros on diag 1, zeros on diag 2): This will be a slightly nicer game board

need help putting this into python

image text in transcribed

def better board(size, zeros on diag 1, zeros on diag 2): This will be a slightly nicer game board than simple_board can produce. This board has straight edges around the outside (except the corners) and allows you to fill one (or both) diagonals with zeros. The first parameter is size (like simple_board(), the second parameter indicates if the diagonal from the top left to the bottom right should be filled with Os, the third parameters is for the top right to bottom left diagonal Size 2 Board No Diag. Size 3 Board, 1st Diag.Size 4 Board, 2nd Diag. Size 5 Board, Both Diag I I l0l I l0l I l0l I 1 101 l ll llI I I lel II ol lo lel I lel II Return value a string of the game board Assumptions o size will be a positive integer o zeros_on_diag_1 and zeros_ on_diag_2 will be booleans Notes: o o Hint 1: This will be much easier if you use nested loops. Hint 2: Work on the board without diagonals first. Once that is working, try doing the first diagonal (it's easier than the second one). Once that is working, try the second diagonal. Make sure to return a string, not print a string o def better board(size, zeros on diag 1, zeros on diag 2): This will be a slightly nicer game board than simple_board can produce. This board has straight edges around the outside (except the corners) and allows you to fill one (or both) diagonals with zeros. The first parameter is size (like simple_board(), the second parameter indicates if the diagonal from the top left to the bottom right should be filled with Os, the third parameters is for the top right to bottom left diagonal Size 2 Board No Diag. Size 3 Board, 1st Diag.Size 4 Board, 2nd Diag. Size 5 Board, Both Diag I I l0l I l0l I l0l I 1 101 l ll llI I I lel II ol lo lel I lel II Return value a string of the game board Assumptions o size will be a positive integer o zeros_on_diag_1 and zeros_ on_diag_2 will be booleans Notes: o o Hint 1: This will be much easier if you use nested loops. Hint 2: Work on the board without diagonals first. Once that is working, try doing the first diagonal (it's easier than the second one). Once that is working, try the second diagonal. Make sure to return a string, not print a string o

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Upgrade Migration And Transformation Tips And Techniques

Authors: Edward Whalen ,Jim Czuprynski

1st Edition

0071846050, 978-0071846059

More Books

Students also viewed these Databases questions

Question

1. Define mass and mediated communication

Answered: 1 week ago