Python Objective Develop an interface system using techniques and design patterns seen in class through a problem with...

60.1K

Verified Solution

Question

Programming

Python

Objective

Develop an interface system using techniques and design patternsseen in class through a problem with realistic constraints.

Specs

  Write an interactive program for a boardgame called Parcheesi.

  • Use just the basic rules. It can be consulted on Wikipedia
  • Make two implementations of user interface, one text-based andthe other graphically. Use the case study \"Dice Poker\" in Chapter12 as a reference
  • It should not include any other graphics system otherthan graphics.py
  • Use inheritance that allows to extend or overwrite appearanceproperties or behaviors for both the dice, the player's pieces andthe board. See example in the \"ColorDieView\" class from chapter12.
  • put the program output

I need to make it work!!!

from graphics import Graphwin, Point, Linefrom math import pi, cos, sindef Koch(Turtle, lenghth, degree):  if degree == 0:    Turtle.draw(length)  else:    length1 = length/3    degree1 = degree - 1    Koch(Turtle, length1, degree1)    Turtle.turn(-60)    Koch(Turtle, length1, degree1)    Turtle.turn(120)    Koch(Turtle, length1, degree1)    Turtle.turn(-60)    Koch(Turtle, length1, degree1)class Turtle:  def __init__(self, point, direction, windows):    self.location = point    self.direction = direction * pi / 3    self.win = window  def moveTo(self, newpoint):    self.location = newpoint  def _moveTo(self, length):    dx = length * cos(self.direction)    dy = length * sin(self.direction)    x = self.location.getX()    y = self.location,getY()    x += dx    y += dy    newpoint = Point(x, y)    return self.moveTo(newpoint)  def draw(self, length):    oldLocation + self.location    self._moveTo(length)    path = Line(oldLocation, self.location)    path.draw(self.win)  def turn(self, direction):    if direction == -60:      self.direction -= (pi / 3)    elif direction == 120:      self.direction += (2 * pi / 3)def main():  length = 500  degree = 5  win = GraphWin(\"Koch SnowFlake\", 800, 800)  dir = 0  turtle = Turtle(Point(150, 250), dir, win)  for i in range(3):    Koch(turtle, length, degree)    turtle.turn(120)  win. getMouse()main()

Answer & Explanation Solved by verified expert
4.5 Ratings (751 Votes)
usrbinenv python import logging import sys import os from srccore import game from srccore import table from srccore import player from srccore import dice import pygame from srcguipygamestuff import loadimage from pygamelocals import from pygamesprite import Sprite class ParcheeseUIgameGame Main class def initself Initialize game pygameinit pygamedisplaysetcaptionParcheese selfscreen pygamedisplaysetmode640 640 selfclock pygametimeClock selfgoing True pygamemousesetvisible1 selfbuttons selfimagepath osgetcwd selfimagepath ospathjoinselfimagepath data Create The Background selfbackground    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students