Esempio n. 1
0
def Carrier(rot):
    return Ship(
        "Aircraft Carrier",
        rotate_shape(
            [Pos(0, 0), Pos(1, 0),
             Pos(2, 0), Pos(3, 0),
             Pos(4, 0)], rot))
Esempio n. 2
0
def Destroyer(rot):
    return Ship("Destroyer", rotate_shape([Pos(0, 0), Pos(1, 0)], rot))
Esempio n. 3
0
def Submarine(rot):
    return Ship("Submarine",
                rotate_shape(
                    [Pos(0, 0), Pos(1, 0), Pos(2, 0)], rot))
Esempio n. 4
0
def Cruiser(rot):
    return Ship("Cruiser", rotate_shape(
        [Pos(0, 0), Pos(1, 0), Pos(2, 0)], rot))
Esempio n. 5
0
def Battleship(rot):
    return Ship(
        "Battleship",
        rotate_shape([Pos(0, 0), Pos(1, 0),
                      Pos(2, 0), Pos(3, 0)], rot))
Esempio n. 6
0
"""No descrption given.  What do *you* think this does?"""

from battleship import Pos

print("******** BEGINNING TESTCASE ********")

x = Pos(1, 2)
y = Pos(3, 4)

z = x.rotate(0)
a = y.rotate(1)
b = x.rotate(2)
c = y.rotate(3)

# confirm that the student asserts as required.

try:
    x.rotate(-1)
    print("ERROR: Your Pos.rotate() method does not assert on invalid inputs")
except AssertionError:
    print("step 1 of this testcase passed.")

try:
    x.rotate(4)
    print("ERROR: Your Pos.rotate() method does not assert on invalid inputs")
except AssertionError:
    print("step 2 of this testcase passed.")
try:
    x.rotate(100)
    print("ERROR: Your Pos.rotate() method does not assert on invalid inputs")
except AssertionError: