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
d9dc3c5b
Commit
d9dc3c5b
authored
7 months ago
by
tbavl
Browse files
Options
Downloads
Patches
Plain Diff
Bavlsik Assignment 3 update
parent
17cd6221
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/MV3500Cohort2024JulySeptember/homework3/Bavlsik/BavlsikSimulationProgram.java
+20
-7
20 additions, 7 deletions
...September/homework3/Bavlsik/BavlsikSimulationProgram.java
with
20 additions
and
7 deletions
assignments/src/MV3500Cohort2024JulySeptember/homework3/Bavlsik/BavlsikSimulationProgram.java
+
20
−
7
View file @
d9dc3c5b
...
@@ -19,9 +19,10 @@ import java.util.logging.Level;
...
@@ -19,9 +19,10 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
/**
/**
* This program runs a simulation that initializes two entities, of which one will
* This program runs a simulation that initializes two entities, of which one
* attempt to find and destroy the other, and one which will flee the other entity.
* will attempt to find and destroy the other, and one which will flee the other
* Default program initialization includes PDU recording turned on by default.
* entity. Default program initialization includes PDU recording turned on by
* default.
*
*
* @see
* @see
* <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt" target="_blank">ExampleSimulationProgramLog.txt</a>
* <a href="https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt" target="_blank">ExampleSimulationProgramLog.txt</a>
...
@@ -37,7 +38,6 @@ import java.util.logging.Logger;
...
@@ -37,7 +38,6 @@ import java.util.logging.Logger;
public
class
BavlsikSimulationProgram
{
public
class
BavlsikSimulationProgram
{
/* **************************** infrastructure code, modification is seldom needed ************************* */
/* **************************** infrastructure code, modification is seldom needed ************************* */
private
String
descriptor
=
this
.
getClass
().
getSimpleName
();
private
String
descriptor
=
this
.
getClass
().
getSimpleName
();
/**
/**
* DIS channel defined by network address/port combination includes multiple
* DIS channel defined by network address/port combination includes multiple
...
@@ -99,6 +99,15 @@ public class BavlsikSimulationProgram {
...
@@ -99,6 +99,15 @@ public class BavlsikSimulationProgram {
*/
*/
protected
MunitionDescriptor
munitionDescriptor1
;
protected
MunitionDescriptor
munitionDescriptor1
;
/**
* DetonationPdu for entity 1 first weapon
*/
protected
DetonationPdu
detPdu_1a
;
/**
* DetonationPdu for entity 1 second weapon
*/
protected
DetonationPdu
detPdu_1b
;
// hey programmer, what other state do you want? this is a good place to declare it...
// hey programmer, what other state do you want? this is a good place to declare it...
/**
/**
* Constructor to create an instance of this class. Design goal: additional
* Constructor to create an instance of this class. Design goal: additional
...
@@ -195,6 +204,10 @@ public class BavlsikSimulationProgram {
...
@@ -195,6 +204,10 @@ public class BavlsikSimulationProgram {
firePdu_1b
=
pduFactory
.
makeFirePdu
();
firePdu_1b
=
pduFactory
.
makeFirePdu
();
munitionDescriptor1
=
new
MunitionDescriptor
();
munitionDescriptor1
=
new
MunitionDescriptor
();
detPdu_1a
=
pduFactory
.
makeDetonationPdu
();
detPdu_1b
=
pduFactory
.
makeDetonationPdu
();
detPdu_1a
.
setSourceEntityID
(
entityID_1
);
// 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.
// PDU objects are already declared and instances created, so now set their values.
// PDU objects are already declared and instances created, so now set their values.
...
@@ -229,6 +242,7 @@ public class BavlsikSimulationProgram {
...
@@ -229,6 +242,7 @@ public class BavlsikSimulationProgram {
// more is needed here by scenario authors...
// more is needed here by scenario authors...
munitionDescriptor1
.
setQuantity
(
1
);
munitionDescriptor1
.
setQuantity
(
1
);
firePdu_1a
.
setDescriptor
(
munitionDescriptor1
).
setRange
(
3.0f
);
firePdu_1a
.
setDescriptor
(
munitionDescriptor1
).
setRange
(
3.0f
);
}
}
/**
/**
...
@@ -350,10 +364,9 @@ public class BavlsikSimulationProgram {
...
@@ -350,10 +364,9 @@ public class BavlsikSimulationProgram {
}
// end of simulation loop, continue until done
}
// end of simulation loop, continue until done
// ===================================================================================================// ===================================================================================================// ===================================================================================================// ===================================================================================================
// ===================================================================================================// ===================================================================================================// ===================================================================================================// ===================================================================================================
if
(
simulationComplete
){
if
(
simulationComplete
)
{
System
.
out
.
println
(
"Good guys sank the bads guys!"
);
System
.
out
.
println
(
"Good guys sank the bads guys!"
);
}
}
else
{
else
{
System
.
out
.
println
(
"Bad guys got away... we'll get em' next time boys."
);
System
.
out
.
println
(
"Bad guys got away... we'll get em' next time boys."
);
}
}
narrativeMessage2
=
"runSimulation() completed successfully"
;
// all done, so tell everyone else on the channel
narrativeMessage2
=
"runSimulation() completed successfully"
;
// all done, so tell everyone else on the channel
...
...
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