Java代写 | COMP1110 Assignment 2

本次Java代写是完成名为IQFit的棋盘游戏。

COMP1110 Assignment 2

Problem Description
The assignment involves implementing in Java, a board game called IQFit made by the games developer SmartGames.
Objective
The game is a puzzle. The object of the game is to place ten plastic pieces on
a board so that the pieces fill the board perfectly, with no overlaps and no
gaps. The player starts by selecting a challenge which will have some number
of pieces already placed. Their task is to place all remaining pieces. Broadly,
the more pieces that are placed, the smaller the set of remaining options for
the player, and therefore the easier it is to complete the puzzle. The challenge
is made interesting by the complex three-dimensional shapes of the plastic
pieces.
A completed game:
To help you visualize the game, we have provided a paper version, which you
can cut out.
Challenges
A game starts by choosing a challenge which specifies in what positions
certain puzzle pieces must be placed. The puzzle pieces that are pre-placed
by the challenge at the start of the game cannot be moved by the player until
the game is ended.
Here is the starting challenge for the game above:
In the challenge above, the lime (L), sky blue (S), indigo (I), and green (G)
pieces are placed as part of the challenge. They can’t be moved. You can see
that much of the board is unfilled (grey holes). The player’s task is to place the
remaining six pieces in such a way that all of the board is covered perfectly,
which means no gaps and no overlaps.
Some challenges are much easier to solve than others. When you think about
the game, you may wish to reflect on what makes some challenges so much
easier than others. One of the assignment tasks is to create interesting
challenges. Note that as a general rule for puzzles, the more constrained the
player is, the fewer options they have, and consequently the solution to the
challenge is simpler.
The game comes with five difficulty levels: starter, junior, expert, master,
and wizard, and offers 24 challenges at each level, for a total of 120
prescribed challenges. These challenges are provided for you in theSolutions
class, and the different difficulty levels are tested in the SolutionsTest test.
Solutions
Each challenge has just one solution.
The following sequence shows one possible progression of a solution to the
game above (note that the order in which the pieces are played is not
important; this is just one possible sequence of moves).
Board
The game is played on a board comprised of 50 locations arranged in a 10×5
grid.
In the real-world game, each location consists of a circular indent into which a
piece may fit. We refer to the placement of pieces in terms of their upper left
corner when a bounding box is placed around them. In our game, locations
are encoded as two digits, the first one identifying the column from 0 to 9,
followed by another identifying the row from 0 to 4.
In the example illustrated below we show how the location of pieces on the
board is encoded. Notice that we identify each piece by the location of the
upper-left corner of its bounding box (a rectangular box drawn around the
piece).
For example, in the game above, the lime piece (lower-left, lime-green in
color) is in position 02 (column 0, row 2), the sky-blue piece (bottom centerleft) is in position 23 (column 2, row 3), the indigo piece (purple, bottom centerright) is in position 63 (column 6, row 3), and the green piece (green, right) is in
position 82 (column 8, row 2). Notice how the bounding box is necessary to
identify the location of the sky-blue piece since the piece itself does not cover
location 23, but that is the top left corner of its bounding box. Likewise for
the green piece, which does not cover 82, but that is the top left corner of its
bounding box. For the lime-green and indigo pieces the top-left corner of the
piece is the same as the top-left corner of its bounding box.
Pieces
The game comprises 10 playing shapes, each of a distinct color
(blue, green, indigo, lime-green, navy-blue, orange, pink, red, sky-blue,
and yellow).
Each piece is 3-dimensional. Note that in your assignment, your game will be
on a screen (just like this description), so will only view each piece from a twodimensional perspective.
You should study the picture below carefully. The lime-green, navy-blue,
and red pieces have not been placed, revealing their three dimensional
shape.
Each piece can be thought of in terms of a spine comprising
either three (green, indigo, lime-green, navy)
or four (blue, orange, pink, red, sky-blue, and yellow) spheres in a straight
line.
Each piece has three additional spheres that protrude from the spine, two in
one plane, and one in the other. Thus, when laid flat on a table and viewed
from above, they will either have a single protrusionsticking out from the
spine (blue and red in the photo), or a double protrusion (lime-green). You
can see these clearly in the diagram below.
When a piece is placed on the board, it must be placed with either the single
or double protrusion pointing downwards into the holes in the board. Thus in
the photo above, each of the 7 pieces placed on the board has no protrusions
pointing upwards. When a player places a piece, they can have either
the double protrusion pointing down, into the board, or the single
protrusion pointing down into the board. In the photo above, the pink, orange,
and sky-blue pieces each have their single protrusion visible, which means
they were all placed with the double protrusion pointing downwards, into the
board. On the other hand, the blue, green, indigo and yellow pieces all have
their double protrusion visible, which means they have been placed with
their single protrusion pointing downwards into the board.
Since each piece may be placed in one of four 90-
degree rotations (north, east, south, west), and in two flips (single
protrusion visible or double protrusion visible), each piece has eight possible
ways it can be placed on the board.
The diagram below illustrates all ten pieces and their eight possible
orientations. The first four columns show each piece its single protrusion
visible with four 90-degree rotations, while the last four columns show each
piece with its double protrusion visible with four 90-degree rotations. When we
encode pieces in this assignment, we use lower case letters (e.g. b) to encode
a piece in its single protrusion orientation (left half of the diagram), and we
use upper case letters (e.g. B to encode a piece its double
protrusion orientation (right half of the diagram).
In the game below, you can see that lime was placed in the L flip (double
protrusion) and the W orientation (west), sky-blue was placed in the s flip
(single protrusion) and S orientation (south), etc.
Legal Piece Placements
For a piece placement to be valid, the following must be true:
• All of the visible spheres in the piece must be placed above board
locations (no part of a piece may be off the board).
• All of the visible spheres in the piece must be placed on vacant board
locations (pieces may not overlap).
Encoding Game State and Challenges
Game states and challenges are encoded as strings. Your game will need to
be able to initialize itself using these strings and some of your tasks relate
directly to these strings.
Challenge Strings
A challenge string consists of a placement string comprising one or more
piece placements.
For the sample challenge below, the challenge string is “g82EI63SL02Ws23S”,
which consists of piece placements for green (g81E), indigo (I63S), limegreen (L02W), and sky-blue (s23S). These encodings are explained further
below.
Placement Strings
A placement string consists of between one to ten (inclusive) piece
placements (pieces blue to yellow, listed in order). The placement string may
not include any piece twice. A completed game must include ten piece
placements. Pieces are always listed in order (by the first letter of the color
name; the ordering of the rows in the figure above (blue … yellow)). Each
piece placement is described using four characters. For example, the
completed game below is encoded by the
string “b52Ng82EI63SL02Wn12So40NP60Sr00Ns23SY11N”. Note that the placement
string is ordered (the blue piece (b or B) first, and yellow piece (y or Y) last,
following the ordering in the diagram above). Correct ordering is a
requirement for valid placement strings. The encoding of the string is
described further below.
Piece Placement Strings
A piece placement string consists of four characters describing the location
and orientation of one particular piece on the board:
• The first character identifies which of the ten shapes is being placed,
and which flip (lower case: single protrusion, upper case: double
protrusion). The table above shows the letters used.
• The second character identifies which column the left of the piece is
in (columns are labelled 0 to 9).
• The third character identifies which row the top of the piece is in (rows
are labelled 0 to 4).
• The fourth character identifies which orientation the piece is in
(north N, east E, south S, and west W).
The image above shows the first and fourth characters for each of the pieces
in each of their orientations (80 in total).
In the placement string above, r00N describes the placement of the red piece,
which is placed with one protrusion (lower case r) in orientation N at location
(0, 0) (the top left corner of the board). L02Wdescribes the placement of
the lime-green piece, which is placed with one protrusion (upper case L) in
orientation W at location (0, 2). b52N describes the placement of the blue piece,
which is placed with one protrusion (lower case b) in orientation N at location
(5, 2).
Legal and Ethical Issues
First, as with any work you do, you must abide by the principles of honesty
and integrity. You are expected to demonstrate honesty and integrity in
everything you do.
In addition to those ground rules, you are to follow the rules one would
normally be subject to in a commercial setting. In particular, you may make
use of the works of others under two fundamental conditions: a) your use of
their work must be clearly acknowledged, and b) your use of their work must
be legal (for example, consistent with any copyright and licensing that applies
to the given material). Please understand that violation of these rules is a very
serious offence. However, as long as you abide by these rules, you are
explicitly invited to conduct research and make use of a variety of sources.
You are also given an explicit means with which to declare your use of other
sources (via originality statements you must complete). It is important to
realize that you will be assessed on the basis of your original contributions to
the project. While you won’t be penalized for correctly attributed use of others’
ideas, the work of others will not be considered as part of your contribution.
Therefore, these rules allow you to copy another student’s work entirely if: a)
they gave you permission to do so, and b) you acknowledged that you had
done so. Notice, however, that if you were to do this you would have no
original contribution and so would receive no marks for the assignment (but
you would not have broken any rules either).
Evaluation Criteria
It is essential that you refer to the deliverables page to check that you
understand each of the deadlines and what is required. Your assignment will
be marked via tests run through git’s continuous integration (CI) framework,
so all submittable materials will need to be in git and in the correct locations,
as prescribed by the deliverables page.