init
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
note
|
||||
description: "[
|
||||
An {AMPHIBIOUS_UNIT} belonging to the Allied player in VITP
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2024, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
ALLIED_AMPHIBIOUS_UNIT
|
||||
|
||||
inherit
|
||||
|
||||
ALLIED_UNIT
|
||||
undefine
|
||||
patrol_distance,
|
||||
raid_distance,
|
||||
arrival_location,
|
||||
landable_ports,
|
||||
internal_is_movable
|
||||
end
|
||||
|
||||
AMPHIBIOUS_UNIT
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "[
|
||||
A {SUBMARINE} belonging to the Allied player
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2024, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
ALLIED_SUBMARINE
|
||||
|
||||
inherit
|
||||
|
||||
ALLIED_UNIT
|
||||
undefine
|
||||
patrol_distance,
|
||||
raid_distance,
|
||||
arrival_location,
|
||||
landable_ports,
|
||||
internal_is_movable,
|
||||
join_force,
|
||||
leave_force
|
||||
end
|
||||
|
||||
SUBMARINE
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,61 @@
|
||||
note
|
||||
description: "[
|
||||
An {ATTACK_UNIT} that belongs to the Allies.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2024, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
ALLIED_UNIT
|
||||
|
||||
inherit
|
||||
|
||||
ATTACK_UNIT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize attributes of Current
|
||||
do
|
||||
PRECURSOR {ATTACK_UNIT} (a_game)
|
||||
nationality := game.us
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
local
|
||||
sop: VITP_SEQUENCE_OF_PLAY
|
||||
mp: VITP_TABLE [RED_PORT]
|
||||
do
|
||||
-- io.put_string ("ALLIED_UNIT.reinforceable_ports: %N")
|
||||
create Result.make
|
||||
sop := game.sequence_of_play
|
||||
mp := game.major_ports
|
||||
if sop.is_reinforcement_step then
|
||||
from mp.start
|
||||
until mp.after
|
||||
loop
|
||||
if mp.item_for_iteration.is_allied then
|
||||
Result.extend (mp.item_for_iteration)
|
||||
end
|
||||
mp.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
is_allied: nationality = game.us or
|
||||
nationality = game.british or
|
||||
nationality = game.australian or
|
||||
nationality = game.dutch
|
||||
|
||||
end
|
@@ -0,0 +1,46 @@
|
||||
note
|
||||
description: "[
|
||||
An {SHIP} whose `nationality' is Australian
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2021, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
AUSTRALIAN_SHIP
|
||||
|
||||
inherit
|
||||
|
||||
ALLIED_SHIP
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize attributes of Current
|
||||
do
|
||||
PRECURSOR {ALLIED_SHIP} (a_game)
|
||||
nationality := game.australian
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
do
|
||||
create Result.make
|
||||
if game.sequence_of_play.is_allied_player then
|
||||
if game.australia.is_allied then
|
||||
Result.extend (game.australia)
|
||||
end
|
||||
end
|
||||
end
|
||||
invariant
|
||||
|
||||
is_australian: nationality = {NATIONALITY_CONSTANTS}.australian
|
||||
|
||||
end
|
@@ -0,0 +1,47 @@
|
||||
note
|
||||
description: "[
|
||||
An {SHIP} whose `nationality' is British
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2021, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
BRITISH_SHIP
|
||||
|
||||
inherit
|
||||
|
||||
ALLIED_SHIP
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize attributes of Current
|
||||
do
|
||||
PRECURSOR {ALLIED_SHIP} (a_game)
|
||||
nationality := game.british
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
do
|
||||
create Result.make
|
||||
if game.sequence_of_play.is_allied_player then
|
||||
if game.ceylon.is_allied then
|
||||
Result.extend (game.ceylon)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
is_british: nationality = {NATIONALITY_CONSTANTS}.british
|
||||
|
||||
end
|
@@ -0,0 +1,48 @@
|
||||
note
|
||||
description: "[
|
||||
Any {ALLIED_UNIT} belonging to the Dutch
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2023, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
DUTCH_SHIP
|
||||
|
||||
inherit
|
||||
|
||||
ALLIED_SHIP
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize attributes of Current
|
||||
do
|
||||
PRECURSOR {ALLIED_SHIP} (a_game)
|
||||
nationality := game.dutch
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
do
|
||||
create Result.make
|
||||
if game.sequence_of_play.is_allied_player then
|
||||
if game.singapore.is_allied then
|
||||
Result.extend (game.singapore)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
is_allied: nationality = {NATIONALITY_CONSTANTS}.dutch
|
||||
|
||||
end
|
||||
|
@@ -0,0 +1,54 @@
|
||||
note
|
||||
description: "[
|
||||
An {SHIP} that belongs to the Japanese.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2024, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
JAPANESE_SHIP
|
||||
|
||||
inherit
|
||||
|
||||
JAPANESE_UNIT
|
||||
undefine
|
||||
reinforceable_ports,
|
||||
internal_is_movable,
|
||||
is_bottomed
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
SHIP
|
||||
undefine
|
||||
-- reinforceable_ports
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize attributes of Current
|
||||
do
|
||||
PRECURSOR {SHIP} (a_game)
|
||||
nationality := game.japanese
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
do
|
||||
create Result.make
|
||||
if game.sequence_of_play.is_japanese_player then
|
||||
if game.yokosuka_navy_yard.is_japanese then
|
||||
Result.extend (game.yokosuka_navy_yard)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "[
|
||||
A {SUBMARINE} belonging to the Allied player
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2024, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
JAPANESE_SUBMARINE
|
||||
|
||||
inherit
|
||||
|
||||
JAPANESE_UNIT
|
||||
undefine
|
||||
patrol_distance,
|
||||
raid_distance,
|
||||
arrival_location,
|
||||
landable_ports,
|
||||
internal_is_movable,
|
||||
join_force,
|
||||
leave_force
|
||||
end
|
||||
|
||||
SUBMARINE
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,55 @@
|
||||
note
|
||||
description: "[
|
||||
An {ATTACK_UNIT} that belongs to the Japanese.
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2024, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
JAPANESE_UNIT
|
||||
|
||||
inherit
|
||||
|
||||
ATTACK_UNIT
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_game: like game)
|
||||
-- Initialize attributes of Current
|
||||
do
|
||||
PRECURSOR {ATTACK_UNIT} (a_game)
|
||||
nationality := game.japanese
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
local
|
||||
sop: VITP_SEQUENCE_OF_PLAY
|
||||
mp: VITP_TABLE [RED_PORT]
|
||||
do
|
||||
-- io.put_string ("ALLIED_UNIT.reinforceable_ports: %N")
|
||||
create Result.make
|
||||
mp := game.major_ports
|
||||
from mp.start
|
||||
until mp.after
|
||||
loop
|
||||
if mp.item_for_iteration.is_japanese then
|
||||
Result.extend (mp.item_for_iteration)
|
||||
end
|
||||
mp.forth
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
is_japanese: nationality = game.japanese
|
||||
|
||||
end
|
37
jj_vitp/Implementation/classes/units/attack_units/us_ship.e
Normal file
37
jj_vitp/Implementation/classes/units/attack_units/us_ship.e
Normal file
@@ -0,0 +1,37 @@
|
||||
note
|
||||
description: "[
|
||||
An {SHIP} whose `nationality' is United States
|
||||
]"
|
||||
author: "Jimmy J. Johnson"
|
||||
date: "5/12/24"
|
||||
copyright: "Copyright (c) 2021, Jimmy J. Johnson"
|
||||
license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
deferred class
|
||||
US_SHIP
|
||||
|
||||
inherit
|
||||
|
||||
ALLIED_SHIP
|
||||
|
||||
feature -- Access
|
||||
|
||||
reinforceable_ports: LINKED_SET [PORT]
|
||||
-- A list containing each {PORT} to which Current
|
||||
-- can be moved during the reinforcement step.
|
||||
do
|
||||
create Result.make
|
||||
if game.sequence_of_play.is_allied_player then
|
||||
if game.hawaiian_islands.is_allied then
|
||||
Result.extend (game.pearl_harbor)
|
||||
elseif game.samoa.is_allied then
|
||||
Result.extend (game.samoa)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
is_unitied_states: nationality = {NATIONALITY_CONSTANTS}.us
|
||||
|
||||
end
|
Reference in New Issue
Block a user