示例#1
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)
示例#2
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)
示例#3
0
    def test_swapping_with_unintended_intent(self):
        """
        The intent is questionable.


        England:
        A Liverpool - Edinburgh
        F English Channel Convoys A Liverpool - Edinburgh

        Germany:
        A Edinburgh - Liverpool

        France:
        F Irish Sea Hold
        F North Sea Hold

        Russia:
        F Norwegian Sea Convoys A Liverpool - Edinburgh
        F North Atlantic Ocean Convoys A Liverpool - Edinburgh
        See issue 4.A.3.

        For choice a, b and c the English army in Liverpool will move by convoy
        and consequentially the two armies are swapped.

        For choice d, the 1982/2000 rulebook (which I prefer), the convoy
        depends on the "intent". England intended to convoy via the French
        fleets in the Irish Sea and the North Sea. However, the French did not
        order the convoy. The alternative route with the Russian fleets was
        unintended. The English fleet in the English Channel (with the convoy
        order) is not part of this alternative route with the Russian fleets.
        Since England still "intent" to convoy, the move from Liverpool to
        Edinburgh should be via convoy and the two armies are swapped.
        Although, you could argue that this is not really according to the
        clarification of the 2000 rulebook.

        When explicit adjacent convoying is used (DPTG, choice e), then the
        English army did not receive an order to move by convoy. So, it is just
        a head to head battle and both the army in Edinburgh and Liverpool will
        not move.
        """
        Army(self.state, 0, Nations.ENGLAND, self.territories.LIVERPOOL),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.ENGLISH_CHANNEL),
        Army(self.state, 0, Nations.GERMANY, self.territories.EDINBURGH),
        Fleet(self.state, 0, Nations.FRANCE, self.territories.IRISH_SEA),
        Fleet(self.state, 0, Nations.FRANCE, self.territories.NORTH_SEA),
        Fleet(self.state, 0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA),
        Fleet(self.state, 0, Nations.RUSSIA, self.territories.NORTH_ATLANTIC),
        orders = [
            Move(self.state, 0, Nations.ENGLAND, self.territories.LIVERPOOL, self.territories.EDINBURGH),
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.ENGLISH_CHANNEL, self.territories.LIVERPOOL, self.territories.EDINBURGH),
            Move(self.state, 0, Nations.GERMANY, self.territories.EDINBURGH, self.territories.LIVERPOOL),
            Hold(self.state, 0, Nations.FRANCE, self.territories.IRISH_SEA),
            Hold(self.state, 0, Nations.FRANCE, self.territories.NORTH_SEA),
            Convoy(self.state, 0, Nations.RUSSIA, self.territories.NORWEGIAN_SEA, self.territories.LIVERPOOL, self.territories.EDINBURGH),
            Convoy(self.state, 0, Nations.RUSSIA, self.territories.NORTH_ATLANTIC, self.territories.LIVERPOOL, self.territories.EDINBURGH),
        ]
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.FAILS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
示例#4
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)
示例#5
0
    def test_swapping_two_units_with_two_convoys(self):
        """
        Of course, two armies can also swap by when they are both convoyed.

        England:
        A Liverpool - Edinburgh via Convoy
        F North Atlantic Ocean Convoys A Liverpool - Edinburgh
        F Norwegian Sea Convoys A Liverpool - Edinburgh

        Germany:
        A Edinburgh - Liverpool via Convoy
        F North Sea Convoys A Edinburgh - Liverpool
        F English Channel Convoys A Edinburgh - Liverpool
        F Irish Sea Convoys A Edinburgh - Liverpool

        The armies in Liverpool and Edinburgh are swapped.
        """
        pieces = [
            Army(0, Nations.ENGLAND, self.territories.LIVERPOOL),
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_ATLANTIC),
            Fleet(0, Nations.ENGLAND, self.territories.NORWEGIAN_SEA),
            Army(0, Nations.GERMANY, self.territories.EDINBURGH),
            Fleet(0, Nations.GERMANY, self.territories.NORTH_SEA),
            Fleet(0, Nations.GERMANY, self.territories.ENGLISH_CHANNEL),
            Fleet(0, Nations.GERMANY, self.territories.IRISH_SEA),
        ]
        orders = [
            Move(0,
                 Nations.ENGLAND,
                 self.territories.LIVERPOOL,
                 self.territories.EDINBURGH,
                 via_convoy=True),
            Convoy(0, Nations.ENGLAND, self.territories.NORTH_ATLANTIC,
                   self.territories.LIVERPOOL, self.territories.EDINBURGH),
            Convoy(0, Nations.ENGLAND, self.territories.NORWEGIAN_SEA,
                   self.territories.LIVERPOOL, self.territories.EDINBURGH),
            Move(0,
                 Nations.GERMANY,
                 self.territories.EDINBURGH,
                 self.territories.LIVERPOOL,
                 via_convoy=True),
            Convoy(0, Nations.GERMANY, self.territories.NORTH_SEA,
                   self.territories.EDINBURGH, self.territories.LIVERPOOL),
            Convoy(0, Nations.GERMANY, self.territories.ENGLISH_CHANNEL,
                   self.territories.EDINBURGH, self.territories.LIVERPOOL),
            Convoy(0, Nations.GERMANY, self.territories.IRISH_SEA,
                   self.territories.EDINBURGH, self.territories.LIVERPOOL),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[3].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[3].outcome, Outcomes.SUCCEEDS)
示例#6
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)
示例#7
0
    def test_swapping_with_illegal_intent(self):
        """
        Can the intent made clear with an impossible order?

        England:
        F Skagerrak Convoys A Sweden - Norway
        F Norway - Sweden

        Russia:
        A Sweden - Norway
        F Gulf of Bothnia Convoys A Sweden - Norway
        See issue 4.A.3 and 4.E.1.

        If for issue 4.A.3 choice a, b or c has been taken, then the army in
        weden moves by convoy and swaps places with the fleet in Norway.

        However, if for issue 4.A.3 the 1982/2000 has been chosen (choice d),
        then the "intent" is important. The question is whether the fleet in
        the Gulf of Bothnia can express the intent. If the order for this fleet
        is considered illegal (see issue 4.E.1), then this order must be
        ignored and there is no intent to swap. In that case none of the units
        move.

        If explicit convoying is used (DPTG, choice e of issue 4.A.3) then the
        army in Sweden will take the land route and none of the units move.

        I prefer the 1982/2000 rule and that any orders that can't be valid are
        illegal. So, the order of the fleet in the Gulf of Bothnia is ignored
        and can not show the intent. There is no convoy, so no unit will move.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.SKAGERRAK),
            Fleet(0, Nations.ENGLAND, self.territories.NORWAY),
            Army(0, Nations.RUSSIA, self.territories.SWEDEN),
            Fleet(0, Nations.RUSSIA, self.territories.GULF_OF_BOTHNIA),
        ]
        orders = [
            Convoy(0, Nations.ENGLAND, self.territories.SKAGERRAK,
                   self.territories.SWEDEN, self.territories.NORWAY),
            Move(0, Nations.ENGLAND, self.territories.NORWAY,
                 self.territories.SWEDEN),
            Move(0, Nations.RUSSIA, self.territories.SWEDEN,
                 self.territories.NORWAY),
            Convoy(0, Nations.RUSSIA, self.territories.GULF_OF_BOTHNIA,
                   self.territories.SWEDEN, self.territories.NORWAY),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[1].outcome, Outcomes.FAILS)
        self.assertEqual(orders[2].outcome, Outcomes.FAILS)
示例#8
0
    def test_two_one_fleet_chains(self):
        orders = [
            Convoy(Nations.ENGLAND, self.territories.ENGLISH_CHANNEL,
                   self.territories.BELGIUM, self.territories.LONDON),
            Convoy(Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.BELGIUM, self.territories.LONDON),
        ]
        source = self.territories.BELGIUM
        target = self.territories.LONDON
        result = get_convoy_chains(source, target, orders)

        self.assertTrue([orders[0]] in [result[0].convoys, result[1].convoys])
        self.assertTrue([orders[1]] in [result[0].convoys, result[1].convoys])
示例#9
0
    def test_two_fleet_chain(self):
        orders = [
            Convoy(Nations.ENGLAND, self.territories.MID_ATLANTIC,
                   self.territories.PORTUGAL, self.territories.LONDON),
            Convoy(Nations.ENGLAND, self.territories.ENGLISH_CHANNEL,
                   self.territories.PORTUGAL, self.territories.LONDON),
        ]
        source = self.territories.PORTUGAL
        target = self.territories.LONDON
        result = get_convoy_chains(source, target, orders)

        self.assertTrue(all([o in result[0].convoys for o in orders]))
        self.assertEqual(len(result[0].convoys), 2)
        self.assertEqual(len(result), 1)
示例#10
0
    def test_disrupted_unit_swap(self):
        """
        If in a swap one of the unit bounces, then the swap fails.

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

        France:
        F English Channel Convoys A Belgium - London
        A Belgium - London
        A Burgundy - Belgium

        None of the units will succeed to move.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            Army(0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(0, Nations.FRANCE, self.territories.ENGLISH_CHANNEL),
            Army(0, Nations.FRANCE, self.territories.BELGIUM),
            Army(0, Nations.FRANCE, self.territories.BURGUNDY),
        ]
        orders = [
            Convoy(0, Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.LONDON, self.territories.BELGIUM),
            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),
            Move(0, Nations.FRANCE, self.territories.BURGUNDY,
                 self.territories.BELGIUM),
        ]

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

        self.assertEqual(orders[1].outcome, Outcomes.FAILS)
        self.assertEqual(orders[3].outcome, Outcomes.FAILS)
        self.assertEqual(orders[4].outcome, Outcomes.FAILS)
示例#11
0
    def test_two_units_can_swap_places_by_convoy(self):
        """
        The only way to swap two units, is by convoy.

        England:
        A Norway - Sweden
        F Skagerrak Convoys A Norway - Sweden

        Russia:
        A Sweden - Norway

        In most interpretation of the rules, the units in Norway and Sweden
        will be swapped. However, if explicit adjacent convoying is used (see
        issue 4.A.3), then it is just a head to head battle.

        I prefer the 2000 rules, so the units are swapped.
        """
        Army(self.state, 0, Nations.ENGLAND, self.territories.NORWAY),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.SKAGERRAK),
        Army(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN),
        orders = [
            Move(self.state, 0, Nations.ENGLAND, self.territories.NORWAY, self.territories.SWEDEN, via_convoy=True),
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.SKAGERRAK, self.territories.NORWAY, self.territories.SWEDEN),
            Move(self.state, 0, Nations.RUSSIA, self.territories.SWEDEN, self.territories.NORWAY),
        ]
        process(self.state)

        self.assertEqual(orders[0].path_decision(), Outcomes.PATH)
        self.assertEqual(orders[0].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(orders[2].outcome, Outcomes.SUCCEEDS)
示例#12
0
    def test_attacked_convoy_is_not_disrupted(self):
        """
        A convoy can only be disrupted by dislodging the fleets. Attacking is
        not sufficient.

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

        Germany:
        F Skagerrak - North Sea

        The army in London will successfully convoy and end in Holland.
        """
        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.SKAGERRAK)
        orders = [
            Convoy(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA,
                   self.territories.LONDON, self.territories.HOLLAND),
            Move(self.state,
                 0,
                 Nations.ENGLAND,
                 self.territories.LONDON,
                 self.territories.HOLLAND,
                 via_convoy=True),
            Move(self.state, 0, Nations.GERMANY, self.territories.SKAGERRAK,
                 self.territories.NORTH_SEA),
        ]
        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)
示例#13
0
 def test_two_two_fleet_chains(self):
     orders = [
         Convoy(Nations.ENGLAND, self.territories.MID_ATLANTIC,
                self.territories.PORTUGAL, self.territories.WALES),
         Convoy(Nations.ENGLAND, self.territories.ENGLISH_CHANNEL,
                self.territories.PORTUGAL, self.territories.WALES),
         Convoy(Nations.ENGLAND, self.territories.IRISH_SEA,
                self.territories.PORTUGAL, self.territories.WALES),
     ]
     source = self.territories.PORTUGAL
     target = self.territories.WALES
     result = get_convoy_chains(source, target, orders)
     self.assertTrue(
         [orders[0], orders[1]] in [result[0].convoys, result[1].convoys])
     self.assertTrue(
         [orders[0], orders[2]] in [result[0].convoys, result[1].convoys])
示例#14
0
    def test_only_armies_can_be_convoyed(self):
        """
        A fleet can not be convoyed.

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

        Move from London to Belgium should fail.
        """
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.LONDON),
        Fleet(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA),
        fleet_london_move = Move(self.state, 0, Nations.ENGLAND, self.territories.LONDON, self.territories.BELGIUM, via_convoy=True)
        fleet_north_sea_convoy = Convoy(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA, self.territories.LONDON, self.territories.BELGIUM)

        process(self.state)

        self.assertTrue(fleet_london_move.illegal)
        self.assertTrue(fleet_london_move.outcome == Outcomes.FAILS)
        self.assertEqual(fleet_london_move.illegal_code, '004')
        self.assertEqual(
            fleet_london_move.illegal_verbose,
            'Fleet cannot reach non-adjacent territory.'
        )

        self.assertTrue(fleet_north_sea_convoy.illegal)
        self.assertEqual(
            fleet_north_sea_convoy.illegal_verbose,
            'Cannot convoy a fleet.'
        )
示例#15
0
    def test_only_armies_can_be_convoyed(self):
        """
        A fleet can not be convoyed.

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

        Move from London to Belgium should fail.
        """
        pieces = [
            Fleet(Nations.ENGLAND, self.territories.LONDON),
            Fleet(Nations.ENGLAND, self.territories.NORTH_SEA),
        ]
        fleet_london_move = Move(Nations.ENGLAND,
                                 self.territories.LONDON,
                                 self.territories.BELGIUM,
                                 via_convoy=True)
        fleet_north_sea_convoy = Convoy(Nations.ENGLAND,
                                        self.territories.NORTH_SEA,
                                        self.territories.LONDON,
                                        self.territories.BELGIUM)

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

        self.assertEqual(fleet_london_move.legal_decision, Outcomes.ILLEGAL)
        self.assertEqual(fleet_london_move.illegal_message,
                         illegal_messages.M004)

        self.assertEqual(fleet_north_sea_convoy.legal_decision,
                         Outcomes.ILLEGAL)
        self.assertEqual(fleet_north_sea_convoy.illegal_message,
                         illegal_messages.C001)
示例#16
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)
示例#17
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)
示例#18
0
 def test_three_fleet_chain(self):
     orders = [
         Convoy(self.state, 0, Nations.ENGLAND,
                self.territories.MID_ATLANTIC, self.territories.PORTUGAL,
                self.territories.NORWAY),
         Convoy(self.state, 0, Nations.ENGLAND,
                self.territories.ENGLISH_CHANNEL, self.territories.PORTUGAL,
                self.territories.NORWAY),
         Convoy(self.state, 0, Nations.ENGLAND, self.territories.NORTH_SEA,
                self.territories.PORTUGAL, self.territories.NORWAY),
     ]
     source = self.territories.PORTUGAL
     target = self.territories.NORWAY
     result = get_convoy_chains(source, target, orders)
     self.assertTrue(all([o in result[0].convoys for o in orders]))
     self.assertEqual(len(result[0].convoys), 3)
     self.assertEqual(len(result), 1)
示例#19
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)
示例#20
0
 def test_one_fleet_chain(self):
     orders = [
         Convoy(Nations.ENGLAND, self.territories.ENGLISH_CHANNEL,
                self.territories.BREST, self.territories.LONDON),
     ]
     source = self.territories.BREST
     target = self.territories.LONDON
     result = get_convoy_chains(source, target, orders)
     self.assertEqual(result[0].convoys, [orders[0]])
示例#21
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)
示例#22
0
    def test_two_armies_with_two_convoys(self):
        """
        Two armies can swap places even when they are not adjacent.

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

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

        Both convoys should succeed.
        """
        pieces = [
            Fleet(0, Nations.ENGLAND, self.territories.NORTH_SEA),
            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),
            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[3].outcome, Outcomes.SUCCEEDS)
示例#23
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)
示例#24
0
    def test_swapped_or_dislodged(self):
        """
        The 1982 rulebook says that whether the move is over land or via convoy
        depends on the "intent" as shown by the totality of the orders written
        by the player governing the army (see issue 4.A.3). In this test case
        the English army in Norway will end in all cases in Sweden. But whether
        it is convoyed or not has effect on the Russian army. In case of convoy
        the Russian army ends in Norway and in case of a land route the Russian
        army is dislodged.

        England:
        A Norway - Sweden
        F Skagerrak Convoys A Norway - Sweden
        F Finland Supports A Norway - Sweden

        Russia:
        A Sweden - Norway
        See issue 4.A.3.

        For choice a, b and c the move of the army in Norway is by convoy and
        the armies in Norway and Sweden are swapped.

        If the 1982 rulebook is used with the clarification of the 2000
        rulebook (choice d, which I prefer), the intent of the English player
        is to convoy, since it ordered the fleet in Skagerrak to convoy.
        Therefore, the armies in Norway and Sweden are swapped.

        When explicit adjacent convoying is used (DTPG, choice e), then the
        unit in Norway did not receive an order to move by convoy and the land
        route should be considered. The Russian army in Sweden is dislodged.
        """
        pieces = [
            Army(0, Nations.ENGLAND, self.territories.NORWAY),
            Fleet(0, Nations.ENGLAND, self.territories.SKAGERRAK),
            Fleet(0, Nations.ENGLAND, self.territories.FINLAND),
            Army(0, Nations.RUSSIA, self.territories.SWEDEN),
        ]
        orders = [
            Move(0, Nations.ENGLAND, self.territories.NORWAY,
                 self.territories.SWEDEN),
            Convoy(0, Nations.ENGLAND, self.territories.SKAGERRAK,
                   self.territories.NORWAY, self.territories.SWEDEN),
            Support(0, Nations.ENGLAND, self.territories.FINLAND,
                    self.territories.NORWAY, self.territories.SWEDEN),
            Move(0, Nations.RUSSIA, 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[2].outcome, Outcomes.SUCCEEDS)
        self.assertEqual(pieces[3].dislodged_decision, Outcomes.DISLODGED)
示例#25
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)
示例#26
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)
示例#27
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)
示例#28
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)
示例#29
0
    def test_no_convoy_in_coastal_area(self):
        """
        A fleet in a coastal area may not convoy.

        Turkey:
        A Greece - Sevastopol
        F Aegean Sea Convoys A Greece - Sevastopol
        F Constantinople Convoys A Greece - Sevastopol
        F Black Sea Convoys A Greece - Sevastopol

        The convoy in Constantinople is not possible. So, the army in Greece
        will not move to Sevastopol.
        """
        pieces = [
            Army(0, Nations.TURKEY, self.territories.GREECE),
            Fleet(0, Nations.TURKEY, self.territories.AEGEAN_SEA),
            Fleet(0, Nations.TURKEY, self.territories.CONSTANTINOPLE),
            Fleet(0, Nations.TURKEY, self.territories.BLACK_SEA),
        ]
        orders = [
            Move(0,
                 Nations.TURKEY,
                 self.territories.GREECE,
                 self.territories.SEVASTAPOL,
                 via_convoy=True),
            Convoy(0, Nations.TURKEY, self.territories.AEGEAN_SEA,
                   self.territories.GREECE, self.territories.SEVASTAPOL),
            Convoy(0, Nations.TURKEY, self.territories.CONSTANTINOPLE,
                   self.territories.GREECE, self.territories.SEVASTAPOL),
            Convoy(0, Nations.TURKEY, self.territories.BLACK_SEA,
                   self.territories.GREECE, self.territories.SEVASTAPOL),
        ]
        self.state.register(*pieces, *orders)
        self.state.post_register_updates()
        process(self.state)

        self.assertEqual(orders[0].outcome, Outcomes.FAILS)
        self.assertTrue(orders[0].legal)
        self.assertTrue(orders[2].illegal)
示例#30
0
    def test_simple_convoy_paradox(self):
        """
        The most common paradox is when the attacked unit supports an attack on
        one of the convoying fleets.

        England:
        F London Supports F Wales - English Channel
        F Wales - English Channel

        France:
        A Brest - London
        F English Channel Convoys A Brest - London

        This situation depends on how paradoxes are handled (see issue (4.A.2).
        In case of the 'All Hold' rule (fully applied, not just as "backup"
        rule), both the movement of the English fleet in Wales as the France
        convoy in Brest are part of the paradox and fail. In all other rules of
        paradoxical convoys (including the Szykman rule which I prefer), the
        support of London is not cut. That means that the fleet in the English
        Channel is dislodged.
        """
        pieces = [
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.LONDON),
            Fleet(self.state, 0, Nations.ENGLAND, self.territories.WALES),
            Army(self.state, 0, Nations.FRANCE, self.territories.BREST),
            Fleet(self.state, 0, Nations.FRANCE,
                  self.territories.ENGLISH_CHANNEL),
        ]
        orders = [
            Support(self.state, 0, Nations.ENGLAND, self.territories.LONDON,
                    self.territories.WALES, self.territories.ENGLISH_CHANNEL),
            Move(self.state, 0, Nations.ENGLAND, self.territories.WALES,
                 self.territories.ENGLISH_CHANNEL),
            Move(self.state,
                 0,
                 Nations.FRANCE,
                 self.territories.BREST,
                 self.territories.LONDON,
                 via_convoy=True),
            Convoy(self.state, 0, Nations.FRANCE,
                   self.territories.ENGLISH_CHANNEL, self.territories.BREST,
                   self.territories.LONDON),
        ]
        process(self.state)

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