Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
c03c7c1f
Commit
c03c7c1f
authored
3 years ago
by
KReynolds
Browse files
Options
Downloads
Patches
Plain Diff
Homework 3: a space battle between two craft using DIS example template.
parent
02b4df14
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignments/src/MV3500Cohort2021JulySeptember/homework3/Reynolds/ExampleSimulationProgramReynolds.java
+11
-13
11 additions, 13 deletions
.../homework3/Reynolds/ExampleSimulationProgramReynolds.java
with
11 additions
and
13 deletions
assignments/src/MV3500Cohort2021JulySeptember/homework3/Reynolds/ExampleSimulationProgramReynolds.java
+
11
−
13
View file @
c03c7c1f
...
@@ -3,9 +3,8 @@
...
@@ -3,9 +3,8 @@
* This work is provided under a BSD open-source license, see project license.html and license.txt
* This work is provided under a BSD open-source license, see project license.html and license.txt
*
*
* This Program is a modified version of ExampleSimulationProgram in order to see the
* This Program is a modified version of ExampleSimulationProgram in order to see the
* verbose plain text pdu log. This simulates a firewall identifying a malicious packet
* verbose plain text pdu log. This simulates a battle between two opposing
* and tracing its source before destroying it - updated September 12, 2021 to ensure
* spacecraft traveling toward each other at an equal rate.
* correct file pushed to Gitlab.
*
*
* @author snapp
* @author snapp
*/
*/
...
@@ -36,7 +35,7 @@ public class ExampleSimulationProgramReynolds {
...
@@ -36,7 +35,7 @@ public class ExampleSimulationProgramReynolds {
String
DEFAULT_OUTPUT_DIRECTORY
=
"./pduLog"
;
String
DEFAULT_OUTPUT_DIRECTORY
=
"./pduLog"
;
private
EntityID
createFriendSpaceCraft
()
{
private
EntityID
createFriendSpaceCraft
()
{
EntityID
FNSPaceCraftID
=
new
EntityID
();
// 1.1.225.1.1.1 Platform,Cyber,USA,
FireWall
EntityID
FNSPaceCraftID
=
new
EntityID
();
// 1.1.225.1.1.1 Platform,Cyber,USA,
SpaceCraft
FNSPaceCraftID
.
setSiteID
(
1
);
FNSPaceCraftID
.
setSiteID
(
1
);
FNSPaceCraftID
.
setApplicationID
(
1
);
FNSPaceCraftID
.
setApplicationID
(
1
);
FNSPaceCraftID
.
setEntityID
(
1
);
FNSPaceCraftID
.
setEntityID
(
1
);
...
@@ -55,7 +54,8 @@ public class ExampleSimulationProgramReynolds {
...
@@ -55,7 +54,8 @@ public class ExampleSimulationProgramReynolds {
}
}
private
EntityID
createHostileSpaceCraft
()
{
private
EntityID
createHostileSpaceCraft
()
{
EntityID
HHostileSpaceCraftID
=
new
EntityID
();
// 1.1.45.1.7.1 Platform,Cyber,China,MaliciousPacket
EntityID
HHostileSpaceCraftID
=
new
EntityID
();
// 1.1.45.1.7.1 Platform,Space,Russia,HostileSpaceCraft
HHostileSpaceCraftID
.
setSiteID
(
2
);
HHostileSpaceCraftID
.
setSiteID
(
2
);
HHostileSpaceCraftID
.
setApplicationID
(
2
);
HHostileSpaceCraftID
.
setApplicationID
(
2
);
HHostileSpaceCraftID
.
setEntityID
(
2
);
HHostileSpaceCraftID
.
setEntityID
(
2
);
...
@@ -120,7 +120,7 @@ public class ExampleSimulationProgramReynolds {
...
@@ -120,7 +120,7 @@ public class ExampleSimulationProgramReynolds {
// TODO reset clock to zero each time for consistent outputs
// TODO reset clock to zero each time for consistent outputs
// Your model setup: define participants. who's who in this zoo?
// Your model setup: define participants. who's who in this zoo?
// Assuming you keep track of entity objects... here is some support for for Entity 1.
// Assuming you keep track of entity objects... here is some support for for Entity 1.
// create PDU object for US
Firewall
and set its values.
// create PDU object for US
SpaceCraft
and set its values.
EntityStatePdu
entityStatePdu_1
=
pduFactory
.
makeEntityStatePdu
();
EntityStatePdu
entityStatePdu_1
=
pduFactory
.
makeEntityStatePdu
();
entityStatePdu_1
.
setEntityID
(
createFriendSpaceCraft
());
entityStatePdu_1
.
setEntityID
(
createFriendSpaceCraft
());
entityStatePdu_1
.
setEntityType
(
createFriendSpaceCraftType
());
entityStatePdu_1
.
setEntityType
(
createFriendSpaceCraftType
());
...
@@ -128,15 +128,13 @@ public class ExampleSimulationProgramReynolds {
...
@@ -128,15 +128,13 @@ public class ExampleSimulationProgramReynolds {
entityStatePdu_1
.
setForceId
(
ForceID
.
FRIENDLY
);
entityStatePdu_1
.
setForceId
(
ForceID
.
FRIENDLY
);
// TODO someday, use enumerations; is there a unique site triplet for MOVES Institute?
// TODO someday, use enumerations; is there a unique site triplet for MOVES Institute?
// create PDU object for
Malware Packe
t and set its values.
// create PDU object for
Hostile SpaceCraf
t and set its values.
EntityStatePdu
entityStatePdu_2
=
pduFactory
.
makeEntityStatePdu
();
EntityStatePdu
entityStatePdu_2
=
pduFactory
.
makeEntityStatePdu
();
entityStatePdu_2
.
setEntityID
(
createHostileSpaceCraft
());
entityStatePdu_2
.
setEntityID
(
createHostileSpaceCraft
());
entityStatePdu_2
.
setEntityType
(
createHostileSpaceCraftType
());
entityStatePdu_2
.
setEntityType
(
createHostileSpaceCraftType
());
entityStatePdu_2
.
getEntityLocation
().
setX
(
10
);
entityStatePdu_2
.
getEntityLocation
().
setX
(
10
);
entityStatePdu_2
.
setForceId
(
ForceID
.
OPPOSING
);
entityStatePdu_2
.
setForceId
(
ForceID
.
OPPOSING
);
FirePdu
firePdu
=
pduFactory
.
makeFirePdu
();
// for entity 1 first weapon (possible traceroute)
FirePdu
firePdu
=
pduFactory
.
makeFirePdu
();
// for entity 1 first weapon (possible traceroute)
// should we customize this munition? what is it for your simulation?
// should we customize this munition? what is it for your simulation?
EntityID
fireID
=
new
EntityID
();
EntityID
fireID
=
new
EntityID
();
...
@@ -157,8 +155,8 @@ public class ExampleSimulationProgramReynolds {
...
@@ -157,8 +155,8 @@ public class ExampleSimulationProgramReynolds {
TracerouteID
.
setEntityID
(
1
);
TracerouteID
.
setEntityID
(
1
);
firePdu
.
setMunitionExpendibleID
(
TracerouteID
);
firePdu
.
setMunitionExpendibleID
(
TracerouteID
);
CommentReliablePdu
HostileSpaceCraftDestroyedComment
=
pduFactory
.
makeCommentReliablePdu
(
"
Malware Packet DESTROYED BY Firewall
"
);
CommentReliablePdu
HostileSpaceCraftDestroyedComment
=
pduFactory
.
makeCommentReliablePdu
(
"
Hostile SpaceCraft DESTROYED BY Friendly SpaceCraft
"
);
CommentReliablePdu
HostileSpaceCraftDetectedComment
=
pduFactory
.
makeCommentReliablePdu
(
"F
irewall Detects Malware engage Traceroute
"
);
CommentReliablePdu
HostileSpaceCraftDetectedComment
=
pduFactory
.
makeCommentReliablePdu
(
"F
riendly SpaceCraft Detects Hostile SpaceCraft engage Pulse Torpedo's
"
);
// TODO simulation management PDUs for startup, planning to design special class support
// TODO simulation management PDUs for startup, planning to design special class support
//DetonationPdu detonationPdu = pduFactory.makeDetonationPdu();
//DetonationPdu detonationPdu = pduFactory.makeDetonationPdu();
...
@@ -185,7 +183,7 @@ public class ExampleSimulationProgramReynolds {
...
@@ -185,7 +183,7 @@ public class ExampleSimulationProgramReynolds {
if
(!
fireBool
)
{
if
(!
fireBool
)
{
sendSinglePdu
(
HostileSpaceCraftDetectedComment
);
sendSinglePdu
(
HostileSpaceCraftDetectedComment
);
// Inform the user of the detection
// Inform the user of the detection
System
.
out
.
println
(
"Friendly SpaceCraft Detects Hostile SpaceCraft from "
System
.
out
.
println
(
"Friendly SpaceCraft Detects Hostile SpaceCraft from "
+
entityStatePdu_2
.
getEntityType
().
getCountry
()
+
entityStatePdu_2
.
getEntityType
().
getCountry
()
+
"... Engaging with Pulse Torpedo's"
);
+
"... Engaging with Pulse Torpedo's"
);
}
}
...
@@ -209,7 +207,7 @@ public class ExampleSimulationProgramReynolds {
...
@@ -209,7 +207,7 @@ public class ExampleSimulationProgramReynolds {
if
(
firePdu
.
getTargetEntityID
().
getEntityID
()
==
6666
)
{
if
(
firePdu
.
getTargetEntityID
().
getEntityID
()
==
6666
)
{
TorpedoDamageRecieved
+=
1
;
TorpedoDamageRecieved
+=
1
;
if
(
TorpedoDamageRecieved
>
1
)
{
if
(
TorpedoDamageRecieved
>
1
)
{
// The F
irewall
destroys the
MalPacket
// The F
riendly
destroys the
Hostile
System
.
out
.
println
(
"Hostile SpaceCraft DESTROYED BY Friendly SpaceCraft after "
System
.
out
.
println
(
"Hostile SpaceCraft DESTROYED BY Friendly SpaceCraft after "
+
TorpedoDamageRecieved
+
TorpedoDamageRecieved
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment