import pythongame from pythongame.locals import *pythongame.int() int no.of play
ID: 3742772 • Letter: I
Question
import pythongame
from pythongame.locals
import *pythongame.int()
int no.of players();
screen=pythongame.visible_players((number, //to show the name of players
player name = pythongame.name("master mind players")
visual.display(0) //clear the screen before naming
visual.name(player, (master mind))
pythongame.display.visual()
//generates hidden code
for app in pythongame.application.get():
if event.type==pythongame.QUIT://check whether displays
pythongame.quit() //if it hides
exit(0)
random = pythongame.visual.display("RGBYOP")
distinct = pythongame("stored sting YBRP")
//generation of hidden code
for code hidden(stored as string RGBYOP):
visual.display()
display(string,(names entered)//guess the colour position of the hidden cide
red as a string = [BORY]
playerNEXT=[BEF(),AFT()] //shows before and after score
visual.display(player, guess check) //player guess his checks
if hidden.code == pythongame.KEYDOWN(broken):
if event.key==K_w:
keys[0]=True(display)
//output shown both in screen and file
position = pythongame.repeatget_pos()
//decide to play other game repeatedly
repeat = play.game(position[1]-(playerpos[1])//earns white pin
wrong position= pythongame.transform.rotate(player,1pt,) //wrong position game
playerpos1 = (playerpos[0]-playerrot.get_displays(wwb).(right colour,right position)
visual.display(playerrot, player(bp(0)) //best performance for blackpins is 0
for end game(add):
index=0
blackpin(add)=game.won(breaks[0]//player won the game
blackpin=game.add(break[0]) //has no additional pin
game[1]+=points()
//decides to stop the game
if player[0] game=[0]blackpin:
game.player()
//to show both screen and file
for player stops:
game = pythongame.player
stop()
This coding isn't working correctly.... Am in need for some real help. Could anyone provide me another solution to part (a) as well as part (b)? Or able to fix this code?
Develop a simple game application without using the data type dictionary. Allow any number of players to play MasterMind together For the game design and implementation, you must adhere to the following constraints: Game Play Start the application by asking the user how many players will be playing MasterMind and the names of the players. Before each new game commences, the application randomly generates a hidden code. To generate the hidden code, the application makes 4 random choices to pick 4 different colors from 6 colors (stored as a string "RGBYOP"). The letters represent the 6 distinct colors: Red, Green, Blue, Yellow Orange and Purple. The random choices are stored as a single string e.g "YBRP" Players take turns to make a guess, the order follows the order the names are entered. When it is a player's turn, he guesses the colors and positions of the hidden code. The guess is read as a string and consists of 4 letters e.g... "BORY". The result of his guess is displayed before the next player takes his turn. Show both the before and after score of a player after his guess is checked. The next player then takes his turn, each guess is checked and the score updated, until the game ends when the hidden code is broken, that is, a player gets 4 black pins. At the end of each game, print out the details of the players and list the winner(s). The output should be shown on both screen and file. The players can repeatedly decide whether to play another game of MasterMind. If the players decide to stop play, print out the players with the most number of games won. The output should be shown on both screen and file. ion of scores and winners: Each right color in the wrong position earns the player a white pin which is worth 1 point, and each right color in the right position earns the player a black pin or 5 points. In this example, the guess earns 2 white pins and 1 black pin, and the program displays wWB, subjected to this consideration: Only additional pins a player gets will earn him points. Only additional pins a player gets will earn him points. For example, assume that throughout game play thus far, the best performance for white pins is 2 and the best performance for black pins is 0. If now, aExplanation / Answer
a)
import pythongame
from pythongame.locals
import *pythongame.int()
int no.of players();
screen=pythongame.visible_players((number,))
player name = pythongame.name("master mind players")
visual.display(0)
visual.name(player, (master mind))
pythongame.display.visual()
for app in pythongame.application.get():
if event.type==pythongame.QUIT://check whether displays
pythongame.quit()
exit(0)
b)
random = pythongame.visual.display("RGBYOP")
distinct = pythongame("stored sting YBRP")
for code hidden(stored as string RGBYOP):
visual.display()
display(string,(names entered)
red as a string = [BORY]
playerNEXT=[BEF(),AFT()]
visual.display(player, guess check)
if hidden.code == pythongame.KEYDOWN(broken):
if event.key==K_w:
keys[0]=True(display)
position = pythongame.repeatget_pos()
repeat = play.game(position[1]-(playerpos[1])
wrong position= pythongame.transform.rotate(player,1pt,)
playerpos1 = (playerpos[0]-playerrot.get_displays(wwb).(right colour,right position)
visual.display(playerrot, player(bp(0))
for end game(add):
index=0
blackpin(add)=game.won(breaks[0]
blackpin=game.add(break[0])
game[1]+=points()
if player[0] game=[0]blackpin:
game.player()
for player stops:
game = pythongame.player
stop()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.