Exemplo n.º 1
0
    def test_support_to_hold_yourself_not_possible(self):
        """
        An army can not get an additional hold power by supporting itself.

        Italy:
        A Venice - Trieste
        A Tyrolia Supports A Venice - Trieste

        Austria:
        F Trieste Supports F Trieste

        The fleet in Trieste should be dislodged.
        """
        Army(self.state, 0, Nations.ITALY, self.territories.VENICE),
        Army(self.state, 0, Nations.ITALY, self.territories.TYROLIA),
        Fleet(self.state, 0, Nations.AUSTRIA, self.territories.TRIESTE)

        Move(self.state, 0, Nations.ITALY, self.territories.VENICE, self.territories.TRIESTE)
        Support(self.state, 0, Nations.ITALY, self.territories.TYROLIA, self.territories.VENICE, self.territories.TRIESTE)
        fleet_trieste_support = Support(self.state, 0, Nations.AUSTRIA, self.territories.TRIESTE, self.territories.TRIESTE, self.territories.TRIESTE)

        process(self.state)

        self.assertTrue(fleet_trieste_support.illegal)
        self.assertEqual(
            fleet_trieste_support.illegal_verbose,
            'Source and target cannot be the same territory.'
        )
Exemplo n.º 2
0
    def test_three_way_beleaguered_garrison(self):
        """
        In a beleaguered garrison from three sides, the adjudicator may not let
        two attacks fail and then let the third succeed.

        England:
        F Edinburgh Supports F Yorkshire - North Sea
        F Yorkshire - North Sea

        France:
        F Belgium - North Sea
        F English Channel Supports F Belgium - North Sea

        Germany:
        F North Sea Hold

        Russia:
        F Norwegian Sea - North Sea
        F Norway Supports F Norwegian Sea - North Sea

        None of the fleets move. The German fleet in the North Sea is not
        dislodged.
        """
        pieces = [
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.EDINBURGH),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.YORKSHIRE),
            Fleet(self.state, 0, Nations.FRANCE, self.territories.BELGIUM),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.ENGLISH_CHANNEL),
            Fleet(self.state, 0, Nations.GERMANY, self.territories.NORTH_SEA),
            Fleet(self.state, 0, Nations.RUSSIA,
                  self.territories.NORWEGIAN_SEA),
            Fleet(self.state, 0, Nations.RUSSIA, self.territories.NORWAY),
        ]
        orders = [
            Support(self.state, 0, Nations.ENGLAND, self.territories.EDINBURGH,
                    self.territories.YORKSHIRE, self.territories.NORTH_SEA),
            Move(self.state, 0, Nations.ENGLAND, self.territories.YORKSHIRE,
                 self.territories.NORTH_SEA),
            Move(self.state, 0, Nations.FRANCE, self.territories.BELGIUM,
                 self.territories.NORTH_SEA),
            Support(self.state, 0, Nations.FRANCE,
                    self.territories.ENGLISH_CHANNEL, self.territories.BELGIUM,
                    self.territories.NORTH_SEA),
            Hold(self.state, 0, Nations.GERMANY, self.territories.NORTH_SEA),
            Move(self.state, 0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA,
                 self.territories.NORTH_SEA),
            Support(self.state, 0, Nations.RUSSIA, self.territories.NORWAY,
                    self.territories.NORWEGIAN_SEA,
                    self.territories.NORTH_SEA),
        ]
        process(self.state)

        self.assertEqual(pieces[4].dislodged_decision, Outcomes.SUSTAINS)
        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.FAILS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[5].outcome, Outcomes.FAILS)
        self.assertEqual(orders[6].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 3
0
    def test_almost_circular_movement_self_dislodgement_with_beleaguered_garrison(
            self):
        """
        Similar to the previous test case, but now the beleaguered fleet is in
        circular movement with the weaker attacker. So, the circular movement
        fails.

        England:
        F North Sea - Denmark
        F Yorkshire Supports F Norway - North Sea

        Germany:
        F Holland Supports F Helgoland Bight - North Sea
        F Helgoland Bight - North Sea
        F Denmark - Helgoland Bight

        Russia:
        F Skagerrak Supports F Norway - North Sea
        F Norway - North Sea

        There is no movement of fleets.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Fleet(0, Nations.ENGLAND, self.territories.YORKSHIRE),
            Fleet(0, Nations.GERMANY, self.territories.HOLLAND),
            Fleet(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT),
            Fleet(0, Nations.GERMANY, self.territories.DENMARK),
            Fleet(0, Nations.RUSSIA, self.territories.SKAGERRAK),
            Fleet(0, Nations.RUSSIA, self.territories.NORWAY),
        ]
        orders = [
            Move(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                 self.territories.DENMARK),
            Support(0, Nations.ENGLAND, self.territories.YORKSHIRE,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Support(0, Nations.GERMANY, self.territories.HOLLAND,
                    self.territories.HELGOLAND_BIGHT,
                    self.territories.NORTH_SEA),
            Move(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT,
                 self.territories.NORTH_SEA),
            Move(0, Nations.GERMANY, self.territories.DENMARK,
                 self.territories.HELGOLAND_BIGHT),
            Support(0, Nations.RUSSIA, self.territories.SKAGERRAK,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Move(0, Nations.RUSSIA, self.territories.NORWAY,
                 self.territories.NORTH_SEA),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.FAILS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.FAILS)
        self.assertEqual(orders[5].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[6].outcome, Outcomes.FAILS)
Exemplo n.º 4
0
    def test_bounce_by_convoy_to_adjacent_place(self):
        """
        Similar to test case 6.G.10, but now the other unit is taking the
        convoy.

        England:
        A Norway - Sweden
        F Denmark Supports A Norway - Sweden
        F Finland Supports A Norway - Sweden

        France:
        F Norwegian Sea - Norway
        F North Sea Supports F Norwegian Sea - Norway

        Germany:
        F Skagerrak Convoys A Sweden - Norway

        Russia:
        A Sweden - Norway via Convoy
        F Barents Sea Supports A Sweden - Norway

        Again the army in Sweden is bounced by the fleet in the Norwegian Sea.
        The army in Norway will move to Sweden and dislodge the Russian army.

        The final destination of the fleet in the Norwegian Sea depends on how
        issue 4.A.7 is resolved. If choice a is taken, then the fleet advances
        to Norway, but if choice b is taken (which I prefer) the fleet bounces
        and stays in the Norwegian Sea.
        """
        pieces = [
            Army(self.state, 0, Nations.ENGLAND, self.territories.NORWAY),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.DENMARK),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.FINLAND),
            Fleet(self.state, 0, Nations.FRANCE, self.territories.NORWEGIAN_SEA),
            Fleet(self.state, 0, Nations.FRANCE, self.territories.NORTH_SEA),
            Fleet(self.state, 0, Nations.GERMANY, self.territories.SKAGERRAK),
            Army(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN),
            Fleet(self.state, 0, Nations.RUSSIA, self.territories.BARRENTS_SEA),
        ]
        orders = [
            Move(self.state, 0, Nations.ENGLAND, self.territories.NORWAY, self.territories.SWEDEN),
            Support(self.state, 0, Nations.ENGLAND, self.territories.DENMARK, self.territories.NORWAY, self.territories.SWEDEN),
            Support(self.state, 0, Nations.ENGLAND, self.territories.FINLAND, self.territories.NORWAY, self.territories.SWEDEN),
            Move(self.state, 0, Nations.FRANCE, self.territories.NORWEGIAN_SEA, self.territories.NORWAY),
            Support(self.state, 0, Nations.FRANCE, self.territories.NORTH_SEA, self.territories.NORWEGIAN_SEA, self.territories.NORWAY),
            Convoy(self.state, 0, Nations.GERMANY, self.territories.SKAGERRAK, self.territories.SWEDEN, self.territories.NORWAY),
            Move(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN, self.territories.NORWAY, via_convoy=True),
            Support(self.state, 0, Nations.RUSSIA, self.territories.BARRENTS_SEA, self.territories.SWEDEN, self.territories.NORWAY),
        ]
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[6].outcome, Outcomes.FAILS)
        self.assertEqual(pieces[6].dislodged_decision, Outcomes.DISLODGED)
        self.assertEqual(orders[7].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 5
0
    def test_two_unit_in_one_area_bug_moving_by_land(self):
        """
        Similar to the previous test case, but now the other unit moves by
        convoy.

        England:
        A Norway - Sweden via Convoy
        A Denmark Supports A Norway - Sweden
        F Baltic Sea Supports A Norway - Sweden
        F Skagerrak Convoys A Norway - Sweden
        F North Sea - Norway

        Russia:
        A Sweden - Norway
        F Norwegian Sea Supports A Sweden - Norway

        Sweden and Norway are swapped, while the fleet in the North Sea will bounce.
        """
        pieces = [
            Army(0, Nations.ENGLAND, self.territories.NORWAY),
            Fleet(0, Nations.ENGLAND, self.territories.DENMARK),
            Fleet(0, Nations.ENGLAND, self.territories.BALTIC_SEA),
            Fleet(0, Nations.ENGLAND, self.territories.SKAGERRAK),
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(0, Nations.RUSSIA, self.territories.SWEDEN),
            Fleet(0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA),
        ]
        orders = [
            Move(0,
                 Nations.ENGLAND,
                 self.territories.NORWAY,
                 self.territories.SWEDEN,
                 via_convoy=True),
            Support(0, Nations.ENGLAND, self.territories.DENMARK,
                    self.territories.NORWAY, self.territories.SWEDEN),
            Support(0, Nations.ENGLAND, self.territories.BALTIC_SEA,
                    self.territories.NORWAY, self.territories.SWEDEN),
            Convoy(0, Nations.ENGLAND, self.territories.SKAGERRAK,
                   self.territories.NORWAY, self.territories.SWEDEN),
            Move(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                 self.territories.NORWAY),
            Move(0, Nations.RUSSIA, self.territories.SWEDEN,
                 self.territories.NORWAY),
            Support(0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA,
                    self.territories.SWEDEN, self.territories.NORWAY),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[5].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[4].outcome, Outcomes.FAILS)
        self.assertEqual(orders[6].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 6
0
    def test_no_self_dislodgement_with_beleauguered_garrison(self):
        """
        An attempt to self dislodge can be combined with a beleaguered
        garrison. Such self dislodgement is still not possible.

        England:
        F North Sea Hold
        F Yorkshire Supports F Norway - North Sea

        Germany:
        F Holland Supports F Helgoland Bight - North Sea
        F Helgoland Bight - North Sea

        Russia:
        F Skagerrak Supports F Norway - North Sea
        F Norway - North Sea

        Although the Russians beat the German attack (with the support of
        Yorkshire) and the two Russian fleets are enough to dislodge the fleet
        in the North Sea, the fleet in the North Sea is not dislodged, since it
        would not be dislodged if the English fleet in Yorkshire would not give
        support. According to the DPTG the fleet in the North Sea would be
        dislodged. The DPTG is incorrect in this case.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Fleet(0, Nations.ENGLAND, self.territories.YORKSHIRE),
            Fleet(0, Nations.GERMANY, self.territories.HOLLAND),
            Fleet(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT),
            Fleet(0, Nations.RUSSIA, self.territories.SKAGERRAK),
            Fleet(0, Nations.RUSSIA, self.territories.NORWAY),
        ]
        orders = [
            Hold(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Support(0, Nations.ENGLAND, self.territories.YORKSHIRE,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Support(0, Nations.GERMANY, self.territories.HOLLAND,
                    self.territories.HELGOLAND_BIGHT,
                    self.territories.NORTH_SEA),
            Move(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT,
                 self.territories.NORTH_SEA),
            Support(0, Nations.RUSSIA, self.territories.SKAGERRAK,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Move(0, Nations.RUSSIA, self.territories.NORWAY,
                 self.territories.NORTH_SEA),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(pieces[0].dislodged_decision, Outcomes.SUSTAINS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[5].outcome, Outcomes.FAILS)
Exemplo n.º 7
0
    def test_two_unit_in_one_area_bug_moving_by_convoy(self):
        """
        If the adjudicator is not correctly implemented, this may lead to a
        resolution where two units end up in the same area.

        England:
        A Norway - Sweden
        A Denmark Supports A Norway - Sweden
        F Baltic Sea Supports A Norway - Sweden
        F North Sea - Norway

        Russia:
        A Sweden - Norway via Convoy
        F Skagerrak Convoys A Sweden - Norway
        F Norwegian Sea Supports A Sweden - Norway

        See decision details 5.B.6. If the 'PREVENT STRENGTH' is incorrectly
        implemented, due to the fact that it does not take into account that
        the 'PREVENT STRENGTH' is only zero when the unit is engaged in a head
        to head battle, then this goes wrong in this test case. The 'PREVENT
        STRENGTH' of Sweden would be zero, because the opposing unit in Norway
        successfully moves. Since, this strength would be zero, the fleet in
        the North Sea would move to Norway. However, although the 'PREVENT
        STRENGTH' is zero, the army in Sweden would also move to Norway. So,
        the final result would contain two units that successfully moved to
        Norway.

        Of course, this is incorrect. Norway will indeed successfully move to
        Sweden while the army in Sweden ends in Norway, because it is stronger
        then the fleet in the North Sea. This fleet will stay in the North Sea.
        """
        Army(self.state, 0, Nations.ENGLAND, self.territories.NORWAY),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.DENMARK),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.BALTIC_SEA),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA),
        Army(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN),
        Fleet(self.state, 0, Nations.RUSSIA, self.territories.SKAGERRAK),
        Fleet(self.state, 0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA),
        orders = [
            Move(self.state, 0, Nations.ENGLAND, self.territories.NORWAY, self.territories.SWEDEN),
            Support(self.state, 0, Nations.ENGLAND, self.territories.DENMARK, self.territories.NORWAY, self.territories.SWEDEN),
            Support(self.state, 0, Nations.ENGLAND, self.territories.BALTIC_SEA, self.territories.NORWAY, self.territories.SWEDEN),
            Move(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA, self.territories.NORWAY),
            Move(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN, self.territories.NORWAY, via_convoy=True),
            Convoy(self.state, 0, Nations.RUSSIA, self.territories.SKAGERRAK, self.territories.SWEDEN, self.territories.NORWAY),
            Support(self.state, 0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA, self.territories.SWEDEN, self.territories.NORWAY),
        ]
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[6].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 8
0
    def test_support_can_be_cut_with_other_coast(self):
        """
        Support can be cut from the other coast.

        England:
        F Irish Sea Supports F North Atlantic Ocean - Mid-Atlantic Ocean
        F North Atlantic Ocean - Mid-Atlantic Ocean

        France:
        F Spain(nc) Supports F Mid-Atlantic Ocean
        F Mid-Atlantic Ocean Hold

        Italy:
        F Gulf of Lyon - Spain(sc)

        The Italian fleet in the Gulf of Lyon will cut the support in Spain.
        That means that the French fleet in the Mid Atlantic Ocean will be
        dislodged by the English fleet in the North Atlantic Ocean.
        """
        pieces = [
            Fleet(self.state, 0, Nations.ENGLAND,
                  self.territories.NORTH_ATLANTIC),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.IRISH_SEA),
            Fleet(self.state,
                  0,
                  Nations.FRANCE,
                  self.territories.SPAIN,
                  named_coast=self.named_coasts.SPAIN_NC),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.MID_ATLANTIC),
            Fleet(self.state, 0, Nations.ITALY, self.territories.GULF_OF_LYON),
        ]
        orders = [
            Move(self.state, 0, Nations.ENGLAND,
                 self.territories.NORTH_ATLANTIC,
                 self.territories.MID_ATLANTIC),
            Support(self.state, 0, Nations.ENGLAND, self.territories.IRISH_SEA,
                    self.territories.NORTH_ATLANTIC,
                    self.territories.MID_ATLANTIC),
            Support(self.state, 0, Nations.FRANCE, self.territories.SPAIN,
                    self.territories.MID_ATLANTIC,
                    self.territories.MID_ATLANTIC),
            Hold(self.state, 0, Nations.FRANCE, self.territories.MID_ATLANTIC),
            Move(self.state, 0, Nations.ITALY, self.territories.GULF_OF_LYON,
                 self.territories.SPAIN, self.named_coasts.SPAIN_SC),
        ]

        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.FAILS)
        self.assertEqual(pieces[3].dislodged_decision, Outcomes.DISLODGED)
Exemplo n.º 9
0
    def test_beleaguered_convoy_is_not_disrupted(self):
        """
        Even when a convoy is in a beleaguered garrison it is not disrupted.

        England:
        F North Sea Convoys A London - Holland
        A London - Holland

        France:
        F English Channel - North Sea
        F Belgium Supports F English Channel - North Sea

        Germany:
        F Skagerrak - North Sea
        F Denmark Supports F Skagerrak - North Sea

        The army in London will successfully convoy and end in Holland.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL),
            Fleet(0, Nations.FRANCE, self.territories.BELGIUM),
            Fleet(0, Nations.GERMANY, self.territories.SKAGERRAK),
            Fleet(0, Nations.GERMANY, self.territories.DENMARK)
        ]
        orders = [
            Convoy(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.LONDON, self.territories.HOLLAND),
            Move(0,
                 Nations.ENGLAND,
                 self.territories.LONDON,
                 self.territories.HOLLAND,
                 via_convoy=True),
            Move(0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL,
                 self.territories.NORTH_SEA),
            Support(0, Nations.FRANCE, self.territories.BELGIUM,
                    self.territories.ENGLISH_CHANNEL,
                    self.territories.NORTH_SEA),
            Move(0, Nations.GERMANY, self.territories.SKAGERRAK,
                 self.territories.NORTH_SEA),
            Support(0, Nations.GERMANY, self.territories.DENMARK,
                    self.territories.SKAGERRAK, self.territories.NORTH_SEA),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[1].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[4].outcome, Outcomes.FAILS)
        self.assertEqual(orders[5].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 10
0
    def test_kidnapping_with_a_disrupted_convoy(self):
        """
        When kidnapping of armies is allowed, a move can be sabotaged by a
        fleet that is almost certainly dislodged.

        France:
        F Brest - English Channel
        A Picardy - Belgium
        A Burgundy Supports A Picardy - Belgium
        F Mid-Atlantic Ocean Supports F Brest - English Channel

        England:
        F English Channel Convoys A Picardy - Belgium

        See issue 4.A.3. If a convoy always takes precedence over a land route
        (choice a), the move from Picardy to Belgium fails. It tries to convoy
        and the convoy is disrupted.

        For choice b and c, there is no unit moving in opposite direction for
        the move of the army in Picardy. For this reason, the move for the army
        in Picardy is not by convoy and succeeds over land.

        When the 1982 or 2000 rules are used (choice d), then it is not the
        "intent" of the French army in Picardy to convoy. The move from Picardy
        to Belgium is just a successful move over land.

        When explicit adjacent convoying is used (DPTG, choice e), the order of
        the French army in Picardy is not a convoy order. So, it just ordered
        over land, and that move succeeds.

        This is an excellent example why the convoy route should not
        automatically have priority over the land route. It would just be
        annoying for the attacker and this situation is without fun. I prefer
        the 1982 rule with the 2000 clarification. According to these rules the
        move from Picardy succeeds.
        """
        Fleet(self.state, 0, Nations.FRANCE, self.territories.BREST),
        Army(self.state, 0, Nations.FRANCE, self.territories.PICARDY),
        Army(self.state, 0, Nations.FRANCE, self.territories.BURGUNDY),
        Fleet(self.state, 0, Nations.FRANCE, self.territories.MID_ATLANTIC),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.ENGLISH_CHANNEL),
        orders = [
            Move(self.state, 0, Nations.FRANCE, self.territories.BREST, self.territories.ENGLISH_CHANNEL),
            Move(self.state, 0, Nations.FRANCE, self.territories.PICARDY, self.territories.BELGIUM),
            Support(self.state, 0, Nations.FRANCE, self.territories.BURGUNDY, self.territories.PICARDY, self.territories.BELGIUM),
            Support(self.state, 0, Nations.FRANCE, self.territories.MID_ATLANTIC, self.territories.BREST, self.territories.ENGLISH_CHANNEL),
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.ENGLISH_CHANNEL, self.territories.PICARDY, self.territories.BELGIUM),
        ]
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 11
0
    def test_supporting_with_unspecified_coast_when_only_one_coast_is_possible(
            self):
        """
        Some hardliners require a coast in a support order even when only one
        coast is possible.

        France:
        F Portugal Supports F Gascony - Spain
        F Gascony - Spain(nc)

        Italy:
        F Gulf of Lyon Supports F Western Mediterranean - Spain(sc)
        F Western Mediterranean - Spain(sc)

        See issue 4.B.4. If coasts are not required in support orders, then the
        support of Portugal is successful. This means that the Italian fleet in
        the Western Mediterranean bounces. Some adjudicators may not accept a
        support order without coast (the support will fail or a default coast
        is taken). In that case the support order of Portugal fails
        (in case of a default coast the coast will probably the south coast)
        and the Italian fleet in the Western Mediterranean will successfully
        move.

        I prefer that supporting without coasts should be allowed. So I prefer
        that the support of Portugal is successful and that the Italian fleet
        in the Western Mediterranean bounces.
        """
        pieces = [
            Fleet(0, Nations.FRANCE, self.territories.PORTUGAL),
            Fleet(0, Nations.FRANCE, self.territories.GASCONY),
            Fleet(0, Nations.ITALY, self.territories.GULF_OF_LYON),
            Fleet(0, Nations.ITALY, self.territories.WESTERN_MEDITERRANEAN),
        ]
        orders = [
            Support(0, Nations.FRANCE, self.territories.PORTUGAL,
                    self.territories.GASCONY, self.territories.SPAIN),
            Move(0, Nations.FRANCE, self.territories.GASCONY,
                 self.territories.SPAIN, self.named_coasts.SPAIN_NC),
            Support(0, Nations.ITALY, self.territories.GULF_OF_LYON,
                    self.territories.WESTERN_MEDITERRANEAN,
                    self.territories.SPAIN),
            Move(0, Nations.ITALY, self.territories.WESTERN_MEDITERRANEAN,
                 self.territories.SPAIN, self.named_coasts.SPAIN_SC),
        ]

        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.FAILS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
Exemplo n.º 12
0
    def test_no_self_dislodgement_with_beleauguered_and_head_to_head(self):
        """
        Similar to the previous test case, but now the beleaguered fleet is
        also engaged in a head to head battle.

        England:
        F North Sea - Norway
        F Yorkshire Supports F Norway - North Sea

        Germany:
        F Holland Supports F Helgoland Bight - North Sea
        F Helgoland Bight - North Sea

        Russia:
        F Skagerrak Supports F Norway - North Sea
        F Norway - North Sea

        Again, none of the fleets move.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Fleet(0, Nations.ENGLAND, self.territories.YORKSHIRE),
            Fleet(0, Nations.GERMANY, self.territories.HOLLAND),
            Fleet(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT),
            Fleet(0, Nations.RUSSIA, self.territories.SKAGERRAK),
            Fleet(0, Nations.RUSSIA, self.territories.NORWAY),
        ]
        orders = [
            Move(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                 self.territories.NORWAY),
            Support(0, Nations.ENGLAND, self.territories.YORKSHIRE,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Support(0, Nations.GERMANY, self.territories.HOLLAND,
                    self.territories.HELGOLAND_BIGHT,
                    self.territories.NORTH_SEA),
            Move(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT,
                 self.territories.NORTH_SEA),
            Support(0, Nations.RUSSIA, self.territories.SKAGERRAK,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Move(0, Nations.RUSSIA, self.territories.NORWAY,
                 self.territories.NORTH_SEA),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.FAILS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[5].outcome, Outcomes.FAILS)
Exemplo n.º 13
0
    def test_convoy_to_an_adjacent_place_with_paradox(self):
        """
        In this case the convoy route is available when the land route is
        chosen and the convoy route is not available when the convoy route is
        chosen.

        England:
        F Norway Supports F North Sea - Skagerrak
        F North Sea - Skagerrak

        Russia:
        A Sweden - Norway
        F Skagerrak Convoys A Sweden - Norway
        F Barents Sea Supports A Sweden - Norway
        See issue 4.A.2 and 4.A.3.

        If for issue 4.A.3, choice b, c or e has been taken, then the move from
        Sweden to Norway is not a convoy and the English fleet in Norway is
        dislodged and the fleet in Skagerrak will not be dislodged.

        If choice a or d (1982/2000 rule) has been taken for issue 4.A.3, then
        the move from Sweden to Norway must be treated as a convoy. At that
        moment the situation becomes paradoxical. When the 'All Hold' rule is
        used, both the army in Sweden as the fleet in the North Sea will not
        advance. In all other paradox rules the English fleet in the North Sea
        will dislodge the Russian fleet in Skagerrak and the army in Sweden
        will not advance.

        I prefer the 1982 rule with the 2000 rulebook clarification concerning
        the convoy to adjacent places and I prefer the Szykman rule for paradox
        resolving. That means that according to these preferences the fleet in
        the North Sea will dislodge the Russian fleet in Skagerrak and the army
        in Sweden will not advance.
        """
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORWAY),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA),
        Army(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN),
        Fleet(self.state, 0, Nations.RUSSIA, self.territories.SKAGERRAK),
        Fleet(self.state, 0, Nations.RUSSIA, self.territories.BARRENTS_SEA),
        orders = [
            Support(self.state, 0, Nations.ENGLAND, self.territories.NORWAY, self.territories.NORTH_SEA, self.territories.SKAGERRAK),
            Move(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA, self.territories.SKAGERRAK),
            Move(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN, self.territories.NORWAY),
            Convoy(self.state, 0, Nations.RUSSIA, self.territories.SKAGERRAK, self.territories.SWEDEN, self.territories.NORWAY),
            Support(self.state, 0, Nations.RUSSIA, self.territories.BARRENTS_SEA, self.territories.SWEDEN, self.territories.NORWAY),
        ]
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 14
0
    def test_move_to_own_sector_with_convoy(self):
        """
        Moving to the same sector is still illegal with convoy (2000 rulebook,
        page 4, "Note: An Army can move across water provinces from one coastal
        province to another...").

        England:
        F North Sea Convoys A Yorkshire - Yorkshire
        A Yorkshire - Yorkshire
        A Liverpool Supports A Yorkshire - Yorkshire

        Germany:
        F London - Yorkshire
        A Wales Supports F London - Yorkshire

        The move of the army in Yorkshire is illegal. This makes the support of
        Liverpool also illegal and without the support, the Germans have a
        stronger force. The fleet in London dislodges the army in Yorkshire.
        """
        pieces = [
            Fleet(Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(Nations.ENGLAND, self.territories.YORKSHIRE),
            Army(Nations.ENGLAND, self.territories.LIVERPOOL),
            Fleet(Nations.ENGLAND, self.territories.LONDON),
            Army(Nations.ENGLAND, self.territories.WALES),
        ]

        fleet_north_sea_convoy = Convoy(Nations.ENGLAND,
                                        self.territories.NORTH_SEA,
                                        self.territories.YORKSHIRE,
                                        self.territories.YORKSHIRE)
        army_yorkshire_move = Move(Nations.ENGLAND, self.territories.YORKSHIRE,
                                   self.territories.YORKSHIRE)
        army_liverpool_support = Support(Nations.ENGLAND,
                                         self.territories.LIVERPOOL,
                                         self.territories.YORKSHIRE,
                                         self.territories.YORKSHIRE)
        fleet_london_move = Move(Nations.GERMANY, self.territories.LONDON,
                                 self.territories.YORKSHIRE)
        army_wales_support = Support(Nations.GERMANY, self.territories.WALES,
                                     self.territories.LONDON,
                                     self.territories.YORKSHIRE)

        self.state.register(*pieces, fleet_north_sea_convoy,
                            army_yorkshire_move, army_liverpool_support,
                            fleet_london_move, army_wales_support)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(army_yorkshire_move.legal_decision, Outcomes.ILLEGAL)
        self.assertEqual(army_yorkshire_move.illegal_message,
                         illegal_messages.M002)
Exemplo n.º 15
0
    def test_almost_self_dislodgement_with_beleaguered_garrison(self):
        """
        Similar to the previous test case, but now the beleaguered fleet is moving away.

        England:
        F North Sea - Norwegian Sea
        F Yorkshire Supports F Norway - North Sea

        Germany:
        F Holland Supports F Helgoland Bight - North Sea
        F Helgoland Bight - North Sea

        Russia:
        F Skagerrak Supports F Norway - North Sea
        F Norway - North Sea

        Both the fleet in the North Sea and the fleet in Norway move.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Fleet(0, Nations.ENGLAND, self.territories.YORKSHIRE),
            Fleet(0, Nations.GERMANY, self.territories.HOLLAND),
            Fleet(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT),
            Fleet(0, Nations.RUSSIA, self.territories.SKAGERRAK),
            Fleet(0, Nations.RUSSIA, self.territories.NORWAY),
        ]
        orders = [
            Move(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                 self.territories.NORWEGIAN_SEA),
            Support(0, Nations.ENGLAND, self.territories.YORKSHIRE,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Support(0, Nations.GERMANY, self.territories.HOLLAND,
                    self.territories.HELGOLAND_BIGHT,
                    self.territories.NORTH_SEA),
            Move(0, Nations.GERMANY, self.territories.HELGOLAND_BIGHT,
                 self.territories.NORTH_SEA),
            Support(0, Nations.RUSSIA, self.territories.SKAGERRAK,
                    self.territories.NORWAY, self.territories.NORTH_SEA),
            Move(0, Nations.RUSSIA, self.territories.NORWAY,
                 self.territories.NORTH_SEA),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[5].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 16
0
    def test_supporting_with_unspecified_coast(self):
        """
        Most house rules accept support orders without coast specification.

        France:
        F Portugal Supports F Mid-Atlantic Ocean - Spain
        F Mid-Atlantic Ocean - Spain(nc)

        Italy:
        F Gulf of Lyon Supports F Western Mediterranean - Spain(sc)
        F Western Mediterranean - Spain(sc)

        See issue 4.B.4. If coasts are not required in support orders, then the
        support of Portugal is successful. This means that the Italian fleet in
        the Western Mediterranean bounces. Some adjudicators may not accept a
        support order without coast (the support will fail or a default coast
        is taken). In that case the support order of Portugal fails (in case of
        a default coast the coast will probably the south coast) and the
        Italian fleet in the Western Mediterranean will successfully move.

        I prefer that the support succeeds and the Italian fleet in the Western
        Mediterranean bounces.
        """
        pieces = [
            Fleet(0, Nations.FRANCE, self.territories.PORTUGAL),
            Fleet(0, Nations.FRANCE, self.territories.MID_ATLANTIC),
            Fleet(0, Nations.ITALY, self.territories.GULF_OF_LYON),
            Fleet(0, Nations.ITALY, self.territories.WESTERN_MEDITERRANEAN),
        ]
        orders = [
            Support(0, Nations.FRANCE, self.territories.PORTUGAL,
                    self.territories.MID_ATLANTIC, self.territories.SPAIN),
            Move(0, Nations.FRANCE, self.territories.MID_ATLANTIC,
                 self.territories.SPAIN, self.named_coasts.SPAIN_NC),
            Support(0, Nations.ITALY, self.territories.GULF_OF_LYON,
                    self.territories.WESTERN_MEDITERRANEAN,
                    self.territories.SPAIN),
            Move(0, Nations.ITALY, self.territories.WESTERN_MEDITERRANEAN,
                 self.territories.SPAIN, self.named_coasts.SPAIN_SC),
        ]

        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.FAILS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
Exemplo n.º 17
0
    def test_bounce_and_dislodge_with_double_convoy(self):
        """
        Similar to test case 6.G.10, but now both units use a convoy and
        without some support.

        England:
        F North Sea Convoys A London - Belgium
        A Holland Supports A London - Belgium
        A Yorkshire - London
        A London - Belgium via Convoy

        France:
        F English Channel Convoys A Belgium - London
        A Belgium - London via Convoy

        The French army in Belgium is bounced by the army from Yorkshire. The
        army in London move to Belgium, dislodging the unit there.

        The final destination of the army in the Yorkshire depends on how issue
        4.A.7 is resolved. If choice a is taken, then the army advances to
        London, but if choice b is taken (which I prefer) the army bounces and
        stays in Yorkshire.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(0, Nations.ENGLAND, self.territories.HOLLAND),
            Army(0, Nations.ENGLAND, self.territories.YORKSHIRE),
            Army(0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL),
            Army(0, Nations.FRANCE, self.territories.BELGIUM),
        ]
        orders = [
            Convoy(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.LONDON, self.territories.BELGIUM),
            Support(0, Nations.ENGLAND, self.territories.HOLLAND,
                    self.territories.LONDON, self.territories.BELGIUM),
            Move(0, Nations.ENGLAND, self.territories.YORKSHIRE,
                 self.territories.LONDON),
            Move(0,
                 Nations.ENGLAND,
                 self.territories.LONDON,
                 self.territories.BELGIUM,
                 via_convoy=True),
            Convoy(0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL,
                   self.territories.BELGIUM, self.territories.LONDON),
            Move(0,
                 Nations.FRANCE,
                 self.territories.BELGIUM,
                 self.territories.LONDON,
                 via_convoy=True),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[5].outcome, Outcomes.FAILS)
        self.assertEqual(pieces[5].dislodged_decision, Outcomes.DISLODGED)
Exemplo n.º 18
0
    def test_three_army_circular_movement_with_support(self):
        """
        Three units can change place, even when one gets support.

        Turkey:
        F Ankara - Constantinople
        A Constantinople - Smyrna
        A Smyrna - Ankara
        A Bulgaria Supports F Ankara - Constantinople

        Of course the three units will move, but knowing how programs are
        written, this can confuse the adjudicator.
        """
        Fleet(self.state, 0, Nations.TURKEY, self.territories.ANKARA),
        Army(self.state, 0, Nations.TURKEY, self.territories.BULGARIA),
        Army(self.state, 0, Nations.TURKEY, self.territories.CONSTANTINOPLE),
        Army(self.state, 0, Nations.TURKEY, self.territories.SMYRNA)
        orders = [
            Move(self.state, 0, Nations.TURKEY, self.territories.ANKARA,
                 self.territories.CONSTANTINOPLE),
            Move(self.state, 0, Nations.TURKEY,
                 self.territories.CONSTANTINOPLE, self.territories.SMYRNA),
            Move(self.state, 0, Nations.TURKEY, self.territories.SMYRNA,
                 self.territories.ANKARA),
            Support(self.state, 0, Nations.TURKEY, self.territories.BULGARIA,
                    self.territories.ANKARA, self.territories.CONSTANTINOPLE),
        ]
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 19
0
    def test_disloged_unit_has_not_effect_on_attackers_area(self):
        """
        An army can follow.

        Germany:
        A Berlin - Prussia
        F Kiel - Berlin
        A Silesia Supports A Berlin - Prussia

        Russia:
        A Prussia - Berlin

        The fleet in Kiel will move to Berlin.
        """
        Army(self.state, 0, Nations.GERMANY, self.territories.BERLIN),
        Fleet(self.state, 0, Nations.GERMANY, self.territories.KIEL),
        Army(self.state, 0, Nations.GERMANY, self.territories.SILESIA),
        Army(self.state, 0, Nations.RUSSIA, self.territories.PRUSSIA),
        orders = [
            Move(self.state, 0, Nations.GERMANY, self.territories.BERLIN,
                 self.territories.PRUSSIA),
            Move(self.state, 0, Nations.GERMANY, self.territories.KIEL,
                 self.territories.BERLIN),
            Support(self.state, 0, Nations.GERMANY, self.territories.SILESIA,
                    self.territories.BERLIN, self.territories.PRUSSIA),
            Move(self.state, 0, Nations.RUSSIA, self.territories.PRUSSIA,
                 self.territories.BERLIN),
        ]
        process(self.state)

        self.assertTrue(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertTrue(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertTrue(orders[2].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 20
0
    def test_dislodge_of_multi_route_convoy_with_foreign_fleet(self):
        """
        When the 1971 rulebook is used "unwanted" multi-route convoys are
        possible.

        England:
        F North Sea Convoys A London - Belgium
        A London - Belgium

        Germany:
        F English Channel Convoys A London - Belgium

        France:
        F Brest Supports F Mid-Atlantic Ocean - English Channel
        F Mid-Atlantic Ocean - English Channel

        If the 1982 or 2000 rulebook is used (which I prefer), it makes no
        difference that the convoying fleet in the English Channel is German.
        It will take the convoy via the North Sea anyway and the army in London
        will end in Belgium.  However, when the 1971 rules are used, the German
        convoy is "unwanted".  According to the DPTG the German fleet should be
        ignored in the English convoy, since there is a convoy path with only
        English fleets. That means that the convoy is not disrupted and the
        English army in London will end in Belgium. See also issue 4.A.1.
        """
        pieces = [
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(self.state, 0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(self.state, 0, Nations.GERMANY,
                  self.territories.ENGLISH_CHANNEL),
            Fleet(self.state, 0, Nations.FRANCE, self.territories.BREST),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.MID_ATLANTIC),
        ]
        orders = [
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.LONDON, self.territories.BELGIUM),
            Move(self.state,
                 0,
                 Nations.ENGLAND,
                 self.territories.LONDON,
                 self.territories.BELGIUM,
                 via_convoy=True),
            Convoy(self.state, 0, Nations.GERMANY,
                   self.territories.ENGLISH_CHANNEL, self.territories.LONDON,
                   self.territories.BELGIUM),
            Support(self.state, 0, Nations.FRANCE, self.territories.BREST,
                    self.territories.MID_ATLANTIC,
                    self.territories.ENGLISH_CHANNEL),
            Move(self.state, 0, Nations.FRANCE, self.territories.MID_ATLANTIC,
                 self.territories.ENGLISH_CHANNEL),
        ]
        process(self.state)

        self.assertEqual(pieces[0].dislodged_decision, Outcomes.SUSTAINS)
        self.assertEqual(orders[1].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(pieces[2].dislodged_decision, Outcomes.DISLODGED)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 21
0
    def test_support_to_unreachable_coast_allowed(self):
        """
        A fleet can give support to a coast where it can not go.

        France:
        F Gascony - Spain(nc)
        F Marseilles Supports F Gascony - Spain(nc)

        Italy:
        F Western Mediterranean - Spain(sc)

        Although the fleet in Marseilles can not go to the north coast it can
        still support targeting the north coast. So, the support is successful,
        the move of the fleet in Gascony succeeds and the move of the Italian
        fleet fails.
        """
        pieces = [
            Fleet(Nations.FRANCE, self.territories.GASCONY),
            Fleet(Nations.FRANCE, self.territories.MARSEILLES),
            Fleet(Nations.ITALY, self.territories.WESTERN_MEDITERRANEAN)
        ]

        fleet_gascony_move = Move(Nations.FRANCE, self.territories.GASCONY, self.territories.SPAIN, self.named_coasts.SPAIN_NC)
        fleet_marseilles_support = Support(Nations.FRANCE, self.territories.MARSEILLES, self.territories.GASCONY, self.territories.SPAIN)
        fleet_western_med_move = Move(Nations.ITALY, self.territories.WESTERN_MEDITERRANEAN, self.territories.SPAIN, self.named_coasts.SPAIN_SC)

        self.state.register(*pieces, fleet_gascony_move, fleet_marseilles_support, fleet_western_med_move)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(fleet_gascony_move.move_decision, Outcomes.MOVES)
        self.assertEqual(fleet_western_med_move.move_decision, Outcomes.FAILS)
        self.assertEqual(fleet_marseilles_support.support_decision, Outcomes.GIVEN)
Exemplo n.º 22
0
    def test_support_from_unreachable_coast_not_allowed(self):
        """
        A fleet can not give support to an area that can not be reached from
        the current coast of the fleet.

        France:
        F Marseilles - Gulf of Lyon
        F Spain(nc) Supports F Marseilles - Gulf of Lyon

        Italy:
        F Gulf of Lyon Hold

        The Gulf of Lyon can not be reached from the North Coast of Spain.
        Therefore, the support of Spain is invalid and the fleet in the Gulf of
        Lyon is not dislodged.
        """
        pieces = [
            Fleet(Nations.FRANCE, self.territories.MARSEILLES),
            Fleet(Nations.FRANCE, self.territories.SPAIN, self.named_coasts.SPAIN_NC),
            Fleet(Nations.ITALY, self.territories.GULF_OF_LYON)
        ]

        fleet_marseilles_move = Move(Nations.FRANCE, self.territories.MARSEILLES, self.territories.GULF_OF_LYON)
        fleet_spain_nc_support = Support(Nations.FRANCE, self.territories.SPAIN, self.territories.MARSEILLES, self.territories.GULF_OF_LYON)
        fleet_gol_hold = Hold(Nations.ITALY, self.territories.GULF_OF_LYON)

        self.state.register(*pieces, fleet_marseilles_move, fleet_spain_nc_support, fleet_gol_hold)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(fleet_spain_nc_support.legal_decision, Outcomes.ILLEGAL)
        self.assertEqual(fleet_spain_nc_support.illegal_message, illegal_messages.S002)
        self.assertEqual(fleet_marseilles_move.move_decision, Outcomes.FAILS)
        self.assertEqual(pieces[2].dislodged_decision, Outcomes.SUSTAINS)
Exemplo n.º 23
0
    def test_support_on_unreachable_destination_not_possible(self):
        """
        The destination of the move that is supported must be reachable by the
        supporting unit.

        Austria:
        A Venice Hold

        Italy:
        F Rome Supports A Apulia - Venice
        A Apulia - Venice

        The support of Rome is illegal, because Venice can not be reached from
        Rome by a fleet. Venice is not dislodged.
        """
        Army(self.state, 0, Nations.AUSTRIA, self.territories.VENICE),
        Fleet(self.state, 0, Nations.ITALY, self.territories.ROME),
        Army(self.state, 0, Nations.ITALY, self.territories.APULIA)

        # TODO finish
        Hold(self.state, 0, Nations.AUSTRIA, self.territories.VENICE)
        fleet_rome_support = Support(self.state, 0, Nations.ITALY, self.territories.ROME, self.territories.APULIA, self.territories.VENICE)
        Move(self.state, 0, Nations.ITALY, self.territories.APULIA, self.territories.VENICE)

        process(self.state)

        self.assertTrue(fleet_rome_support.illegal)
        self.assertEqual(fleet_rome_support.illegal_code, '010')
        self.assertEqual(
            fleet_rome_support.illegal_verbose,
            'Piece cannot reach that territory.'
        )
Exemplo n.º 24
0
    def test_no_self_dislodgement_in_head_to_head_battle(self):
        """
        Self dislodgement is not allowed. This also counts for head to head
        battles.

        Germany:
        A Berlin - Kiel
        F Kiel - Berlin
        A Munich Supports A Berlin - Kiel

        No unit will move.
        """
        pieces = [
            Army(0, Nations.GERMANY, self.territories.BERLIN),
            Fleet(0, Nations.GERMANY, self.territories.KIEL),
            Army(0, Nations.GERMANY, self.territories.MUNICH),
        ]
        orders = [
            Move(0, Nations.GERMANY, self.territories.BERLIN,
                 self.territories.KIEL),
            Move(0, Nations.GERMANY, self.territories.KIEL,
                 self.territories.BERLIN),
            Support(0, Nations.GERMANY, self.territories.MUNICH,
                    self.territories.BERLIN, self.territories.KIEL),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertTrue(orders[0].outcome, Outcomes.FAILS)
        self.assertTrue(orders[1].outcome, Outcomes.FAILS)
        self.assertTrue(orders[2].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 25
0
    def test_no_help_in_dislodging_own_unit(self):
        """
        To help a foreign power to dislodge own unit in head to head battle is
        not possible.

        Germany:
        A Berlin - Kiel
        A Munich Supports F Kiel - Berlin

        England:
        F Kiel - Berlin

        No unit will move.
        """
        pieces = [
            Army(0, Nations.GERMANY, self.territories.BERLIN),
            Army(0, Nations.GERMANY, self.territories.MUNICH),
            Fleet(0, Nations.ENGLAND, self.territories.KIEL),
        ]
        orders = [
            Move(0, Nations.GERMANY, self.territories.BERLIN,
                 self.territories.KIEL),
            Support(0, Nations.GERMANY, self.territories.MUNICH,
                    self.territories.KIEL, self.territories.BERLIN),
            Move(0, Nations.ENGLAND, self.territories.KIEL,
                 self.territories.BERLIN),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertTrue(orders[0].outcome, Outcomes.FAILS)
        self.assertTrue(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertTrue(orders[2].outcome, Outcomes.FAILS)
Exemplo n.º 26
0
    def test_support_on_attack_on_own_unit_can_be_used_for_other_means(self):
        """
        A support on an attack on your own unit has still effect. It can
        prevent that another army will dislodge the unit.

        Austria:
        A Budapest - Rumania
        A Serbia Supports A Vienna - Budapest

        Italy:
        A Vienna - Budapest

        Russia:
        A Galicia - Budapest
        A Rumania Supports A Galicia - Budapest

        The support of Serbia on the Italian army prevents that the Russian
        army in Galicia will advance. No army will move.
        """
        pieces = [
            Army(0, Nations.AUSTRIA, self.territories.BUDAPEST),
            Army(0, Nations.AUSTRIA, self.territories.SERBIA),
            Army(0, Nations.ITALY, self.territories.VIENNA),
            Army(0, Nations.RUSSIA, self.territories.GALICIA),
            Army(0, Nations.RUSSIA, self.territories.RUMANIA),
        ]
        orders = [
            Move(0, Nations.AUSTRIA, self.territories.BUDAPEST,
                 self.territories.RUMANIA),
            Support(0, Nations.AUSTRIA, self.territories.SERBIA,
                    self.territories.VIENNA, self.territories.BUDAPEST),
            Move(0, Nations.ITALY, self.territories.VIENNA,
                 self.territories.BUDAPEST),
            Move(0, Nations.RUSSIA, self.territories.GALICIA,
                 self.territories.BUDAPEST),
            Support(0, Nations.RUSSIA, self.territories.RUMANIA,
                    self.territories.GALICIA, self.territories.BUDAPEST),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.FAILS)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 27
0
    def test_support_cut_on_itself_via_convoy(self):
        """
        If a unit is attacked by a supported unit, it is not possible to
        prevent dislodgement by trying to cut the support. But what, if a move
        is attempted via a convoy?

        Austria:
        F Adriatic Sea Convoys A Trieste - Venice
        A Trieste - Venice via Convoy

        Italy:
        A Venice Supports F Albania - Trieste
        F Albania - Trieste

        First it should be mentioned that if for issue 4.A.3 choice b or c is
        taken, then the move from Trieste to Venice is just a move over land,
        because the army in Venice is not moving in opposite direction. In that
        case, the support of Venice will not be cut as normal.

        In any other choice for issue 4.A.3, it should be decided whether the
        Austrian attack is considered to be coming from Trieste or from the
        Adriatic Sea. If it comes from Trieste, the support in Venice is not
        cut and the army in Trieste is dislodged by the fleet in Albania. If
        the Austrian attack is considered to be coming from the Adriatic Sea,
        then the support is cut and the army in Trieste will not be dislodged.
        See also issue 4.A.4.

        First of all, I prefer the 1982/2000 rules for adjacent convoying. This
        means that I prefer the move from Trieste uses the convoy. Furthermore,
        I think that the two Italian units are still stronger than the army in
        Trieste. Therefore, I prefer that the support in Venice is not cut and
        that the army in Trieste is dislodged by the fleet in Albania.
        """
        pieces = [
            Fleet(0, Nations.AUSTRIA, self.territories.ADRIATIC_SEA),
            Army(0, Nations.AUSTRIA, self.territories.TRIESTE),
            Army(0, Nations.ITALY, self.territories.VENICE),
            Fleet(0, Nations.ITALY, self.territories.ALBANIA),
        ]
        orders = [
            Convoy(0, Nations.AUSTRIA, self.territories.ADRIATIC_SEA,
                   self.territories.TRIESTE, self.territories.VENICE),
            Move(0,
                 Nations.AUSTRIA,
                 self.territories.TRIESTE,
                 self.territories.VENICE,
                 via_convoy=True),
            Support(0, Nations.ITALY, self.territories.VENICE,
                    self.territories.ALBANIA, self.territories.TRIESTE),
            Move(0, Nations.ITALY, self.territories.ALBANIA,
                 self.territories.TRIESTE),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(pieces[1].dislodged_decision, Outcomes.DISLODGED)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 28
0
    def test_two_unit_in_one_area_bug_with_double_convoy(self):
        """
        Similar to the previous test case, but now both units move by convoy.

        England:
        F North Sea Convoys A London - Belgium
        A Holland Supports A London - Belgium
        A Yorkshire - London
        A London - Belgium
        A Ruhr Supports A London - Belgium

        France:
        F English Channel Convoys A Belgium - London
        A Belgium - London
        A Wales Supports A Belgium - London

        Belgium and London are swapped, while the army in Yorkshire fails to
        move to London.
        """
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA),
        Army(self.state, 0, Nations.ENGLAND, self.territories.HOLLAND),
        Army(self.state, 0, Nations.ENGLAND, self.territories.YORKSHIRE),
        Army(self.state, 0, Nations.ENGLAND, self.territories.LONDON),
        Army(self.state, 0, Nations.ENGLAND, self.territories.RUHR),
        Fleet(self.state, 0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL),
        Army(self.state, 0, Nations.FRANCE, self.territories.BELGIUM),
        Army(self.state, 0, Nations.FRANCE, self.territories.WALES),
        orders = [
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA, self.territories.LONDON, self.territories.BELGIUM),
            Support(self.state, 0, Nations.ENGLAND, self.territories.HOLLAND, self.territories.LONDON, self.territories.BELGIUM),
            Move(self.state, 0, Nations.ENGLAND, self.territories.YORKSHIRE, self.territories.LONDON),
            Move(self.state, 0, Nations.ENGLAND, self.territories.LONDON, self.territories.BELGIUM, via_convoy=True),
            Support(self.state, 0, Nations.ENGLAND, self.territories.RUHR, self.territories.LONDON, self.territories.BELGIUM),
            Convoy(self.state, 0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL, self.territories.BELGIUM, self.territories.LONDON),
            Move(self.state, 0, Nations.FRANCE, self.territories.BELGIUM, self.territories.LONDON, via_convoy=True),
            Support(self.state, 0, Nations.FRANCE, self.territories.WALES, self.territories.BELGIUM, self.territories.LONDON),
        ]
        process(self.state)

        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[6].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[7].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 29
0
    def test_dislodged_multi_route_convoy(self):
        """
        When a fleet of a convoy with multiple routes is dislodged, the result
        depends on the rulebook that is used.

        England:
        F English Channel Convoys A London - Belgium
        F North Sea Convoys A London - Belgium
        A London - Belgium

        France:
        F Brest Supports F Mid-Atlantic Ocean - English Channel
        F Mid-Atlantic Ocean - English Channel

        The French fleet in Mid Atlantic Ocean will dislodge the convoying
        fleet in the English Channel. If the 1971 rules are used (see issue
        4.A.1), this will disrupt the convoy and the army will stay in London.
        When the 1982 or 2000 rulebook is used (which I prefer) the army can
        still go via the North Sea and the convoy succeeds and the London army
        will end in Belgium.
        """
        pieces = [
            Fleet(self.state, 0, Nations.ENGLAND,
                  self.territories.ENGLISH_CHANNEL),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(self.state, 0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(self.state, 0, Nations.FRANCE, self.territories.BREST),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.MID_ATLANTIC),
        ]
        orders = [
            Convoy(self.state, 0, Nations.ENGLAND,
                   self.territories.ENGLISH_CHANNEL, self.territories.LONDON,
                   self.territories.BELGIUM),
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.LONDON, self.territories.BELGIUM),
            Move(self.state,
                 0,
                 Nations.ENGLAND,
                 self.territories.LONDON,
                 self.territories.BELGIUM,
                 via_convoy=True),
            Support(self.state, 0, Nations.FRANCE, self.territories.BREST,
                    self.territories.MID_ATLANTIC,
                    self.territories.ENGLISH_CHANNEL),
            Move(self.state, 0, Nations.FRANCE, self.territories.MID_ATLANTIC,
                 self.territories.ENGLISH_CHANNEL),
        ]
        process(self.state)

        self.assertEqual(pieces[0].dislodged_decision, Outcomes.DISLODGED)
        self.assertEqual(pieces[1].dislodged_decision, Outcomes.SUSTAINS)
        self.assertEqual(orders[2].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)
Exemplo n.º 30
0
    def test_dislodge_convoying_fleet_not_on_route(self):
        """
        When the rule is used that convoys are disrupted when one of the routes
        is disrupted (see issue 4.A.1), the convoy is not necessarily disrupted
        when one of the fleets ordered to convoy is dislodged.

        England:
        F English Channel Convoys A London - Belgium
        A London - Belgium
        F Irish Sea Convoys A London - Belgium

        France:
        F North Atlantic Ocean Supports F Mid-Atlantic Ocean - Irish Sea
        F Mid-Atlantic Ocean - Irish Sea

        Even when convoys are disrupted when one of the routes is disrupted
        (see issue 4.A.1), the convoy from London to Belgium will still
        succeed, since the dislodged fleet in the Irish Sea is not part of any
        route, although it can be reached from the starting point London.
        """
        pieces = [
            Fleet(self.state, 0, Nations.ENGLAND,
                  self.territories.ENGLISH_CHANNEL),
            Army(self.state, 0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.IRISH_SEA),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.NORTH_ATLANTIC),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.MID_ATLANTIC),
        ]
        orders = [
            Convoy(self.state, 0, Nations.ENGLAND,
                   self.territories.ENGLISH_CHANNEL, self.territories.LONDON,
                   self.territories.BELGIUM),
            Move(self.state,
                 0,
                 Nations.ENGLAND,
                 self.territories.LONDON,
                 self.territories.BELGIUM,
                 via_convoy=True),
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.IRISH_SEA,
                   self.territories.LONDON, self.territories.BELGIUM),
            Support(self.state, 0, Nations.FRANCE,
                    self.territories.NORTH_ATLANTIC,
                    self.territories.MID_ATLANTIC, self.territories.IRISH_SEA),
            Move(self.state, 0, Nations.FRANCE, self.territories.MID_ATLANTIC,
                 self.territories.IRISH_SEA),
        ]
        process(self.state)

        self.assertEqual(pieces[0].dislodged_decision, Outcomes.SUSTAINS)
        self.assertEqual(orders[1].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[1].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(pieces[2].dislodged_decision, Outcomes.DISLODGED)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[4].outcome, Outcomes.SUCCEEDS)