Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The programming language is Python. These are my modules: _init_.py: The root package contains all the source code for the game. _main_.py

image text in transcribed

The programming language is Python. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions