Python代写:CSSE1001Dots&Co


代写消除类游戏Dots & Co.

Introduction

This assignment provides you the opportunity to apply concepts taught
throughout the course to extend the functionality of a basic dot game, which
has been modelled on Dots & Co.
The assignment will focus on the concept of Graphical User Interfaces (GUIs).
You will be required to extend the base game with basic, intermediate, and
advanced features. Postgraduate students will have an additional task.
Students are encouraged to review Dots & Co, as well as other similar games,
to better understand how the game is played and for inspiration on advanced
features.
Because this assignment deals with multiple files, students are encouraged to
investigate a more capable IDE. The author recommends PyCharm, which is free
for students.

Game Play

Dots & Co is a simple game where the player tries to create connections
between dots on a grid in order to reach objectives.
The player can click on a dot and drag to an adjacent dot (up/down/left/right
only) to select a dot to form a connection, continuing on to another adjacent
dot to select it to form another connection, et cetera. When the player stops
dragging and releases, all dots in that have been selected will be activated
and removed. The most basic dots do not have any effect when activated.
Replacements drop down from the cells above, and new dots are generated off-
screen.
If the player drags back to their second-most-recently selected dot, the most-
recently selected dot is deselected.
When the user nishes their selection, if the selection contains a loop, all
dots of the selected kind will also be included in the activation.
Shortly after this assignment’s release, a link to a video overview will be
added here.

Assignment Tasks

Task Breakdown

CSSE1001 students will be marked out of 25 and CSSE7030 students will be
marked out of 30 based on the following breakdown. Tasks may be attempted in
any order, but it is recommended to follow this breakdown, top-down.

Mark Breakdown

For each task, marks will scaled according to the following breakdown.

Getting Started

Before beginning work on the assignment you must download a3_files.zip
provided from the course website.
Inside a3_files.zip , there should be a file called a3.py . This is the file
where you will write your assignment. The other files are support files. These
must not be edited. Their purpose is explained below.
Some tasks require you to submit brief descriptions of features implemented.
These descriptions must be submitted in a single PDF document called
description.pdf other formats such as Microsoft Word or misnamed files may not
be accepted.

Support Code

The file a3.py is the main assignment file. This file includes a few hundred
lines of code that leverages the support code to help you get started. You
must modify & add to this file in order to complete the assignment tasks.
You are also permitted to create other files to simplify the separation of
tasks (i.e. task1.py , task2.py , etc.). If you do this, a3.py must be the
entry point to your application. One way to achieve this is to move DotsApp to
a separate file, such as base.py . Regardless of how you structure your files,
the code must all be able to be demonstrated by running a3.py .
You have been supplied with a copious amount of support code to help you
complete this assignment. To begin the assignment, you do not need to
understand much of this code. As you progress through the tasks, the degree to
which you should understand this code will increase.
Note: Only required understanding has been listed. Since task 3 is open-ended,
it would be helpful to have a good understanding of most of the support code
to know what can be leveraged to your advantage.

Event Listeners

Note: In this section, the word function is used to mean anything that is able
to be called like a function, such as a method, a lambda, etc. The generic
technical term for this is callable .
The DotGame & GridView classes follow a pattern which allows a function to be
attached to an event. When the event is triggered/emitted, the function is
called. This function is called a listener or a callback, and this attaching
action can also be referred to as binding to or listening for an event. Code
that triggers an event can also supply arguments to the event functions.
This pattern is called the Event Emitter pattern, and is an implementation of
the Observer pattern (the Publisher/Subscriber pattern is similar). It is also
an example of a higher-order function (the function does the binding accepts
the listener function as an argument).
While it is also quite a similar approach to how Tkinter handles commands for
button presses, the Event Emitter pattern is far more exible in general,
primarily because multiple listeners can be attached to the same event.
The events emitted by the DotGame & GridView classes are very useful,
particularly for creating non-blocking animation. The supplied code binds to
every relevant event emitted by these classes. See DotsApp.bind_events in the
a3.py file.

Task 1 - Basic GUI

The purpose of this task is to create the basic graphical user interface (GUI)
for the Dots game. There are several sub-tasks that need to be completed for
this task. You will be working towards creating the user interface
demonstrated below.

Basic GUI

You have been supplied with an incomplete implementation of DotsApp to start
with. You should modify this class to implement the required functionality.
The very rst part of this task is to get the app onto the screen. Add your GUI
instantiation code to the main function in a3.py
Next, review the DotsApp class and modify the code as required to implement
the basic GUI.
The title of the window should be set to something appropriate (i.e. Dots ).
This also applies to any window in subsequent tasks.
As the basic GUI is improved in subsequent tasks, the DotsApp class will need
to be modied accordingly. It is also permitted, to create separate classes for
each task using inheritance this is not required.

InfoPanel

Dene a class named InfoPanel , which inherits from tk.Frame . This class is
used to display information to the user, such as their score, remaining moves
and objectives, etc.
The InfoPanel ‘s widgets must:

  1. be updated whenever the score event is emitted (i.e. after the user makes a move that joins some dots),
  2. be laid out approximately according1 to Basic GUI Example, and
  3. contain the following widgets:
    * Remaining Moves (top-left) A label to display the number of moves remaining
    * Score (top-left; below & to the right of Remaining Moves): A label to display the user’s score, in a larger fontsize
    * Objectives (top-right): An instance of ObjectivesView from view.py to display the objectives and how many of each remain
    * Companion (centre): An image of a character of your choosing
    Matching the layout of the example precisely can be achieved far more easily
    using Tkinter’s Grid Geometry Manager (instead of pack). Students are
    permitted to use this if they wish, but for simplicity, an approximation using
    pack is equally acceptable.
    Note: For convenience, you should have a setter method for each of the
    relevant widgets.

File Menu & Dialogs

Implement a menu bar, with a File menu. The File menu should have the
following entries:

  • New Game : Restarts the game
  • Exit : Exits the application
    When the user attempts to exit the application, either by the file menu or
    otherwise, they should rst be prompted with a dialog to conrm that they indeed
    want to quit the application. Further, when the game is over, the user should
    be shown a dialog informing them of the outcome (either win or loss).
    Note: On Mac OS X, the file menu should appear in the global menu bar (top of
    the screen).

IntervalBar

Implement a class, IntervalBar , which inherits from tk.Canvas . This class
should display a horizontal progress bar with vertical lines dividing each
step , allowing the user to see progress from 0, 1, , steps-1, steps ,
inclusive. For example, in Interval Bar Example above, there are 6 steps and
the current progress is 2.
Add the interval bar to the application and increase its progress every time
the user makes a move. When maximum progress is reached, reset the progress 1
for the next turn.
IntervalBar must be a subclass of tk.Canvas . tkinter.ttk.Progressbar must not
be used.

Task 2 - Intermediate Features

The purpose of this task is to extend the functionality of the basic GUI by
adding additional dots and companion functionality.
Companions are helpful side characters that can be activated to perform a
special ability. Every time a companion dot is activated, the companion is
charged (by one). When a companion is fully charged, their ability is
activated. Once activated, a companion’s charge is reset to zero, ready to be
charged again. By default, a companion is fully charged when it has been
charged six times.
Add another item to the file menu to allow the user to choose between a New
Game either with or without a companion.

Companion Dot

Implement the CompanionDot class by extending BasicDot in game.py , and
include it in your game.
It may be helpful to use CompanionGame from the game.py file. During
development of the companion dot, it may be helpful to use UselessCompanion .
A custom companion will be implemented in the next section.

Dot & Companion

Implement the following, and add them to your game:

  • Any one dot from 8.1. Dot Options
  • Any one companion from 8.2. Companion Options
    Some companions require a certain type of dot (i.e. when activated they may
    place a special type of dot). If you choose such a companion, you should
    choose the dot it requires as one of your dots.
    You should also add an IntervalBar to your InfoPanel and update it to show how
    much charge the companion has after each move.

Task 3 - Advanced Features

This task is open ended. It is up to you to decide what to do for this task.
Marks will be awarded based on the sophistication of the features you choose
to implement. Ensure that you consult with course staff before you commence
this task to ensure that the features are suciently sophisticated.
You are encouraged to utilize extra Python modules to help you implement your
desired functionality.

Description Document

You must also submit a brief description of the features you have implemented
for this task. This must be included in description.pdf , along with any other
required descriptions see 9. Assignment Submission. The description for this
task should also contain an outline of any third party Python modules you have
used, and instructions on how to install them. For example if you have used
Pillow module, then the following would be sucient.
If using multiple third-party libraries, it is a good idea to list their names
and versions rst, using bullet points, and then provide specic installation
instructions afterwards.
Be sure to format the description document neatly to ensure that the marker
can quickly scan the document for relevant information (i.e. by using larger,
bold headings, vertical whitespace between sections, section numbers, etc.).

Suggestions

  • Saving and loading a game
  • Background music/event sounds
  • Additional dots & companions
  • Campaign style storyline
  • Various animations
    These suggestions are not necessarily equal in diculty, and the complexity
    will likely vary based upon the particular implementation. Students should
    discuss potential features with course staff prior to implementing them, to
    get feedback on the sophistication.

文章作者: SafePoker
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 SafePoker !
  目录