Question

In: Computer Science

def is_one_player_game(game_type)-> bool: """The parameter represents the type of game being played: human, human-human, or human-computer....

def is_one_player_game(game_type)-> bool:
"""The parameter represents the type of game being played: human, human-human,
or human-computer. The function should return True if and only
if this is a one-player game.
  
"""

Solutions

Expert Solution

Python code(the given code is in python):

def is_one_player_game(game_type)->bool:
    #checking if only one human is required
    if(game_type=="human"):
        #returning True
        return True
    #checking if two human is required
    elif(game_type=="human-human"):
        #returning False
        return False
    #checking if only one human and computer is required
    elif(game_type=="human-computer"):
        #returning True
        return True

#only this much is required, the below lines are for testing and is for your understanding
#calling is_one_player_game function and printing result for human-computer
print(is_one_player_game("human-computer"))
#calling is_one_player_game function and printing result for human
print(is_one_player_game("human"))
#calling is_one_player_game function and printing result for human-human
print(is_one_player_game("human-human"))

Screenshot:


Output:


Related Solutions

The following payoff matrix represents a single-period, simultaneous move game to be played by two firms....
The following payoff matrix represents a single-period, simultaneous move game to be played by two firms. Show all the best responses for each player by placing checkmarks next to each payoff that reflects a best response choice. Does Firm A have a dominant strategy and if so, what is it? Does Firm B have a dominant strategy and if so, what is it? Does a Nash Equilibrium (or multiple NE) exist for this game and if so, what is it...
Design and implement an Android application that plays the Rock-Paper-Scissors game against the computer. When played...
Design and implement an Android application that plays the Rock-Paper-Scissors game against the computer. When played between two people, each person picks one of three options (usually shown by a hand gesture) at the same time, and a winner is determined. In the game, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. The program should randomly choose one of the three options (without revealing it) and then seek for the user’s selection (using your choice of an object...
Code the game of Rock, Paper, Scissors between a human player and the computer. You can...
Code the game of Rock, Paper, Scissors between a human player and the computer. You can check out the game on Wikipedia if you are not familiar with it. Create a 4 option menu with the human player choices, plus the option of exiting the game. Randomly determine the computer’s choice (although a great deal of AI research has gone in to determining the best computer move). • Loop the game until the human player exits. • Count the number...
Assume that the human player makes the first move against the computer in a game of Tic-Tac-Toe,
Assume that the human player makes the first move against the computer in a game of Tic-Tac-Toe, which has a 3 x 3 grid. Write a MATLAB function that lets the computer respond to that move. The function’s input argument should be the cell location of the human player’s move. The function’s output should be the cell location of the computer’s rst move. Label the cells as 1, 2, 3 across the top row; 4, 5, 6 across the middle...
Much like a computer, the human brain may retain traces of information even after being deleted....
Much like a computer, the human brain may retain traces of information even after being deleted. These memory traces are physico-chemical manifestations of representations (memories) in the brain. While their existence remains disputed, how might the existence of memory traces bear on developing new procedural and declarative memories? Why is this significant for understanding human cognition?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT