init
This commit is contained in:
49
jj_vitp/Implementation/classes/ports/Andaman_islands.e
Normal file
49
jj_vitp/Implementation/classes/ports/Andaman_islands.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
ANDAMAN_ISLANDS
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [20, 220]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Andaman Islands"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.bay_of_bengal)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/Attu.e
Normal file
49
jj_vitp/Implementation/classes/ports/Attu.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
ATTU
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [540, 30]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Attu"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.aleutian_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
50
jj_vitp/Implementation/classes/ports/Lae.e
Normal file
50
jj_vitp/Implementation/classes/ports/Lae.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
LAE
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [310, 380]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Lae"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.indonesia)
|
||||
s.extend (game.south_pacific_ocean)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
63
jj_vitp/Implementation/classes/ports/Pearl_harbor.e
Normal file
63
jj_vitp/Implementation/classes/ports/Pearl_harbor.e
Normal file
@@ -0,0 +1,63 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
PEARL_HARBOR
|
||||
|
||||
inherit
|
||||
|
||||
REPAIR_PORT
|
||||
undefine
|
||||
distance_to
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor {REPAIR_PORT} (a_game)
|
||||
Precursor {RED_PORT} (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [670, 320]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Pearl Harbor"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER
|
||||
-- Number of repair points for the player
|
||||
do
|
||||
Result := ((game.sequence_of_play.turn - 1) * 3).min (15)
|
||||
end
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.hawaiian_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
52
jj_vitp/Implementation/classes/ports/Saigon.e
Normal file
52
jj_vitp/Implementation/classes/ports/Saigon.e
Normal file
@@ -0,0 +1,52 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
SAIGON
|
||||
|
||||
inherit
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.japanese
|
||||
defining_position := [130, 230]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Saigon"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER = 0
|
||||
-- Number of repair points for the player
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.indonesia)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
65
jj_vitp/Implementation/classes/ports/Samoa.e
Normal file
65
jj_vitp/Implementation/classes/ports/Samoa.e
Normal file
@@ -0,0 +1,65 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
SAMOA
|
||||
|
||||
inherit
|
||||
|
||||
REPAIR_PORT
|
||||
undefine
|
||||
distance_to
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor {REPAIR_PORT} (a_game)
|
||||
Precursor {RED_PORT} (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [590, 510]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Samoa"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER
|
||||
-- Number of repair points for the player
|
||||
do
|
||||
if is_allied and game.pearl_harbor.is_japanese then
|
||||
Result := ((game.sequence_of_play.turn - 1) * 3).min (15)
|
||||
end
|
||||
end
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.us_mandate)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
52
jj_vitp/Implementation/classes/ports/Singapore.e
Normal file
52
jj_vitp/Implementation/classes/ports/Singapore.e
Normal file
@@ -0,0 +1,52 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
SINGAPORE
|
||||
|
||||
inherit
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [90, 280]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Singapore"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER = 0
|
||||
-- Number of repair points for the player
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.indonesia)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
54
jj_vitp/Implementation/classes/ports/Truk.e
Normal file
54
jj_vitp/Implementation/classes/ports/Truk.e
Normal file
@@ -0,0 +1,54 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
TRUK
|
||||
|
||||
inherit
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.japanese
|
||||
defining_position := [390, 310]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Truk"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER = 0
|
||||
-- Number of repair points for the player
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.marianas_islands)
|
||||
s.extend (game.marshall_islands)
|
||||
s.extend (game.south_pacific_ocean)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
80
jj_vitp/Implementation/classes/ports/australia.e
Normal file
80
jj_vitp/Implementation/classes/ports/australia.e
Normal file
@@ -0,0 +1,80 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
AUSTRALIA
|
||||
|
||||
inherit
|
||||
|
||||
REPAIR_PORT
|
||||
undefine
|
||||
distance_to
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make,
|
||||
distance_to
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor {REPAIR_PORT} (a_game)
|
||||
Precursor {RED_PORT} (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [300, 470]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Australia"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER
|
||||
-- Number of repair points
|
||||
do
|
||||
if is_allied then
|
||||
Result := 1
|
||||
end
|
||||
end
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.coral_sea)
|
||||
s.extend (game.indian_ocean)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
distance_to (other: LOCATION): INTEGER
|
||||
-- The distance between Current and `other'
|
||||
do
|
||||
io.put_string (generating_type.name + ".distance_to: fix me %N")
|
||||
-- if game.phase = game.movement_phase then
|
||||
-- if other = game.indian_ocean or other = game.coral_sea then
|
||||
-- Result := 1
|
||||
-- end
|
||||
-- else
|
||||
-- Result := Precursor {RED_PORT} (other)
|
||||
-- end
|
||||
end
|
||||
|
||||
end
|
65
jj_vitp/Implementation/classes/ports/ceylon.e
Normal file
65
jj_vitp/Implementation/classes/ports/ceylon.e
Normal file
@@ -0,0 +1,65 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
CEYLON
|
||||
|
||||
inherit
|
||||
|
||||
REPAIR_PORT
|
||||
undefine
|
||||
distance_to
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor {REPAIR_PORT} (a_game)
|
||||
Precursor {RED_PORT} (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [20, 180]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Ceylon"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER
|
||||
-- Number of repair points
|
||||
do
|
||||
if is_allied then
|
||||
Result := 1
|
||||
end
|
||||
end
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.bay_of_bengal)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
50
jj_vitp/Implementation/classes/ports/default_port.e
Normal file
50
jj_vitp/Implementation/classes/ports/default_port.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "[
|
||||
{PORT} to be used as place holder when a unit is not in the game.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
DEFAULT_PORT
|
||||
|
||||
inherit
|
||||
|
||||
PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.nobody
|
||||
defining_position := [0, 0]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Default Port"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
feature -- Access
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/dutch_harbor.e
Normal file
49
jj_vitp/Implementation/classes/ports/dutch_harbor.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
DUTCH_HARBOR
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [670, 70]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Dutch Harbor"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.aleutian_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
14
jj_vitp/Implementation/classes/ports/green_port.e
Normal file
14
jj_vitp/Implementation/classes/ports/green_port.e
Normal file
@@ -0,0 +1,14 @@
|
||||
note
|
||||
description: "[
|
||||
A {PORT} in VITP that does not have repair capabilities.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
deferred class
|
||||
GREEN_PORT
|
||||
|
||||
inherit
|
||||
|
||||
PORT
|
||||
|
||||
end
|
50
jj_vitp/Implementation/classes/ports/guadalcanal.e
Normal file
50
jj_vitp/Implementation/classes/ports/guadalcanal.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
GUADALCANAL
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [400, 450]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Guadalcanal"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.coral_sea)
|
||||
s.extend (game.south_pacific_ocean)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/johnston_island.e
Normal file
49
jj_vitp/Implementation/classes/ports/johnston_island.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
JOHNSTON_ISLAND
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [640, 370]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Johnston Island"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.hawaiian_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/kwajalein.e
Normal file
49
jj_vitp/Implementation/classes/ports/kwajalein.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
KWAJALEIN
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [470, 350]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Kwajalein"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.marshall_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/maloelap.e
Normal file
49
jj_vitp/Implementation/classes/ports/maloelap.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
MALOELAP
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [530, 350]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Maloelap"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.marshall_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/midway.e
Normal file
49
jj_vitp/Implementation/classes/ports/midway.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
MIDWAY
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [560, 220]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Midway"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.central_pacific_ocean)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
50
jj_vitp/Implementation/classes/ports/new_hebrides.e
Normal file
50
jj_vitp/Implementation/classes/ports/new_hebrides.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
NEW_HEBRIDES
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [450, 510]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "New Hebrides"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.coral_sea)
|
||||
s.extend (game.us_mandate)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/okinawa.e
Normal file
49
jj_vitp/Implementation/classes/ports/okinawa.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
OKINAWA
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.japanese
|
||||
defining_position := [290, 180]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Okinawa"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.japanese_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
50
jj_vitp/Implementation/classes/ports/philippines.e
Normal file
50
jj_vitp/Implementation/classes/ports/philippines.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
PHILIPPINES
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [220, 260]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Philippines"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.indonesia)
|
||||
s.extend (game.marianas_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
17
jj_vitp/Implementation/classes/ports/port.e
Normal file
17
jj_vitp/Implementation/classes/ports/port.e
Normal file
@@ -0,0 +1,17 @@
|
||||
note
|
||||
description: "Any port in VITP."
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
deferred class
|
||||
PORT
|
||||
|
||||
inherit
|
||||
|
||||
LOCATION
|
||||
|
||||
feature -- Access
|
||||
|
||||
feature -- Status report
|
||||
|
||||
|
||||
end
|
50
jj_vitp/Implementation/classes/ports/port_moresby.e
Normal file
50
jj_vitp/Implementation/classes/ports/port_moresby.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
PORT_MORESBY
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [300, 400]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Port Moresby"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.coral_sea)
|
||||
s.extend (game.indian_ocean)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
31
jj_vitp/Implementation/classes/ports/red_port.e
Normal file
31
jj_vitp/Implementation/classes/ports/red_port.e
Normal file
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "[
|
||||
A "major" port {VITP_GAME}.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
deferred class
|
||||
RED_PORT
|
||||
|
||||
inherit
|
||||
|
||||
PORT
|
||||
redefine
|
||||
distance_to
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
distance_to (other: LOCATION): INTEGER
|
||||
-- The distance between Current and `other'
|
||||
do
|
||||
-- if vitp.phase = {GAME_SEQUENCE}.returning_to_base and then
|
||||
-- vitp.major_ports.has (other.name) and
|
||||
-- not other.is_enemy_controlled (nationality) then
|
||||
-- Result := 0
|
||||
-- else
|
||||
-- Result := Precursor (other)
|
||||
-- end
|
||||
end
|
||||
|
||||
end
|
58
jj_vitp/Implementation/classes/ports/repair_port.e
Normal file
58
jj_vitp/Implementation/classes/ports/repair_port.e
Normal file
@@ -0,0 +1,58 @@
|
||||
note
|
||||
description: "[
|
||||
A {PORT} in {VITP_GAME} which [possibly] has repair capability.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "11/11/23"
|
||||
copyright: "Copyright (c) 2021, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
REPAIR_PORT
|
||||
|
||||
inherit
|
||||
|
||||
PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
create dry_dock.make (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
repair_points: INTEGER
|
||||
-- Number of repair points available at this port
|
||||
deferred
|
||||
end
|
||||
|
||||
repair_points_used: INTEGER
|
||||
-- Total repair points assigned to ships
|
||||
do
|
||||
from dry_dock.start
|
||||
until dry_dock.after
|
||||
loop
|
||||
Result := Result + dry_dock.item.points
|
||||
dry_dock.forth
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
dry_dock: ARRAYED_LIST [TUPLE [ship: SHIP; points: INTEGER]]
|
||||
-- Contains the ships to be repaired along with the repair
|
||||
-- points assigned to that ship on this turn.
|
||||
|
||||
|
||||
invariant
|
||||
|
||||
repair_points_not_exceeded: repair_points_used <= repair_points
|
||||
|
||||
end
|
49
jj_vitp/Implementation/classes/ports/saipan.e
Normal file
49
jj_vitp/Implementation/classes/ports/saipan.e
Normal file
@@ -0,0 +1,49 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
SAIPAN
|
||||
|
||||
inherit
|
||||
|
||||
GREEN_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.us
|
||||
defining_position := [380, 260]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Saipan"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.marianas_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
65
jj_vitp/Implementation/classes/ports/yokosuka_navy_yard.e
Normal file
65
jj_vitp/Implementation/classes/ports/yokosuka_navy_yard.e
Normal file
@@ -0,0 +1,65 @@
|
||||
note
|
||||
description: "[
|
||||
Describes this particular port
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
|
||||
class
|
||||
YOKOSUKA_NAVY_YARD
|
||||
|
||||
inherit
|
||||
|
||||
REPAIR_PORT
|
||||
undefine
|
||||
distance_to
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
RED_PORT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Set up Current
|
||||
do
|
||||
Precursor {REPAIR_PORT} (a_game)
|
||||
Precursor {RED_PORT} (a_game)
|
||||
nationality := {NATIONALITY_CONSTANTS}.Japanese
|
||||
defining_position := [300, 130]
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING_8 = "Yokosuka Navy Yard"
|
||||
-- This name of this item.
|
||||
|
||||
defining_position: TUPLE [x, y: INTEGER_32]
|
||||
-- The x- and y-coordinate (in millimeters) of Current's
|
||||
-- position relative to the top-left corner of the board.
|
||||
|
||||
repair_points: INTEGER
|
||||
-- Number of repair points for the player
|
||||
do
|
||||
if is_japanese then
|
||||
Result := 6
|
||||
end
|
||||
end
|
||||
|
||||
adjacent_sea_areas: LINEAR [SEA_AREA]
|
||||
-- A list of all sea areas that touch this location
|
||||
local
|
||||
s: LINKED_SET [SEA_AREA]
|
||||
once
|
||||
create s.make
|
||||
s.extend (game.japanese_islands)
|
||||
Result := s.linear_representation
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user