This commit is contained in:
Jocelyn Fiat
2024-06-17 09:09:33 +02:00
commit 6dde6425c2
560 changed files with 81728 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
note
description: "[
Class incapsulating the nationalities in VITP and responsible
for the creation of those attributes.
These attributes are used as pseudo-constants. I elected
not to use once features becasue the order of calls to
once featues may not work for persistence.
]"
author: "Jimmy J. Johnson"
date: "$Date$"
revision: "$Revision$"
class
NATIONALITY_CONSTANTS
feature -- Access
nobody: INTEGER_32 = -2
-- Not sure if this is useful ?
either: INTEGER_32 = -1
-- Used in SOP when either player can make a choice
japanese: INTEGER_32 = 0
-- Default, because Japanese always moves first
us: INTEGER_32 = 1
-- United States
british: INTEGER_32 = 2
-- An allied nationality
dutch: INTEGER_32 = 3
-- An allied nationality
australian: INTEGER_32 = 4
-- An allied nationality
allied: INTEGER_32 = 5
-- Catch-all for `us', `british', `dutch', and `australian'
feature -- Query
is_allied_nationality (a_nationality: like japanese): BOOLEAN
-- Is `a_nationality' one of the allies?
do
Result := a_nationality >= us
end
end

View File

@@ -0,0 +1,69 @@
note
description: "[
Class incapsulating each {LOCATION} in VITP that is not a
{SEA_AREA} or {PORT} but needed by the game and responsible for
the creation of those attributes. Decomposed into this class
so that {VITP_GAME} would not be such a large file.
These attributes are used as pseudo-constants. I elected
not to use once features becasue the order of calls to
once featues may not work for persistence.
]"
author: "Jimmy J. Johnson"
date: "$Date$"
revision: "$Revision$"
deferred class
OTHER_ATTRIBUTES
inherit
ANY
redefine
default_create
end
feature {NONE} -- Initialization
default_create
-- Initialize all port attributes
do
-- create still_in_box.make (game)
-- create Allied_starting_chart.make (game)
-- create Allied_oa_chart.make (game)
-- create Japanese_oa_chart.make (game)
-- create Uncertain.make (game)
-- create Uncommitted_japanese_location.make (game)
-- create Uncommitted_allied_location.make (game)
-- create Asia.make (game)
-- create Kamchatka.make (game)
-- create Aleutians.make (game)
-- create Solomans.make (game)
-- create Marshalls_north.make (game)
-- create Marshalls_south.make (game)
end
feature -- Access
game: VITP_GAME
-- The game in which this item belongs.
deferred
end
feature -- Access
still_in_box: STILL_IN_BOX attribute create Result.make (game) end
allied_starting_forces_chart: ALLIED_STARTING_FORCES_CHART attribute create Result.make (game) end
allied_oa_chart: ALLIED_ORDER_OF_APPEARANCE_CHART attribute create Result.make (game) end
japanese_oa_chart: JAPANESE_ORDER_OF_APPEARANCE_CHART attribute create Result.make (game) end
uncertain: LOCATION_UNCERTAIN attribute create Result.make (game) end
uncommitted_japanese_location: JAPANESE_UNCOMMITTED_LOCATION attribute create Result.make (game) end
uncommitted_allied_location: ALLIED_UNCOMMITTED_LOCATION attribute create Result.make (game) end
-- Asia: ASIA attribute create Result.make (game) end
-- Kamchatka: KAMCHATKA attribute create Result.make (game) end
-- Aleutians: ALEUTIANS attribute create Result.make (game) end
-- Solomans: SOLOMANS attribute create Result.make (game) end
-- Marshalls_north: MARSHALLS_NORTH attribute create Result.make (game) end
-- Marshalls_south: MARSHALLS_SOUTH attribute create Result.make (game) end
end

View File

@@ -0,0 +1,146 @@
note
description: "[
Class incapsulating each {PORT} in VITP and responsible for
the creation of those attributes. Decomposed into this class
so that {VITP_GAME} would not be such a large file.
These attributes are used as pseudo-constants. I elected
not to use once features becasue the order of calls to
once featues may not work for persistence.
]"
author: "Jimmy J. Johnson"
date: "$Date$"
revision: "$Revision$"
deferred class
PORT_ATTRIBUTES
feature -- Access
game: VITP_GAME
-- The game in which this item belongs.
deferred
end
default_port: DEFAULT_PORT attribute create Result.make (game) end
-- A {PORT} for use where no other applies.
feature -- Access (major ports)
australia: AUSTRALIA attribute create Result.make (game) end
ceylon: CEYLON attribute create Result.make (game) end
pearl_harbor: PEARL_HARBOR attribute create Result.make (game) end
saigon: SAIGON attribute create Result.make (game) end
samoa: SAMOA attribute create Result.make (game) end
singapore: SINGAPORE attribute create Result.make (game) end
truk: TRUK attribute create Result.make (game) end
yokosuka_navy_yard: YOKOSUKA_NAVY_YARD attribute create Result.make (game) end
feature -- Access (minor ports)
andaman_islands: ANDAMAN_ISLANDS attribute create Result.make (game) end
attu: ATTU attribute create Result.make (game) end
dutch_harbor: DUTCH_HARBOR attribute create Result.make (game) end
johnston_island: JOHNSTON_ISLAND attribute create Result.make (game) end
guadalcanal: GUADALCANAL attribute create Result.make (game) end
kwajalein: KWAJALEIN attribute create Result.make (game) end
lae: LAE attribute create Result.make (game) end
maloelap: MALOELAP attribute create Result.make (game) end
midway: MIDWAY attribute create Result.make (game) end
new_hebrides: NEW_HEBRIDES attribute create Result.make (game) end
okinawa: OKINAWA attribute create Result.make (game) end
philippines: PHILIPPINES attribute create Result.make (game) end
port_moresby: PORT_MORESBY attribute create Result.make (game) end
saipan: SAIPAN attribute create Result.make (game) end
feature -- Access (port groups)
ports: VITP_TABLE [PORT]
-- Convenience feature containing all the major (red) pots on the board
attribute
create Result.make (major_ports.count + minor_ports.count)
Result.merge (major_ports)
Result.merge (minor_ports)
end
major_ports: VITP_TABLE [RED_PORT]
-- Convenience feature containing all the major (red) pots on the board
attribute
create Result.make (8)
Result.extend (Australia, Australia.name)
Result.extend (Ceylon, Ceylon.name)
Result.extend (Pearl_harbor, Pearl_harbor.name)
Result.extend (Saigon, Saigon.name)
Result.extend (Samoa, Samoa.name)
Result.extend (Singapore, Singapore.name)
Result.extend (Truk, Truk.name)
Result.extend (Yokosuka_navy_yard, Yokosuka_navy_yard.name)
end
minor_ports: VITP_TABLE [GREEN_PORT]
-- Convenience feature containing all the minor (green) ports on the board
attribute
create Result.make (14)
Result.extend (Andaman_islands, Andaman_islands.name)
Result.extend (Attu, Attu.name)
Result.extend (Dutch_harbor, Dutch_harbor.name)
Result.extend (Johnston_island, Johnston_island.name)
Result.extend (Guadalcanal, Guadalcanal.name)
Result.extend (Kwajalein, Kwajalein.name)
Result.extend (Lae, Lae.name)
Result.extend (Maloelap, Maloelap.name)
Result.extend (Midway, Midway.name)
Result.extend (New_hebrides, New_hebrides.name)
Result.extend (Okinawa, Okinawa.name)
Result.extend (Philippines, Philippines.name)
Result.extend (Port_moresby, Port_moresby.name)
Result.extend (Saipan, Saipan.name)
end
island_ports: VITP_TABLE [PORT]
-- Convenience feature containig all the island ports
attribute
create Result.make (15)
Result.extend (Andaman_islands, Andaman_islands.name)
Result.extend (Attu, Attu.name)
Result.extend (Ceylon, Ceylon.name)
Result.extend (Dutch_harbor, Dutch_harbor.name)
Result.extend (Johnston_island, Johnston_island.name)
Result.extend (Guadalcanal, Guadalcanal.name)
Result.extend (Kwajalein, Kwajalein.name)
Result.extend (Maloelap, Maloelap.name)
Result.extend (Midway, Midway.name)
Result.extend (New_hebrides, New_hebrides.name)
Result.extend (Okinawa, Okinawa.name)
Result.extend (Pearl_harbor, Pearl_harbor.name)
Result.extend (Saipan, Saipan.name)
Result.extend (Samoa, Samoa.name)
Result.extend (Truk, Truk.name)
end
feature -- Query
friendly_ports (a_nationality: like {NATIONALITY_CONSTANTS}.japanese): VITP_TABLE [PORT]
-- All ports and island bases controlled by `a_nationality'
local
p: PORT
do
create Result.make (ports.count)
from ports.start
until ports.after
loop
p := ports.item_for_iteration
if p.nationality = a_nationality then
Result.extend (p, p.name)
end
ports.forth
end
end
invariant
port_count_correct: ports.count = 22
major_port_count_correct: major_ports.count = 8
minor_port_count_correct: minor_ports.count = 14
island_port_count_correct: island_ports.count = 15
end

View File

@@ -0,0 +1,79 @@
note
description: "[
Class incapsulating each {SEA_AREA} in VITP and responsible for
the creation of those attributes. Decomposed into this class
so that {VITP_GAME} would not be such a large file.
These attributes are used as pseudo-constants. I elected
not to use once features becasue the order of calls to
once featues may not work for persistence.
]"
author: "Jimmy J. Johnson"
date: "$Date$"
revision: "$Revision$"
deferred class
SEA_AREA_ATTRIBUTES
feature -- Access
game: VITP_GAME
-- The game in which this item belongs.
deferred
end
feature -- Access (sea areas)
Aleutian_islands: ALEUTIAN_ISLANDS attribute create Result.make (game) end
Bay_of_bengal: BAY_OF_BENGAL attribute create Result.make (game) end
Central_pacific_ocean: CENTRAL_PACIFIC_OCEAN attribute create Result.make (game) end
Coral_Sea: CORAL_SEA attribute create Result.make (game) end
Hawaiian_islands: HAWAIIAN_ISLANDS attribute create Result.make (game) end
Indian_ocean: INDIAN_OCEAN attribute create Result.make (game) end
Indonesia: INDONESIA attribute create Result.make (game) end
Japanese_islands: JAPANESE_ISLANDS attribute create Result.make (game) end
Marianas_islands: MARIANAS_ISLANDS attribute create Result.make (game) end
Marshall_islands: MARSHALL_ISLANDS attribute create Result.make (game) end
North_pacific_ocean: NORTH_PACIFIC_OCEAN attribute create Result.make (game) end
South_pacific_ocean: SOUTH_PACIFIC_OCEAN attribute create Result.make (game) end
US_mandate: US_MANDATE attribute create Result.make (game) end
feature -- Access (groups)
sea_areas: VITP_TABLE [SEA_AREA]
-- Convenience feature containing all the sea areas on the board
attribute
create Result.make (13)
Result.extend (Aleutian_islands, Aleutian_islands.name)
Result.extend (Bay_of_bengal, Bay_of_bengal.name)
Result.extend (Central_pacific_ocean, Central_pacific_ocean.name)
Result.extend (Coral_sea, Coral_sea.name)
Result.extend (Hawaiian_islands, Hawaiian_islands.name)
Result.extend (Indian_ocean, Indian_ocean.name)
Result.extend (Indonesia, Indonesia.name)
Result.extend (Japanese_islands, Japanese_islands.name)
Result.extend (Marianas_islands, Marianas_islands.name)
Result.extend (Marshall_islands, Marshall_islands.name)
Result.extend (North_pacific_ocean, North_pacific_ocean.name)
Result.extend (South_pacific_ocean, South_pacific_ocean.name)
Result.extend (US_mandate, US_mandate.name)
end
contested_areas: LINKED_SET [SEA_AREA]
-- Sea areas that contain both Japanese and Allied units
local
s: SEA_AREA
do
create Result.make
from Sea_areas.start
until Sea_areas.after
loop
s := Sea_areas.item_for_iteration
if s.is_contested then
Result.extend (s)
end
Sea_areas.forth
end
end
end