Question: Using Python, create the game Speed, using the rules and example below for output: These are my modules: _init_.py: The root package contains all

Using Python, create the game Speed, using the rules and example below for output:

Using Python, create the game Speed, using the rules and example below

These are my modules:

_init_.py:

"""

The root package contains all the source code for the game.

"""

_main_.py

"""

The root package contains all the source code for the game.

"""

game/_init_.py:

"""

The game package contains specific classes for playing Speed.

"""

game/constants.py:

import os

MAX_X = 60

MAX_Y = 20

FRAME_LENGTH = 0.08

STARTING_WORDS = 5

PATH = os.path.dirname(os.path.abspath(__file__))

LIBRARY = open(PATH + "/words.txt").read().splitlines()

game/inputs_service.py:

import sys

from asciimatics.event import KeyboardEvent

class InputService:

"""Detects player input. The responsibility of the class of objects is to detect player keypresses and translate them into a point representing a direction (or velocity).

Stereotype:

Service Provider

Attributes:

_screen (Screen): An Asciimatics screen.

"""

def __init__(self, screen):

"""The class constructor.

Args:

self (InputService): An instance of InputService.

"""

self._screen = screen

def get_letter(self):

"""Gets the letter that was typed. If the enter key was pressed returns an asterisk.

Args:

self (InputService): An instance of InputService.

Returns:

string: The letter that was typed.

"""

result = ""

event = self._screen.get_key()

if not event is None:

if event == 27:

sys.exit()

elif event == 10:

result = "*"

elif event >= 97 and event

result = chr(event)

return result

Notes:

-words.txt contains a list of words that are valid.

-The program needs at least 8 classes. It should also demonstrate Inheritance somewhere.

Thanks in advance!

Overview Speed is a game in which the player seeks to type as many words they see to earn points. Rules Speed is played according to the following rules. 1. The game begins with five words moving on the screen. 2. The player tries to type the words they see on the screen. 3. The player earns points for the words they type correctly. 4. If the player presses the enter key their buffer is cleared. 5. Play continues until the player presses the ESC key. Interface -Score: 6-- skype technology cnetcom aus sake -Buffer: placessky-- Overview Speed is a game in which the player seeks to type as many words they see to earn points. Rules Speed is played according to the following rules. 1. The game begins with five words moving on the screen. 2. The player tries to type the words they see on the screen. 3. The player earns points for the words they type correctly. 4. If the player presses the enter key their buffer is cleared. 5. Play continues until the player presses the ESC key. Interface -Score: 6-- skype technology cnetcom aus sake -Buffer: placessky

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!