#The game Mancala is one of the oldest games in recorded #history. You can read more about it here: #https://www.thesprucecrafts.com/how-to-play-mancala-409424 # #For this problem, though, you don't need to know how to #play the game. All you need to know is the board layout #and the conditions for winning. # #A Mancala board is made of two rows of 6 cups, with two #bigger cups at the ends. Each cup holds some number of #stones or chips. For our purposes, though, we'll include #the bigger cups at the end of the corresponding rows. # #So, for us, a Mancala board is represented as a #2-dimensional list of integers. Each item in the lists #represents a cup, and the number represents how many #stones are currently in that cup. For example, this #could be one board: # # [[5, 3, 0, 2, 6, 8, 1], # [1, 6, 8, 0, 4, 1, 4]] # #With this board representation, the game is over when #every cup is empty except the top left and the bottom #right. When the game is over, whoever has more stones #in their cup wins: if the top left has more stones, the #top player wins. If the bottom right has more stones, #the bottom player wins. # #Write a function called check_winner. check_winner takes #as a 2-dimensional list representing a game board. You #may assume list will always have two lists, each with #7 items, corresponding to the board structure shown #above. # #Your function should return one of four strings #depending on the values of the list: # # - If the game is not over (that is, there are stones # in any bucket except for the top-left or bottom- # right), return "Keep playing!" # - If the game is over and the top player wins (that is, # there are more stones in top-left than bottom-right), # return "Player 1 wins!" # - If the game is over and the bottom player wins (that # is, there are more stones in the bottom-right than # the top-left), return "Player 2 wins!" # - If the game is over but the score is tied (that is, # there is an equal number of stones in the top-left # and bottom-right), return "Draw!"
#The game Mancala is one of the oldest games in recorded #history. You can read more about it here: #https://www.thesprucecrafts.com/how-to-play-mancala-409424 # #For this problem, though, you don't need to know how to #play the game. All you need to know is the board layout #and the conditions for winning. # #A Mancala board is made of two rows of 6 cups, with two #bigger cups at the ends. Each cup holds some number of #stones or chips. For our purposes, though, we'll include #the bigger cups at the end of the corresponding rows. # #So, for us, a Mancala board is represented as a #2-dimensional list of integers. Each item in the lists #represents a cup, and the number represents how many #stones are currently in that cup. For example, this #could be one board: # # [[5, 3, 0, 2, 6, 8, 1], # [1, 6, 8, 0, 4, 1, 4]] # #With this board representation, the game is over when #every cup is empty except the top left and the bottom #right. When the game is over, whoever has more stones #in their cup wins: if the top left has more stones, the #top player wins. If the bottom right has more stones, #the bottom player wins. # #Write a function called check_winner. check_winner takes #as a 2-dimensional list representing a game board. You #may assume list will always have two lists, each with #7 items, corresponding to the board structure shown #above. # #Your function should return one of four strings #depending on the values of the list: # # - If the game is not over (that is, there are stones # in any bucket except for the top-left or bottom- # right), return "Keep playing!" # - If the game is over and the top player wins (that is, # there are more stones in top-left than bottom-right), # return "Player 1 wins!" # - If the game is over and the bottom player wins (that # is, there are more stones in the bottom-right than # the top-left), return "Player 2 wins!" # - If the game is over but the score is tied (that is, # there is an equal number of stones in the top-left # and bottom-right), return "Draw!"
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
#The game Mancala is one of the oldest games in recorded
#history. You can read more about it here:
#https://www.thesprucecrafts.com/how-to-play-mancala-409424
#
#For this problem, though, you don't need to know how to
#play the game. All you need to know is the board layout
#and the conditions for winning.
#
#A Mancala board is made of two rows of 6 cups, with two
#bigger cups at the ends. Each cup holds some number of
#stones or chips. For our purposes, though, we'll include
#the bigger cups at the end of the corresponding rows.
#
#So, for us, a Mancala board is represented as a
#2-dimensional list of integers. Each item in the lists
#represents a cup, and the number represents how many
#stones are currently in that cup. For example, this
#could be one board:
#
# [[5, 3, 0, 2, 6, 8, 1],
# [1, 6, 8, 0, 4, 1, 4]]
#
#With this board representation, the game is over when
#every cup is empty except the top left and the bottom
#right. When the game is over, whoever has more stones
#in their cup wins: if the top left has more stones, the
#top player wins. If the bottom right has more stones,
#the bottom player wins.
#
#Write a function called check_winner. check_winner takes
#as a 2-dimensional list representing a game board. You
#may assume list will always have two lists, each with
#7 items, corresponding to the board structure shown
#above.
#
#Your function should return one of four strings
#depending on the values of the list:
#
# - If the game is not over (that is, there are stones
# in any bucket except for the top-left or bottom-
# right), return "Keep playing!"
# - If the game is over and the top player wins (that is,
# there are more stones in top-left than bottom-right),
# return "Player 1 wins!"
# - If the game is over and the bottom player wins (that
# is, there are more stones in the bottom-right than
# the top-left), return "Player 2 wins!"
# - If the game is over but the score is tied (that is,
# there is an equal number of stones in the top-left
# and bottom-right), return "Draw!"
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education