diff --git a/.gitignore b/.gitignore
index 94420dc..3861ac2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
+DemoAmeisen/
+
# User-specific files
*.suo
*.user
diff --git a/AntMe/Main.cs b/AntMe/Main.cs
index 26337c3..67900e4 100644
--- a/AntMe/Main.cs
+++ b/AntMe/Main.cs
@@ -35,7 +35,7 @@ public Main(string[] parameter)
InitializeComponent();
CreateHandle();
- // check Language-buttons
+ // Check language buttons
switch (Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName)
{
case "de":
@@ -69,7 +69,7 @@ public Main(string[] parameter)
problems.ShowDialog(this);
}
- // Set Window-Position
+ // Set window position
WindowState = Settings.Default.windowState;
Location = Settings.Default.windowPosition;
Size = Settings.Default.windowSize;
@@ -77,7 +77,7 @@ public Main(string[] parameter)
manager.SearchForPlugins();
timer.Enabled = true;
- // Forward startparameter
+ // Forward start parameter
foreach (PluginItem plugin in manager.ProducerPlugins)
{
plugin.Producer.StartupParameter(parameter);
@@ -100,10 +100,10 @@ public Main(string[] parameter)
#endregion
- #region Frontend- und Interaktionshandling
+ #region Frontend and interaction handling
///
- /// Make updates based on manager-settings
+ /// Make updates based on manager settings.
///
private void updatePanel()
{
@@ -115,7 +115,7 @@ private void updatePanel()
ignoreTimerEvents = true;
- // Controlling-Buttons
+ // Controlling buttons
startMenuItem.Enabled = manager.CanStart;
startToolItem.Enabled = manager.CanStart;
pauseToolItem.Enabled = manager.CanPause;
@@ -151,7 +151,7 @@ private void updatePanel()
speedDropDownToolItem.Text = Resource.MainSpeedMaximal;
}
- // Producer List (Button-Based)
+ // Producer list (button based)
List remove = new List();
foreach (ToolStripItem item in producerButton.DropDownItems)
{
@@ -180,7 +180,7 @@ private void updatePanel()
}
}
- // manage tabs
+ // Manage tabs
if (activeProducer != manager.ActiveProducerPlugin)
{
bool isSelected = tabControl.SelectedIndex == 1;
@@ -188,7 +188,7 @@ private void updatePanel()
// Update Mode Display
producerButton.Text = (manager.ActiveProducerPlugin == null ? Resource.MainNoModeSelected : manager.ActiveProducerPlugin.Name);
- // remove old tab
+ // Remove old tab
if (activeProducer != null)
{
if (activeProducer.Producer.Control != null)
@@ -198,7 +198,7 @@ private void updatePanel()
activeProducer = null;
}
- // add new tab
+ // Add new tab
if (manager.ActiveProducerPlugin != null)
{
if (manager.ActiveProducerPlugin.Producer.Control != null)
@@ -217,7 +217,7 @@ private void updatePanel()
}
}
- // synchronize Consumer
+ // Synchronize consumer
List newActiveConsumers = new List(manager.ActiveConsumerPlugins);
for (int i = activeConsumers.Count - 1; i >= 0; i--)
{
@@ -236,7 +236,7 @@ private void updatePanel()
//Create new, if needed
if (!activeConsumers.Contains(plugin))
{
- // Create Tab and place control
+ // Create tab and place control
if (plugin.Consumer.Control != null)
{
tabControl.TabPages.Add(plugin.Guid.ToString(), plugin.Name);
@@ -255,7 +255,7 @@ private void updatePanel()
manager.Exceptions.Clear();
}
- // StatusBar-information
+ // Status bar information
stateLabelBarItem.Text = string.Empty;
switch (manager.State)
{
@@ -302,7 +302,7 @@ private void updatePanel()
#endregion
- #region Formularfunktionen
+ #region form functions
#region form
@@ -317,7 +317,7 @@ private void form_shown(object sender, EventArgs e)
manager.Exceptions.Clear();
}
- // force a direkt start, if manager is ready
+ // force a direkt start, if manager is ready.
if (manager.CanStart && directstart)
{
start(sender, e);
@@ -331,11 +331,11 @@ private void form_close(object sender, FormClosingEventArgs e)
manager.Stop();
}
- // Alle Plugin-Einstellungen absichern
+ // Save all plugin settings.
Settings.Default.Save();
manager.SaveSettings();
- // show possible problems
+ // Show possible problems.
if (manager.Exceptions != null && manager.Exceptions.Count > 0)
{
ExceptionViewer form = new ExceptionViewer(manager.Exceptions);
@@ -529,7 +529,7 @@ private void timer_tick(object sender, EventArgs e)
#endregion
- #region Managersteuerung
+ #region manager control
private void start(object sender, EventArgs e)
{
diff --git a/AntMe/PluginItem.cs b/AntMe/PluginItem.cs
index 24b1449..a7764a8 100644
--- a/AntMe/PluginItem.cs
+++ b/AntMe/PluginItem.cs
@@ -19,11 +19,11 @@ internal sealed class PluginItem
///
- /// Creates an instance of Plugin-Item, based on a producer.
+ /// Creates an instance of plugin item, based on a producer.
///
- /// Producer-Plugin
- /// List of custom states for write-access
- /// List of custom states for read-access
+ /// Producer plugin
+ /// List of custom states for write access
+ /// List of custom states for read access
public PluginItem(IProducerPlugin plugin, CustomStateItem[] writeCustomStates, CustomStateItem[] readCustomStates)
: this(writeCustomStates, readCustomStates, plugin)
{
@@ -38,15 +38,15 @@ public PluginItem(IProducerPlugin plugin, CustomStateItem[] writeCustomStates, C
}
///
- /// Creates an instance of Plugin-Item, based on a producer.
+ /// Creates an instance of plugin item, based on a producer.
///
- /// Consumer-Plugin
- /// List of custom states for write-access
- /// List of custom states for read-access
+ /// Consumer plugin
+ /// List of custom states for write access
+ /// List of custom states for read access
public PluginItem(IConsumerPlugin plugin, CustomStateItem[] writeCustomStates, CustomStateItem[] readCustomStates)
: this(writeCustomStates, readCustomStates, plugin)
{
- // PrĂŒfen, ob Plugin angegeben wurde
+ // Check if plugin has been specified
if (plugin == null)
{
throw new ArgumentNullException("plugin", Resource.PluginItemConstructorPluginIsNull);
@@ -59,8 +59,8 @@ public PluginItem(IConsumerPlugin plugin, CustomStateItem[] writeCustomStates, C
/// Private constructor for a common way to handle attributes.
///
/// Plugin
- /// List of custom states for write-access
- /// List of custom states for read-access
+ /// List of custom states for write access
+ /// List of custom states for read access
private PluginItem(CustomStateItem[] writeCustomStates, CustomStateItem[] readCustomStates, IPlugin plugin)
{
@@ -95,7 +95,7 @@ private PluginItem(CustomStateItem[] writeCustomStates, CustomStateItem[] readCu
}
///
- /// Gets the consumer-plugin or null, if its a producer-plugin.
+ /// Gets the consumer plugin or null, if its a producer plugin.
///
public IConsumerPlugin Consumer
{
@@ -103,7 +103,7 @@ public IConsumerPlugin Consumer
}
///
- /// Gets the producer-plugin or null, if its a consumer-plugin.
+ /// Gets the producer plugin or null, if its a consumer plugin.
///
public IProducerPlugin Producer
{
@@ -111,7 +111,7 @@ public IProducerPlugin Producer
}
///
- /// True, if its a consumer-plugin, false in case of a producer-plugin.
+ /// True, if its a consumer plugin, false in case of a producer plugin.
///
public bool IsConsumer
{
@@ -119,7 +119,7 @@ public bool IsConsumer
}
///
- /// Gets the name of the Plugin.
+ /// Gets the name of the plugin.
///
public string Name
{
@@ -127,7 +127,7 @@ public string Name
}
///
- /// Gets a short description of this Plugin.
+ /// Gets a short description of this plugin.
///
public string Description
{
@@ -135,7 +135,7 @@ public string Description
}
///
- /// Gets the plugin-version.
+ /// Gets the plugin version.
///
public Version Version
{
@@ -143,7 +143,7 @@ public Version Version
}
///
- /// Gets the plugin-.
+ /// Gets the plugin .
///
public Guid Guid
{
diff --git a/AntMe/PluginManager.cs b/AntMe/PluginManager.cs
index b552b43..8a3a80d 100644
--- a/AntMe/PluginManager.cs
+++ b/AntMe/PluginManager.cs
@@ -14,7 +14,7 @@
namespace AntMe.Gui
{
///
- /// Manager for all plugins and host for central game-loop
+ /// Manager for all plugins and host for central game loop.
///
/// Tom Wendel (tom@antme.net)
internal sealed class PluginManager
@@ -37,7 +37,7 @@ internal sealed class PluginManager
private PluginItem visiblePlugin;
private readonly List exceptions;
private PluginState lastState = PluginState.NotReady;
- private bool ignoreStateupdate = false;
+ private bool ignoreStateUpdate = false;
private Thread requestThread;
@@ -90,34 +90,34 @@ public PluginManager()
///
public void SearchForPlugins()
{
- // List dlls from Exe-Path
+ // List dlls from exe path.
List files = new List();
files.AddRange(applicationPath.GetFiles(Resources.PluginSearchFilter));
- // List dlls from "plugin"-Folder
+ // List dlls from "plugin" folder.
if (pluginPath != null) files.AddRange(pluginPath.GetFiles(Resources.PluginSearchFilter));
- // Load root Plugins
+ // Load root plugins.
for (int i = 0; i < files.Count; i++)
CheckForPlugin(files[i]);
- // Check known Plugins
+ // Check known plugins.
foreach (var knownFile in config.knownPluginFiles.ToArray())
{
FileInfo external = new FileInfo(knownFile);
- // Skip some files
- if (!external.Exists ||
- files.Contains(external) ||
- external.Directory.FullName.ToLower().Equals(applicationPath.FullName.ToLower()) ||
- (pluginPath != null && external.Directory.FullName.ToLower().Equals(pluginPath.FullName.ToLower())))
+ // Skip some files.
+ if (external.Directory != null && (!external.Exists ||
+ files.Contains(external) ||
+ external.Directory.FullName.ToLower().Equals(applicationPath.FullName.ToLower()) ||
+ (pluginPath != null && external.Directory.FullName.ToLower().Equals(pluginPath.FullName.ToLower()))))
{
- // Drop from list
+ // Drop from list.
config.knownPluginFiles.Remove(knownFile);
continue;
}
- // Try to load
+ // Try to load.
if (!CheckForPlugin(external))
{
config.knownPluginFiles.Remove(knownFile);
@@ -139,6 +139,7 @@ public bool CheckForPlugin(FileInfo file)
if (addPlugin(assembly))
{
if (
+ file.Directory != null &&
!file.Directory.FullName.ToLower().Equals(applicationPath.FullName.ToLower()) &&
!file.Directory.FullName.ToLower().Equals(pluginPath.FullName.ToLower()) &&
!config.knownPluginFiles.Contains(file.FullName.ToLower()))
@@ -151,27 +152,27 @@ public bool CheckForPlugin(FileInfo file)
}
catch (FileLoadException ex)
{
- // Problems to open the file
+ // Problems to open the file.
exceptions.Add(ex);
}
catch (BadImageFormatException ex)
{
- // There is a wrong fileformat
+ // There is a wrong fileformat.
exceptions.Add(ex);
}
catch (SecurityException ex)
{
- // no accessrights
+ // no access rights.
exceptions.Add(ex);
}
catch (MissingMethodException ex)
{
- // problems with plugin
+ // problems with plugin.
exceptions.Add(ex);
}
catch (TargetInvocationException ex)
{
- // missing references
+ // missing references.
exceptions.Add(
new Exception(
string.Format(Resource.PluginManagerMissingReferences, file),
@@ -179,7 +180,7 @@ public bool CheckForPlugin(FileInfo file)
}
catch (ReflectionTypeLoadException ex)
{
- // missing references
+ // missing references.
exceptions.Add(
new Exception(
string.Format(Resource.PluginManagerMissingReferences, file),
@@ -187,14 +188,14 @@ public bool CheckForPlugin(FileInfo file)
}
catch (Exception ex)
{
- // unknown exception
+ // unknown exception.
exceptions.Add(ex);
}
return false;
}
///
- /// search in given assembly for a new plugin
+ /// Search in given assembly for a new plugin.
///
/// assembly to search in
/// true, if there are valid plugins inside
@@ -202,10 +203,10 @@ private bool addPlugin(Assembly assembly)
{
bool hit = false;
- // Get all includes Types
+ // Get all includes types.
foreach (Type type in assembly.GetExportedTypes())
{
- // Find the attribute
+ // Find the attribute.
List readCustomStates = new List();
List writeCustomStates = new List();
@@ -261,13 +262,13 @@ private bool addPlugin(Assembly assembly)
}
}
- // If type has an attribute, search for the interfaces
+ // If type has an attribute, search for the interfaces.
foreach (Type plugin in type.GetInterfaces())
{
- // Producer found
+ // Producer found.
if (plugin == typeof(IProducerPlugin))
{
- // Create an instance of plugin and add to list
+ // Create an instance of plugin and add to list.
PluginItem item = null;
try
{
@@ -288,7 +289,7 @@ private bool addPlugin(Assembly assembly)
ex));
}
- // Warnings, of there is another Version of that plugin
+ // Warnings if there is another version of that plugin.
if (item != null && producerList.ContainsKey(item.Guid))
{
if (producerList[item.Guid].Version > item.Version)
@@ -314,15 +315,15 @@ private bool addPlugin(Assembly assembly)
}
else
{
- // Samle plugin still loaded
+ // Same plugin still loaded.
item = null;
}
}
- // add to list
+ // Add to list.
if (item != null)
{
- // Check, if plugin is preselected or saved as selected
+ // Check, if plugin is preselected or saved as selected.
producerList.Add(item.Guid, item);
if (config.selectedPlugins.Contains(item.Guid) ||
(!config.loaded &&
@@ -331,7 +332,7 @@ private bool addPlugin(Assembly assembly)
ActivateProducer(item.Guid);
}
- // Load Settings
+ // Load settings.
if (File.Exists(configPath + item.Guid + Resources.PluginSettingsFileExtension))
{
try
@@ -354,10 +355,10 @@ private bool addPlugin(Assembly assembly)
}
}
- // Consumer found
+ // Consumer found.
else if (plugin == typeof(IConsumerPlugin))
{
- // Create an instance of plugin and add to list
+ // Create an instance of plugin and add to list.
PluginItem item = null;
try
{
@@ -378,7 +379,7 @@ private bool addPlugin(Assembly assembly)
ex));
}
- // Warnings, of there is another Version of that plugin
+ // Warnings if there is another version of that plugin.
if (item != null && consumerList.ContainsKey(item.Guid))
{
if (consumerList[item.Guid].Version > item.Version)
@@ -404,17 +405,17 @@ private bool addPlugin(Assembly assembly)
}
else
{
- // Same plugin still loaded
+ // Same plugin still loaded.
item = null;
}
}
- // add to list
+ // Add to list.
if (item != null)
{
consumerList.Add(item.Guid, item);
- // Check, if plugin is preselected or saved as selected
+ // Check, if plugin is preselected or saved as selected.
if (config.selectedPlugins.Contains(item.Guid) ||
(!config.loaded &&
type.GetCustomAttributes(typeof(PreselectedAttribute), false).Length > 0))
@@ -422,7 +423,7 @@ private bool addPlugin(Assembly assembly)
ActivateConsumer(item.Guid);
}
- // Load Settings
+ // Load settings.
if (File.Exists(configPath + item.Guid + Resources.PluginSettingsFileExtension))
{
try
@@ -454,7 +455,7 @@ private bool addPlugin(Assembly assembly)
#region Properties
///
- /// Gives a list of available producer-plugins.
+ /// Gives a list of available producer plugins.
///
public PluginItem[] ProducerPlugins
{
@@ -467,7 +468,7 @@ public PluginItem[] ProducerPlugins
}
///
- /// Gives a list of available consumer-plugins.
+ /// Gives a list of available consumer plugins.
///
public PluginItem[] ConsumerPlugins
{
@@ -480,7 +481,7 @@ public PluginItem[] ConsumerPlugins
}
///
- /// Gives a list of activated consumer-plugins.
+ /// Gives a list of activated consumer plugins.
///
public PluginItem[] ActiveConsumerPlugins
{
@@ -493,7 +494,7 @@ public PluginItem[] ActiveConsumerPlugins
}
///
- /// Returns a list of exceptions that happened during the last call
+ /// Returns a list of exceptions that occured during the last call.
///
public List Exceptions
{
@@ -501,7 +502,7 @@ public List Exceptions
}
///
- /// Gives the active producer-plugin or null, if no plugin is active.
+ /// Gives the active producer plugin or null, if no plugin is active.
///
public PluginItem ActiveProducerPlugin
{
@@ -517,7 +518,7 @@ public bool CanStart
}
///
- /// Is manger ready for pause-mode.
+ /// Is manger ready for pause mode.
///
public bool CanPause
{
@@ -539,17 +540,17 @@ public PluginState State
{
get
{
- if (!ignoreStateupdate)
+ if (!ignoreStateUpdate)
{
PluginState output = PluginState.NotReady;
- // capture producerstate
+ // Capture producerstate.
if (activeProducer != null)
{
output = activeProducer.Producer.State;
}
- // check for changes
+ // Check for changes.
switch (output)
{
case PluginState.NotReady:
@@ -557,8 +558,8 @@ public PluginState State
if (lastState == PluginState.Running ||
lastState == PluginState.Paused)
{
- // Producer switched from running/paused to notReady or ready
- // All running consumer have to stop
+ // Producer switched from running/paused to notReady or ready.
+ // All running consumer have to stop.
foreach (PluginItem item in activeConsumers.Values)
{
if (item.Consumer.State == PluginState.Running ||
@@ -574,8 +575,8 @@ public PluginState State
lastState == PluginState.Ready ||
lastState == PluginState.Paused)
{
- // Producer switched from somewhere to running
- // All ready or paused consumer have to start
+ // Producer switched from somewhere to running.
+ // All ready or paused consumer have to start.
foreach (PluginItem item in activeConsumers.Values)
{
if (item.Consumer.State == PluginState.Paused ||
@@ -590,8 +591,8 @@ public PluginState State
if (lastState == PluginState.Running ||
lastState == PluginState.Ready)
{
- // Producer switched to pause-mode
- // All ready or running consumer have to pause
+ // Producer switched to pause mode.
+ // All ready or running consumer have to pause.
foreach (PluginItem item in activeConsumers.Values)
{
if (item.Consumer.State == PluginState.Running ||
@@ -604,7 +605,7 @@ public PluginState State
break;
}
- // Start requestLoop, if needed
+ // Start request loop, if needed.
if ((output == PluginState.Running || output == PluginState.Paused) && requestThread == null)
{
requestThread = new Thread(requestLoop);
@@ -625,7 +626,7 @@ public PluginState State
}
///
- /// Gives the number of current simulation-round.
+ /// Gives the number of current simulation round.
///
public int CurrentRound
{
@@ -655,13 +656,13 @@ public int TotalRounds
}
///
- /// Gives the current frame-rate for this simulation.
+ /// Gives the current frame rate for this simulation.
///
public float FrameRate
{
get
{
- // calculate new average
+ // Calculate new average.
if (frameRateInvalidate)
{
frameRateAverage = 0;
@@ -678,14 +679,14 @@ public float FrameRate
}
private set
{
- // write new value in ringbuffer
+ // Write new value in ringbuffer.
frameRateInvalidate = true;
frameRateHistory[frameRatePosition++ % FRAMERATE_SPAN] = value;
}
}
///
- /// Gives the current frame-rate-limit, if limiter is enabled.
+ /// Gives the current frame rate limit, if limiter is enabled.
///
public float FrameLimit
{
@@ -700,7 +701,7 @@ public float FrameLimit
}
///
- /// Gives the state of the frame-rate-limiter.
+ /// Gives the state of the frame rate limiter.
///
public bool FrameLimiterEnabled
{
@@ -720,18 +721,18 @@ public Configuration Configuration
#region Methods
///
- /// drops a consumer from active list.
+ /// Drops a consumer from active list.
///
/// guid of plugin to drop
public void DeactivateConsumer(Guid guid)
{
- // Check, if plugin exists
+ // Check, if plugin exists.
if (!consumerList.ContainsKey(guid))
{
throw new InvalidOperationException(Resource.PluginManagerDeactivateConsumerNotInList);
}
- // Drop from active list
+ // Drop from active list.
lock (activeConsumers)
{
if (activeConsumers.ContainsKey(guid))
@@ -741,7 +742,7 @@ public void DeactivateConsumer(Guid guid)
activeConsumers.Remove(guid);
config.selectedPlugins.Remove(guid);
- // Stop, if still running
+ // Stop, if still running.
if (plugin.Consumer.State == PluginState.Running ||
plugin.Consumer.State == PluginState.Paused)
{
@@ -752,25 +753,25 @@ public void DeactivateConsumer(Guid guid)
}
///
- /// Adds a plugin to active list
+ /// Adds a plugin to active list.
///
/// guid of new plugin
public void ActivateConsumer(Guid guid)
{
- // Check, if plugin exists
+ // Check, if plugin exists.
if (!consumerList.ContainsKey(guid))
{
throw new InvalidOperationException(Resource.PluginManagerActivateConsumerNotInList);
}
- // Add to list
+ // Add to list.
lock (activeConsumers)
{
if (!activeConsumers.ContainsKey(guid))
{
PluginItem plugin = consumerList[guid];
- // Activate, if simulation still running
+ // Activate, if simulation still running.
if (State == PluginState.Running)
{
plugin.Consumer.Start();
@@ -782,7 +783,7 @@ public void ActivateConsumer(Guid guid)
activeConsumers.Add(guid, plugin);
- // mark as selected in config
+ // Mark as selected in config.
if (!config.selectedPlugins.Contains(guid))
{
config.selectedPlugins.Add(guid);
@@ -792,12 +793,12 @@ public void ActivateConsumer(Guid guid)
}
///
- /// Deactivates the given producer
+ /// Deactivates the given producer.
///
/// guid of producer
public void DeactivateProducer(Guid guid)
{
- ignoreStateupdate = true;
+ ignoreStateUpdate = true;
if (activeProducer != null && activeProducer.Guid == guid)
{
@@ -806,23 +807,23 @@ public void DeactivateProducer(Guid guid)
activeProducer = null;
config.selectedPlugins.Remove(guid);
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// Changes the active Producer
+ /// Changes the active Producer.
///
/// guid of new producer
public void ActivateProducer(Guid guid)
{
- ignoreStateupdate = true;
- // check, if plugin with that guid exists
+ ignoreStateUpdate = true;
+ // Check, if plugin with that guid exists.
if (!producerList.ContainsKey(guid))
{
throw new InvalidOperationException(Resource.PluginManagerActivateProducerNotInList);
}
- // check, if same plugin is still active
+ // Check, if same plugin is still active.
if (activeProducer == null || activeProducer.Guid != guid)
{
// unhook old producer
@@ -839,17 +840,17 @@ public void ActivateProducer(Guid guid)
config.selectedPlugins.Add(guid);
}
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// Starts the manager, of its ready
+ /// Starts the manager, of its ready.
///
public void Start()
{
- ignoreStateupdate = true;
+ ignoreStateUpdate = true;
- // Start the producer
+ // Start the producer.
lock (activeProducer)
{
if (activeProducer != null &&
@@ -860,17 +861,17 @@ public void Start()
}
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// pause the manager
+ /// Pause the manager.
///
public void Pause()
{
- ignoreStateupdate = true;
+ ignoreStateUpdate = true;
- // Suspend the producer
+ // Suspend the producer.
lock (activeProducer)
{
if (activeProducer != null &&
@@ -881,15 +882,15 @@ public void Pause()
}
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// Stops the manager
+ /// Stops the manager.
///
public void Stop()
{
- ignoreStateupdate = true;
+ ignoreStateUpdate = true;
lock (activeProducer)
{
@@ -901,19 +902,19 @@ public void Stop()
}
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// Loads the settings to configuration
+ /// Loads the settings to configuration.
///
public void LoadSettings()
{
- ignoreStateupdate = true;
- // check, if configfile exists
+ ignoreStateUpdate = true;
+ // Check, if config file exists.
if (File.Exists(configPath + Resources.GlobalSettingsFileName))
{
- // read configfile
+ // Read configfile.
FileStream file = File.Open(configPath + Resources.GlobalSettingsFileName, FileMode.Open);
try
@@ -934,15 +935,15 @@ public void LoadSettings()
file.Close();
}
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// Saves the settings of plugin-manager to configuration-file.
+ /// Saves the settings of plugin manager to configuration file.
///
public void SaveSettings()
{
- ignoreStateupdate = true;
+ ignoreStateUpdate = true;
if (!Directory.Exists(configPath))
{
Directory.CreateDirectory(configPath);
@@ -952,10 +953,10 @@ public void SaveSettings()
MemoryStream puffer = new MemoryStream();
serializer.Serialize(puffer, config);
File.WriteAllBytes(configPath + Resources.GlobalSettingsFileName, puffer.ToArray());
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
- // Save also plugin-Settings
- // Producer-Stuff
+ // Save also plugin settings.
+ // Producer stuff.
foreach (PluginItem plugin in producerList.Values)
{
try
@@ -975,7 +976,7 @@ public void SaveSettings()
}
}
- // Consumer-Stuff
+ // Consumer stuff.
foreach (PluginItem plugin in consumerList.Values)
{
try
@@ -997,13 +998,13 @@ public void SaveSettings()
}
///
- /// Sets the current visible plugin
+ /// Sets the current visible plugin.
///
/// visible Plugin
public void SetVisiblePlugin(Guid guid)
{
- ignoreStateupdate = true;
- // Set old plugin to invisible
+ ignoreStateUpdate = true;
+ // Set old plugin to invisible.
if (visiblePlugin != null)
{
if (visiblePlugin.IsConsumer)
@@ -1042,7 +1043,7 @@ public void SetVisiblePlugin(Guid guid)
}
}
- // Set new plugin to visible
+ // Set new plugin to visible.
if (producerList.ContainsKey(guid))
{
visiblePlugin = producerList[guid];
@@ -1083,19 +1084,19 @@ public void SetVisiblePlugin(Guid guid)
{
visiblePlugin = null;
}
- ignoreStateupdate = false;
+ ignoreStateUpdate = false;
}
///
- /// Sets the speed-limitation for running simulations.
+ /// Sets the speed limitation for running simulations.
///
/// sets the limitation to enabled
- /// limits the speed to a specific frame-rate
+ /// limits the speed to a specific frame rate
public void SetSpeedLimit(bool enabled, float framesPerSecond)
{
if (enabled)
{
- // Check for supported value
+ // Check for supported value.
if (framesPerSecond <= 0.0f)
{
throw new ArgumentOutOfRangeException(
@@ -1125,32 +1126,32 @@ public void SetSpeedLimit(bool enabled, float framesPerSecond)
#region Requestloop
///
- /// The game-loop. Runs, until state is set to Ready or notReady
+ /// The game loop. Runs until state is set to Ready or notReady.
///
private void requestLoop()
{
- // Limiter- and frame-rate-handling
+ // Limiter and frame rate handling.
Stopwatch watch = new Stopwatch();
- // Interrupt-Handling
+ // Interrupt handling.
bool interrupt = false;
- // Mainloop
+ // Main loop.
while (activeProducer != null &&
(activeProducer.Producer.State == PluginState.Running ||
activeProducer.Producer.State == PluginState.Paused))
{
- // request Simulationstate, if loop is not paused
+ // Request simulation state, if loop is not paused.
if (activeProducer != null && activeProducer.Producer.State == PluginState.Running)
{
watch.Reset();
watch.Start();
- // Create new Simulationstate
+ // Create new simulation state.
SimulationState simulationState = new SimulationState();
- // Request all consumers with CreateState-Method
+ // Request all consumers with create state method.
lock (activeConsumers)
{
foreach (PluginItem item in activeConsumers.Values)
@@ -1178,13 +1179,13 @@ private void requestLoop()
}
}
- // Break, if there was an interrupt
+ // Break, if there was an interrupt.
if (interrupt)
{
break;
}
- // Request producers Simulationstate
+ // Request producer simulation state.
lock (activeProducer)
{
try
@@ -1208,7 +1209,7 @@ private void requestLoop()
}
}
- // Request all consumers with CreatingState-Method
+ // Request all consumers with creating state method.
lock (activeConsumers)
{
foreach (PluginItem item in activeConsumers.Values)
@@ -1236,13 +1237,13 @@ private void requestLoop()
}
}
- // On interrupt stop loop
+ // On interrupt stop loop.
if (interrupt)
{
break;
}
- // Request all consumers with CreatedState-Method and also check for interrupt-Request
+ // Request all consumers with created state method and also check for interrupt request.
lock (activeConsumers)
{
foreach (PluginItem item in activeConsumers.Values)
@@ -1270,13 +1271,13 @@ private void requestLoop()
}
}
- // On interrupt stop loop
+ // On interrupt stop loop.
if (interrupt)
{
break;
}
- // Update UI
+ // Update UI.
try
{
if (activeProducer != null && activeProducer.Producer.State == PluginState.Running)
@@ -1319,16 +1320,16 @@ private void requestLoop()
}
}
- // On interrupt stop loop
+ // On interrupt stop loop.
if (interrupt)
{
break;
}
- // Save state for statistics
+ // Save state for statistics.
lastSimulationState = simulationState;
- // Framelimiter
+ // Frame limiter.
if (FrameLimiterEnabled)
{
while (watch.ElapsedMilliseconds < frameLimitMs)
@@ -1337,7 +1338,7 @@ private void requestLoop()
}
}
- // calculation of frame-time
+ // Calculation of frame time.
FrameRate = watch.ElapsedMilliseconds > 0 ? 1000 / watch.ElapsedMilliseconds : 0;
}
else
diff --git a/DemoAmeisen/DemoAmeisen.csproj b/DemoAmeisen/DemoAmeisen.csproj
index 78a5742..5389d28 100644
--- a/DemoAmeisen/DemoAmeisen.csproj
+++ b/DemoAmeisen/DemoAmeisen.csproj
@@ -27,4 +27,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FnaPlugin/ModelManager.cs b/FnaPlugin/ModelManager.cs
index 61e5c09..b35d9a5 100644
--- a/FnaPlugin/ModelManager.cs
+++ b/FnaPlugin/ModelManager.cs
@@ -1,9 +1,9 @@
namespace AntMe.Plugin.Fna
{
///
- /// class, to manage and render all model-resources.
+ /// Class, to manage and render all model resources.
///
- //internal sealed class ModellManager
+ // internal sealed class ModellManager
//{
// #region Constants
@@ -58,22 +58,22 @@ namespace AntMe.Plugin.Fna
// playgroundMaterial.Ambient = Color.FromArgb(114, 114, 73);
// playgroundMaterial.Emissive = Color.FromArgb(90, 90, 58);
// playgroundMaterial.Specular = Color.FromArgb(114, 114, 73);
- // colorFinder.BelegeFarbe(new Farbe(114, 114, 73));
+ // colorFinder.AddColorToColorList(new Color(114, 114, 73));
// sugarMaterial = new Material();
// sugarMaterial.Emissive = Color.FromArgb(200, 200, 200);
// sugarMaterial.Specular = Color.FromArgb(255, 255, 255);
- // colorFinder.BelegeFarbe(new Farbe(200, 200, 200));
+ // colorFinder.AddColorToColorList(new Color(200, 200, 200));
// bugMaterial = new Material();
// bugMaterial.Emissive = Color.DarkBlue;
// bugMaterial.Specular = Color.FromArgb(0, 0, 150);
- // colorFinder.BelegeFarbe(new Farbe(Color.DarkBlue.R, Color.DarkBlue.G, Color.DarkBlue.B));
+ // colorFinder.AddColorToColorList(new Color(Color.DarkBlue.R, Color.DarkBlue.G, Color.DarkBlue.B));
// fruitMaterial = new Material();
// fruitMaterial.Emissive = Color.Green;
// fruitMaterial.Specular = Color.FromArgb(0, 255, 0);
- // colorFinder.BelegeFarbe(new Farbe(Color.Green.R, Color.Green.G, Color.Green.B));
+ // colorFinder.AddColorToColorList(new Color(Color.Green.R, Color.Green.G, Color.Green.B));
// selectionMaterial = new Material();
// selectionMaterial.Emissive = Color.FromArgb(120, 0, 0);
@@ -140,39 +140,39 @@ namespace AntMe.Plugin.Fna
// if (!antMaterial.ContainsKey(colony))
// {
// // choose another color
- // Farbe color;
+ // Color color;
// switch (colony)
// {
// case 0:
- // color = new Farbe(0, 0, 0);
+ // color = new Color(0, 0, 0);
// break;
// case 1:
- // color = new Farbe(255, 0, 0);
+ // color = new Color(255, 0, 0);
// break;
// case 2:
- // color = new Farbe(0, 0, 255);
+ // color = new Color(0, 0, 255);
// break;
// case 3:
- // color = new Farbe(255, 255, 0);
+ // color = new Color(255, 255, 0);
// break;
// default:
- // color = colorFinder.ErzeugeFarbe();
+ // color = colorFinder.CreateNewColor();
// break;
// }
- // colorFinder.BelegeFarbe(color);
+ // colorFinder.AddColorToColorList(color);
// // Material for ants and flag
// Material material = new Material();
- // material.Emissive = Color.FromArgb(color.Rot, color.Grün, color.Blau);
+ // material.Emissive = Color.FromArgb(color.Red, color.Green, color.Blue);
// material.Specular = Color.FromArgb(200, 200, 200);
// antMaterial.Add(colony, material);
// // Material for markers
// material = new Material();
- // material.Ambient = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau);
- // material.Diffuse = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau);
- // material.Emissive = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau);
- // material.Specular = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau);
+ // material.Ambient = Color.FromArgb(MARKERTRANSPARENCY, color.Red, color.Green, color.Blue);
+ // material.Diffuse = Color.FromArgb(MARKERTRANSPARENCY, color.Red, color.Green, color.Blue);
+ // material.Emissive = Color.FromArgb(MARKERTRANSPARENCY, color.Red, color.Green, color.Blue);
+ // material.Specular = Color.FromArgb(MARKERTRANSPARENCY, color.Red, color.Green, color.Blue);
// markerMaterials.Add(colony, material);
// }
// }
diff --git a/FnaPlugin/RenderWindow.cs b/FnaPlugin/RenderWindow.cs
index 7b923c9..4e0c3ed 100644
--- a/FnaPlugin/RenderWindow.cs
+++ b/FnaPlugin/RenderWindow.cs
@@ -7,6 +7,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
+using Color = Microsoft.Xna.Framework.Color;
namespace AntMe.Plugin.Fna
{
@@ -229,7 +230,7 @@ protected override void Draw(GameTime gameTime)
Pickray pickray = camera.Pickray;
Point mousePosition = camera.MousePosition;
- // Selektionsinfos zurücksetzen
+ // reset selected item selection type
selectedItem.SelectionType = SelectionType.Nothing;
selectedItem.Item = null;
float distanceToSelectedItem = VIEWRANGE_MAX * VIEWRANGE_MAX;
@@ -385,10 +386,10 @@ protected override void Draw(GameTime gameTime)
{
case SelectionType.Ant:
- AntState ameise = (AntState)selectedItem.Item;
- string antName = NameHelper.GetFemaleName(ameise.Id);
+ AntState ant = (AntState)selectedItem.Item;
+ string antName = NameHelper.GetFemaleName(ant.Id);
line1 = string.Format(Strings.HovertextAntLine1, antName, selectedItem.AdditionalInfo);
- line2 = string.Format(Strings.HovertextAntLine2, ameise.Vitality);
+ line2 = string.Format(Strings.HovertextAntLine2, ant.Vitality);
break;
case SelectionType.Anthill:
line1 = Strings.HovertextAnthillLine1;
@@ -416,7 +417,7 @@ protected override void Draw(GameTime gameTime)
break;
}
- // Text an Mausposition ausgeben
+ // draw info tag at mouse position
if (line1 != String.Empty || line2 != String.Empty)
{
DrawInfoTag(mousePosition, line1, line2);
diff --git a/FnaPlugin/Selection.cs b/FnaPlugin/Selection.cs
index 9a17a7a..3439a4e 100644
--- a/FnaPlugin/Selection.cs
+++ b/FnaPlugin/Selection.cs
@@ -1,7 +1,7 @@
namespace AntMe.Plugin.Fna
{
///
- /// class, to hold selection-information.
+ /// Class, to hold selection information.
///
internal struct Selection
{
diff --git a/GdiPlusPlugin/AntInfoBox.cs b/GdiPlusPlugin/AntInfoBox.cs
index d61195f..33bffdf 100644
--- a/GdiPlusPlugin/AntInfoBox.cs
+++ b/GdiPlusPlugin/AntInfoBox.cs
@@ -3,12 +3,13 @@
using System;
using System.Drawing;
using System.Windows.Forms;
+using Color = System.Drawing.Color;
namespace AntMe.Plugin.GdiPlusPlugin
{
///
- /// Information-Kontrollelement fĂŒr Ameisen.
+ /// Ant information and control box.
///
internal class AntInfoBox : InfoBox
{
@@ -20,18 +21,21 @@ internal class AntInfoBox : InfoBox
private string casteColony;
///
- /// Erzeugt eine AntInfoBox-Instanz.
+ /// Constructor of new ant information box instance
///
- /// Die Ameise.
- /// Der Pinsel mit dem gezeichnet werden soll.
+ /// ant
+ /// colony ID
+ /// colony name
+ /// caste name
+ /// brush
public AntInfoBox(AntState ant, int colonyId, string colonyName, string casteName, Brush brush)
{
- // Setze GröĂe und Randabstand.
+ // set size and margin
Width = 150;
Height = 73;
Margin = new Padding(0);
- // Erzeuge die Hintergrund-Grafik und hole ihre ZeichenflÀche.
+ // bitmap image for background
bitmap = new Bitmap(Width, Height);
graphics = Graphics.FromImage(bitmap);
@@ -52,7 +56,7 @@ public int ColonyId
}
///
- /// Die Id der Ameise zu der Informationen dargestellt werden sollen.
+ /// Ant ID for information box.
///
public override int Id
{
@@ -60,7 +64,7 @@ public override int Id
}
///
- /// Die Ameise zu der Informationen dargestellt werden sollen.
+ /// Ant state for the information box.
///
public AntState Ant
{
@@ -72,23 +76,23 @@ public AntState Ant
}
///
- /// Zeichnet die Informationen neu.
+ /// Redraw ant information box.
///
- /// Ereignisargumente
+ /// event
protected override void OnPaint(PaintEventArgs e)
{
- // Lösche die ZeichenflÀche.
+ // Clear drawing area
graphics.Clear(Color.White);
float y = 0f;
- // Zeichne den Namen, die Kaste und das Volk.
+ // Draw name and caste
graphics.DrawString(name, boldFont, Brushes.Black, 0f, y);
y += 15f;
graphics.DrawString(casteColony, defaultFont, Brushes.Black, 0f, y);
y += 15f;
- // Berechne und zeichne den Richtungspfeil.
+ // Calculate and draw direction array
float xx, yy;
xx = 5f * (float)Math.Cos(ant.Direction * Math.PI / 180d);
yy = 5f * (float)Math.Sin(ant.Direction * Math.PI / 180d);
@@ -97,7 +101,7 @@ protected override void OnPaint(PaintEventArgs e)
arrow[2] = new PointF(15f - 3f * xx - yy, y + 15f - 3f * yy + xx);
graphics.FillPolygon(brush, arrow);
- // Zeichne Energie und Last.
+ // Draw energy and load
graphics.DrawString(ant.Vitality.ToString(), bigFont, Brushes.Red, 40f, y);
graphics.DrawString(ant.Load.ToString(), bigFont, Brushes.Green, 100f, y);
diff --git a/GdiPlusPlugin/BugInfoBox.cs b/GdiPlusPlugin/BugInfoBox.cs
index bdeb876..f5ae39e 100644
--- a/GdiPlusPlugin/BugInfoBox.cs
+++ b/GdiPlusPlugin/BugInfoBox.cs
@@ -3,12 +3,13 @@
using System;
using System.Drawing;
using System.Windows.Forms;
+using Color = System.Drawing.Color;
namespace AntMe.Plugin.GdiPlusPlugin
{
///
- /// Information-Kontrollelement fĂŒr Wanze.
+ /// Information control element for bug.
///
internal class BugInfoBox : InfoBox
{
@@ -17,17 +18,17 @@ internal class BugInfoBox : InfoBox
private PointF[] arrow = new PointF[3];
///
- /// Erzeugt eine BugInfoBox-Instanz.
+ /// Creates a BugInfoBox instance.
///
- /// Die Wanze.
+ /// bug state
public BugInfoBox(BugState bugState)
{
- // Setze GröĂe und Randabstand.
+ // Set size and margin.
Width = 150;
Height = 63;
Margin = new Padding(0);
- // Erzeuge die Hintergrund-Grafik und hole ihre ZeichenflÀche.
+ // Create the background graphic and get its drawing area.
bitmap = new Bitmap(Width, Height);
graphics = Graphics.FromImage(bitmap);
@@ -36,7 +37,7 @@ public BugInfoBox(BugState bugState)
}
///
- /// Die Id der Wanze zu der Informationen dargestellt werden sollen.
+ /// The ID of the bug for which information is to be displayed.
///
public override int Id
{
@@ -44,7 +45,7 @@ public override int Id
}
///
- /// Die Wanze deren Werte dargestellt werden sollen.
+ /// The bug whose values are to be displayed.
///
public BugState Bug
{
@@ -56,18 +57,18 @@ public BugState Bug
}
///
- /// Zeichnet die Informationen neu.
+ /// Draw new information
///
- /// Ereignisargumente
+ /// paint event argument
protected override void OnPaint(PaintEventArgs e)
{
- // Lösche die ZeichenflÀche.
+ // clear
graphics.Clear(Color.White);
- // Zeichne den Namen.
+ // draw name
graphics.DrawString(name, boldFont, Brushes.Black, 0f, 0f);
- // Berechne und zeichne den Richtungspfeil.
+ // calculate direction and draw arrow
float x, y;
x = 5f * (float)Math.Cos(bug.Direction * Math.PI / 180d);
y = 5f * (float)Math.Sin(bug.Direction * Math.PI / 180d);
@@ -76,7 +77,7 @@ protected override void OnPaint(PaintEventArgs e)
arrow[2] = new PointF(15f - 3f * x - y, 30f - 3f * y + x);
graphics.FillPolygon(Playground.bugBrush, arrow);
- // Zeichne die Energie.
+ // draw bug vitality
graphics.DrawString(bug.Vitality.ToString(), bigFont, Brushes.Red, 40f, 15f);
base.OnPaint(e);
diff --git a/GdiPlusPlugin/InfoBox.cs b/GdiPlusPlugin/InfoBox.cs
index c36572c..477bd03 100644
--- a/GdiPlusPlugin/InfoBox.cs
+++ b/GdiPlusPlugin/InfoBox.cs
@@ -5,32 +5,32 @@ namespace AntMe.Plugin.GdiPlusPlugin
{
///
- /// Basisklasse fĂŒr alle Information-Kontrollelemente.
+ /// Base class for all info control box.
///
internal abstract class InfoBox : Control
{
///
- /// Schriftart zur Anzeige der Informationen.
+ /// Bold and big fonts.
///
protected static Font boldFont, bigFont;
///
- /// Schriftart zur Anzeige der Informationen.
+ /// Default font for information.
///
protected static Font defaultFont;
///
- /// Der Name des Insekts.
+ /// Insect's name.
///
protected string name;
///
- /// Der statische Konstruktor.
+ /// Static constructor of info box.
///
static InfoBox()
{
- // Erzeuge die Schriftarten.
+ // Definition of the fonts.
defaultFont = new Font("Microsoft Sans Serif", 8.25f);
boldFont = new Font(defaultFont, FontStyle.Bold);
bigFont = new Font("Microsoft Sans Serif", 20f);
@@ -38,23 +38,23 @@ static InfoBox()
public InfoBox()
{
- // Sage Windows, daĂ wir das Puffern beim Zeichnen selbst ĂŒbernehmen.
+ // Buffering while drawing will be under control by AntMe.
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
UpdateStyles();
}
///
- /// Die Id des Insekts zu dem Informationen dargestellt werden sollen.
+ /// Public get ID of insect.
///
public abstract int Id { get; }
- // Die Hintergrund-Grafik und ihre ZeichenflÀche.
+ // Bitmap graphics for background and drawing area.
protected Bitmap bitmap;
protected Graphics graphics;
protected override void OnPaint(PaintEventArgs e)
{
- // Zeichne die Hintergrund-Grafik.
+ // Draw background bitmap graphics.
e.Graphics.DrawImageUnscaled(bitmap, 0, 0);
}
diff --git a/GdiPlusPlugin/Playground.cs b/GdiPlusPlugin/Playground.cs
index a85e0b8..ae66e4b 100644
--- a/GdiPlusPlugin/Playground.cs
+++ b/GdiPlusPlugin/Playground.cs
@@ -9,23 +9,22 @@ namespace AntMe.Plugin.GdiPlusPlugin
{
///
- /// Kontrollelement, das ein Spielfeld zeichnet.
+ /// Control element that draws a playground.
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal class Playground : Control
{
- // Verweis auf das ĂŒbergeordnete Fenster. Der Verweis kann auch ĂŒber
- // (Fenster)Control.Parent geholt werden, das geht aber erst wenn das
- // Kontrollelement dem Fenster hinzugefĂŒgt wurde. So ist es einfacher.
+ // Reference to the parent window. The reference can also be fetched via
+ // (window)Control.Parent, but this is only possible after the
+ // control has been added to the window. This way it is easier.
private Window window;
- // ZeichenflĂ€chen fĂŒr die Hintergrund-Grafik und das
- // Spielfeld-Kontrollelement.
+ // Drawing area for the background graphic and the playground control element.
private Bitmap bitmap;
private Graphics bitmapGraphics, controlGraphics;
///
- /// Gibt zurĂŒck oder legt fest ob die Punktetabelle angezeigt wird.
+ /// Specifies and defines whether the score chart should be displayed.
///
public bool ShowScore;
@@ -107,14 +106,14 @@ static Playground()
#endregion
///
- /// Erzeugt eine Playground-Instanz.
+ /// Instantiate a playground.
///
- /// Das ĂŒbergeordnete Fenster
+ /// the parent window
public Playground(Window window)
{
this.window = window;
- // Sage Windows, daĂ wir das Puffern beim Zeichnen selbst ĂŒbernehmen.
+ // Tell Windows that we will do the buffering ourselves when drawing.
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
UpdateStyles();
@@ -127,7 +126,7 @@ public Playground(Window window)
MouseDoubleClick += playground_MouseDoubleClick;
}
- #region Ereignisbehandlung
+ #region event handling
private List selectedAnts = new List();
private List selectedBugs = new List();
@@ -154,7 +153,7 @@ private void playground_KeyUp(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
- // Skalieren des Spielfelds mit der Maus.
+ // Scaling the playground with the mouse.
case Keys.ShiftKey:
if (shiftPressed)
{
@@ -163,7 +162,7 @@ private void playground_KeyUp(object sender, KeyEventArgs e)
}
break;
- // Drehen des Spielfelds mit der Maus.
+ // Rotating the playground with the mouse.
case Keys.ControlKey:
if (controlPressed)
{
@@ -178,7 +177,7 @@ private void playground_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
- // Skalieren des Spielfelds mit der Maus.
+ // Scaling the playground with the mouse.
case Keys.ShiftKey:
if (!shiftPressed)
{
@@ -187,7 +186,7 @@ private void playground_KeyDown(object sender, KeyEventArgs e)
}
break;
- // Drehen des Spielfelds mit der Maus.
+ // Rotating the playground with the mouse.
case Keys.ControlKey:
if (!controlPressed)
{
@@ -217,7 +216,7 @@ private void playground_MouseMove(object sender, MouseEventArgs e)
mouseY = e.Y;
}
- // Bestimme wie weit die Maus bewegt wurde.
+ // Determine how far the mouse has been moved.
deltaX = e.X - mouseX;
deltaY = e.Y - mouseY;
@@ -245,21 +244,23 @@ private void playground_MouseMove(object sender, MouseEventArgs e)
selectionY0 = mouseY + deltaY;
}
- // Zeichne nur dann, wenn der letzte Zeichenvorgang lange genug zurĂŒckliegt.
+ // Draw only if the last drawing operation was long enough ago.
if (DateTime.Now.Ticks - timeStamp > 400000)
Draw();
}
else if (e.Button == MouseButtons.Right)
{
- // Stelle die gesicherte Transformationsmatrix wieder her.
+ // Restore the saved transformation matrix.
transform = transformOld.Clone();
- // Die neue Transformationsmatrix ergibt sich aus der alten Matrix und der
- // Bewegung seit Beginn der Transformation. Das ist genauer und numerisch
- // stabiler (d.h. weniger Rechenfehler durch Zahlen nahe bei der Null)
- // als die Matrix immer nur ein klein wenig zu verÀndern.
+ // The new transformation matrix results from the old matrix and
+ // the movement since the beginning of the transformation.
+ // This is more accurate and numerically more stable (i.e. fewer
+ // calculation errors due to numbers close to zero) than always
+ // changing the matrix just a little bit.
+
- // Skaliere das Spielfeld.
+ // Scaling the playground.
if (shiftPressed)
{
float factor = (float)Math.Pow(1.01d, deltaX);
@@ -268,15 +269,15 @@ private void playground_MouseMove(object sender, MouseEventArgs e)
transform.Translate(Width / 2f, Height / 2f, MatrixOrder.Append);
}
- // Drehe das Spielfeld.
+ // Rotating the playground.
else if (controlPressed)
transform.RotateAt(deltaX, new PointF(Width / 2f, Height / 2f), MatrixOrder.Append);
- // Verschiebe das Spielfeld.
+ // Moving the playground.
else
transform.Translate(deltaX, deltaY, MatrixOrder.Append);
- // Zeichne nur dann, wenn der letzte Zeichenvorgang lange genug zurĂŒckliegt.
+ // Draw only if the last drawing operation was long enough ago.
if (DateTime.Now.Ticks - timeStamp > 400000)
Draw();
}
@@ -290,24 +291,23 @@ private void playground_MouseUp(object sender, MouseEventArgs e)
selectedAnts.Clear();
selectedBugs.Clear();
- // Erzeuge ein Array fĂŒr die Koordinaten aller KĂ€fer.
+ // Create an array for the coordinates of all bugs.
points = new PointF[window.State.BugStates.Count];
- // Kopiere die Koordinaten in das Array.
+ // Copy the coordinates into the array.
for (int k = 0; k < points.Length; k++)
points[k] = new PointF(window.State.BugStates[k].PositionX, window.State.BugStates[k].PositionY);
- // Transfomiere die Koordinaten.
+ // Transform the coordinates.
transform.TransformPoints(points);
- // FĂŒge alle KĂ€fer die sich innerhalb des Auswahlrechtecks befinden
- // der Liste der ausgewÀhlten KÀfer hinzu.
+ // Add all bugs that are inside the selection rectangle to the list of selected bugs.
for (int k = 0; k < points.Length; k++)
if (points[k].X >= selectionX0 && points[k].X <= selectionX1 && points[k].Y >= selectionY0 &&
points[k].Y <= selectionY1)
selectedBugs.Add(window.State.BugStates[k].Id);
- // Das selbe fĂŒr die Ameisen aller Völker.
+ // The same for the ants for all colonies.
for (int v = 0; v < window.State.ColonyStates.Count; v++)
{
@@ -327,7 +327,7 @@ private void playground_MouseUp(object sender, MouseEventArgs e)
selectedAnts.Add(window.State.ColonyStates[v].AntStates[a].Id);
}
- // Gib die Auswahl an das ĂŒbergeordnete Fenster weiter.
+ // Pass the selection to the parent window.
window.ShowInformation(selectedBugs, selectedAnts);
selectionX0 = -1;
@@ -343,7 +343,7 @@ private void playground_MouseWheel(object sender, MouseEventArgs e)
transform.Scale(factor, factor, MatrixOrder.Append);
transform.Translate(Width / 2f, Height / 2f, MatrixOrder.Append);
- // Zeichne nur dann, wenn der letzte Zeichenvorgang lange genug zurĂŒckliegt.
+ // Draw only if the last drawing operation was long enough ago.
if (DateTime.Now.Ticks - timeStamp > 400000)
Draw();
}
@@ -353,7 +353,7 @@ private void playground_MouseDoubleClick(object sender, MouseEventArgs e)
if (e.Button == MouseButtons.Left)
ResetSelection();
- // Zeichne nur dann, wenn der letzte Zeichenvorgang lange genug zurĂŒckliegt.
+ // Draw only if the last drawing operation was long enough ago.
Draw();
}
@@ -367,34 +367,33 @@ public void ResetSelection()
#endregion
///
- /// Zeichnet das Spielfeld in die Hintergrund-Grafik und diese auf das
- /// Kontrollelement.
+ /// Draws the playground into the background graphic and this onto the control element.
///
public void Draw()
{
- // Brich ab, falls die Hintergrund-ZeichenflÀche noch nicht existiert.
+ // Cancel if the background drawing area does not exist yet.
if (bitmapGraphics == null)
return;
int a, b, k, m, o, v, z;
- // Erzeuge in der ersten Runde nötige Objekte.
+ // Create necessary objects in the first round.
if (window.State.CurrentRound == 1)
{
playgroundRectangle = new Rectangle(0, 0, window.State.PlaygroundWidth, window.State.PlaygroundHeight);
ResetView();
}
- // Setze die Transformationsmatrix fĂŒr das Spielfeld. Dadurch können wir
- // in Spielfeldkoordinaten zeichnen, egal wie das Fenster aussieht.
+ // Set the transformation matrix for the playground. This allows us to draw
+ // in playground coordinates no matter what the window looks like.
bitmapGraphics.Transform = transform.Clone();
- // Zeichne den Himmel und das Spielfeld.
+ // Draw the sky and the playground.
bitmapGraphics.Clear(skyColor);
bitmapGraphics.FillRectangle(playgroundBrush, playgroundRectangle);
- // Zeichne die Markierungen aller Völker.
+ // Draw the markers of all colonies.
for (v = 0; v < window.State.ColonyStates.Count; v++)
{
SolidBrush brush = window.State.ColonyStates.Count == 1
@@ -411,7 +410,7 @@ public void Draw()
window.State.ColonyStates[v].MarkerStates[m].Radius * 2f);
}
- // Zeichne die Bauten aller Völker.
+ // Draw ant hills for all colonies.
for (v = 0; v < window.State.ColonyStates.Count; v++)
for (b = 0; b < window.State.ColonyStates[v].AnthillStates.Count; b++)
{
@@ -429,14 +428,14 @@ public void Draw()
window.State.ColonyStates[v].AnthillStates[b].PositionY - 20f);
}
- // Zeichne alle Zuckerhaufen.
+ // Draw all sugar piles.
for (z = 0; z < window.State.SugarStates.Count; z++)
bitmapGraphics.FillEllipse
(sugarBrush, window.State.SugarStates[z].PositionX - window.State.SugarStates[z].Radius,
window.State.SugarStates[z].PositionY - window.State.SugarStates[z].Radius,
window.State.SugarStates[z].Radius * 2f, window.State.SugarStates[z].Radius * 2f);
- // Markiere die ausgewÀhlten Wanzen.
+ // Mark the selected bugs.
if (selectedBugs.Count > 0)
for (k = 0; k < window.State.BugStates.Count; k++)
if (selectedBugs.Contains(window.State.BugStates[k].Id))
@@ -444,7 +443,7 @@ public void Draw()
(selectionBrush, window.State.BugStates[k].PositionX - 12f,
window.State.BugStates[k].PositionY - 12f, 24f, 24f);
- // Zeichne alle Wanzen.
+ // Draw all bugs.
for (k = 0; k < window.State.BugStates.Count; k++)
bitmapGraphics.DrawLine
(bugPen, window.State.BugStates[k].PositionX - cos4[window.State.BugStates[k].Direction],
@@ -452,7 +451,7 @@ public void Draw()
window.State.BugStates[k].PositionX + cos4[window.State.BugStates[k].Direction],
window.State.BugStates[k].PositionY + sin4[window.State.BugStates[k].Direction]);
- // Markiere die ausgewÀhlten Ameisen.
+ // Mark the selected ants.
if (selectedAnts.Count > 0)
for (v = 0; v < window.State.ColonyStates.Count; v++)
for (a = 0; a < window.State.ColonyStates[v].AntStates.Count; a++)
@@ -461,7 +460,7 @@ public void Draw()
(selectionBrush, window.State.ColonyStates[v].AntStates[a].PositionX - 8f,
window.State.ColonyStates[v].AntStates[a].PositionY - 8f, 16f, 16f);
- // Zeichne die Ameisen aller Völker.
+ // Draw ants for all colonies.
for (v = 0; v < window.State.ColonyStates.Count; v++)
for (a = 0; a < window.State.ColonyStates[v].AntStates.Count; a++)
{
@@ -489,18 +488,17 @@ public void Draw()
sin1[window.State.ColonyStates[v].AntStates[a].Direction]);
}
- // Zeichne alle ObststĂŒcke.
+ // Draw all fruits.
for (o = 0; o < window.State.FruitStates.Count; o++)
bitmapGraphics.FillEllipse
(fruitBrush, window.State.FruitStates[o].PositionX - window.State.FruitStates[o].Radius,
window.State.FruitStates[o].PositionY - window.State.FruitStates[o].Radius,
window.State.FruitStates[o].Radius * 2, window.State.FruitStates[o].Radius * 2);
- // Setze die Einheitsmatrix als Transformationsmatrix. Damit zeichnen
- // wir jetzt wieder in Fensterkoordinaten.
+ // Set the unit matrix as the transformation matrix. With this we now draw in window coordinates again.
bitmapGraphics.Transform = new Matrix();
- // Auswahlrechteck.
+ // Rectangle of selection.
if (selectionX0 > -1)
{
bitmapGraphics.FillRectangle
@@ -516,14 +514,14 @@ public void Draw()
timeStamp = DateTime.Now.Ticks;
- // Zeichne die Hintergrund-Grafik auf das Fenster.
+ // Draw the background graphic on the window.
OnPaint(new PaintEventArgs(controlGraphics, ClientRectangle));
}
- // Zeichnet Punkte als Tabelle und richtet Spalten nach Textlaenge aus, 18f horizontaler Abstand
+ // Draws points as table and aligns columns by text length, 18f horizontal spacing.
private void DrawScore()
{
- // Merke die Texte zum Ausgeben
+ // Remember the texts for output.
string[][] renderElements = new string[window.State.ColonyStates.Count + 1][];
renderElements[0] = new string[]
{
@@ -535,7 +533,7 @@ private void DrawScore()
Resource.Points
};
- // fuelle die Tabelle mit Zahlen der Voelker
+ // Fill the table with numbers for the colonies.
for (int currentRenderElementY = 1; currentRenderElementY < renderElements.Length; currentRenderElementY++)
{
renderElements[currentRenderElementY] = new string[]
@@ -551,7 +549,7 @@ private void DrawScore()
};
}
- // Merke die Laenge der Texte zum Ausgeben, eine Extrazeile fuer die Max Laengen pro Spalte
+ // Note the length of the texts for output, an extra line for the max lengths per column.
float[][] renderSizes = new float[renderElements.Length + 1][];
for (int currentRenderSizeY = 0; currentRenderSizeY < renderSizes.Length - 1; currentRenderSizeY++)
{
@@ -564,10 +562,10 @@ private void DrawScore()
}
}
- // Gesamtbreite der Tabelle
+ // Total table width.
float totalWidth = 0;
- // Berechne Max-Laenge pro Spalte
+ // Calculate max length per column.
renderSizes[renderElements.Length] = new float[renderElements[0].Length];
for (int currentRenderSizeX = 0; currentRenderSizeX < renderElements[0].Length; currentRenderSizeX++)
{
@@ -585,13 +583,13 @@ private void DrawScore()
totalWidth += maxLength + 18f;
}
- // Zeichne den Hintergrund des Punktekastens.
+ // Draw the background for the score table box.
bitmapGraphics.FillRectangle
(scoreBrush, 10f, 10f, totalWidth, renderElements.Length * 16f + 18f);
float y = 20f;
- // Zeichne alle Text-Elemente an den jeweiligen Positionen
+ // Draw all text elements at the their positions
for (int currentRenderElementY = 0; currentRenderElementY < renderElements.Length; currentRenderElementY++)
{
if (currentRenderElementY != 0)
@@ -611,21 +609,21 @@ private void DrawScore()
}
///
- /// Zeichnet die Hintergrund-Grafik auf das Kontrollelement.
+ /// Draws the background graphic on the control element.
///
///
protected override void OnPaint(PaintEventArgs e)
{
- // Zeichne die Hintergrund-Grafik auf das Fenster.
+ // Draw the background graphic on the window.
if (bitmap != null)
e.Graphics.DrawImageUnscaled(bitmap, 0, 0);
}
- // Die Hintergrund-Grafik in die das Spielfeld gezeichnet wird. Durch das
- // Verwenden eines Puffers wird das Flimmern beim Neuzeichnen verhindert.
+ // The background graphic into which the playground is drawn.
+ // The use of a buffer prevents flickering during redrawing.
///
- /// Erzwingt das Resize Ereignis.
+ /// Forces the resize event.
///
public void DoResize()
{
@@ -633,36 +631,36 @@ public void DoResize()
}
///
- /// Passt die GröĂe des Spielfeldes innerhalb des Kontrollelementes an.
+ /// Adjusts the size of the playground inside the control element.
///
///
protected override void OnResize(EventArgs e)
{
- // Brich ab, falls noch kein Zustand ĂŒbergeben wurde.
+ // Cancel if no state has been passed yet.
if (window.State == null)
return;
- // Erzeuge die ZeichenflÀche des Kontrollelements.
+ // Create the drawing area of the control element.
controlGraphics = CreateGraphics();
- // Erzeuge die Hintergrund-Grafik und die zugehörige ZeichenflÀche.
+ // Create the background graphic and the associated drawing area
bitmap = new Bitmap(Width, Height);
bitmapGraphics = Graphics.FromImage(bitmap);
- // Schalte das Anti-Aliasing ein bzw. aus.
+ // Turn anti aliasing on or off.
bitmapGraphics.SmoothingMode =
window.UseAntiAliasing ? SmoothingMode.HighQuality : SmoothingMode.HighSpeed;
- // Zeichne das Spielfeld neu.
+ // Redraw the playground.
Draw();
}
///
- /// Setzt die Ansicht des Spielfeldes zurĂŒck.
+ /// Resets the view of the playground.
///
public void ResetView()
{
- // Berechne den Skalierungsfaktor und den linken und oberen Versatz.
+ // Calculate the scale factor and the left and top offsets.
float xScale = Width / (float)window.State.PlaygroundWidth;
float yScale = Height / (float)window.State.PlaygroundHeight;
float scale = Math.Min(xScale, yScale);
@@ -671,7 +669,7 @@ public void ResetView()
float xOffset = (Width - width) / 2f;
float yOffset = (Height - height) / 2f;
- // Berechne die Transformationsmatrix fĂŒr das Spielfeld.
+ // Calculate the transformation matrix for the playground.
transform = new Matrix();
transform.Translate(xOffset, yOffset);
transform.Scale(scale, scale);
diff --git a/GdiPlusPlugin/Plugin.cs b/GdiPlusPlugin/Plugin.cs
index 7c02444..978b298 100644
--- a/GdiPlusPlugin/Plugin.cs
+++ b/GdiPlusPlugin/Plugin.cs
@@ -8,7 +8,7 @@ namespace AntMe.Plugin.GdiPlusPlugin
{
///
- /// AntMe! Verbraucher-Plugin das ein Spiel in einer GDI+ basierten 2D-Ansicht darstellt.
+ /// AntMe! consumer plugin that displays a game in a GDI+ based 2D view.
///
/// Wolfgang Gallo (wolfgang@antme.net)
public class Plugin : IConsumerPlugin
@@ -18,7 +18,7 @@ public class Plugin : IConsumerPlugin
private Window window;
///
- /// Erzeugt eine neue Instanz der Plugin-Klasse.
+ /// Creates a new instance of the plugin class.
///
public Plugin()
{
@@ -30,7 +30,7 @@ public Plugin()
private PluginState pluginStatus = PluginState.Ready;
///
- /// Funktionsaufruf zum Starten des Plugin-Betriebs.
+ /// Function call to start the plugin operation.
///
public void Start()
{
@@ -39,7 +39,7 @@ public void Start()
}
///
- /// Funktionsaufruf zum Stoppen des Plugin-Betriebs.
+ /// Function call to stop the plugin operation.
///
public void Stop()
{
@@ -48,7 +48,7 @@ public void Stop()
}
///
- /// Hält den Betrieb des Plugins an.
+ /// Pauses the operation of the plugin.
///
public void Pause()
{
@@ -56,28 +56,28 @@ public void Pause()
}
///
- /// Gibt den Namen des Plugins zurück.
+ /// Returns the name of the plugin.
///
public string Name
{
- get { return "2D-Visualisierung"; }
+ get { return "2D visualization"; }
}
///
- /// Gibt einen Beschreibungstext dieses Plugins zurück.
+ /// Returns a description text of this plugin.
///
public string Description
{
- get { return "Zeigen Sie die Simulation in einer 2D-Welt an"; }
+ get { return "Show the simulation in a 2D world."; }
}
///
- /// Gibt die Versionsnummer dieses Plugins zurück.
+ /// Returns the version number of this plugin.
///
public Version Version => version;
///
- /// Gibt die GUID dieses Plugins zurück.
+ /// Returns the GUID of this plugin.
///
public Guid Guid
{
@@ -85,7 +85,7 @@ public Guid Guid
}
///
- /// Liefert den aktuellen Status des Plugins zurück.
+ /// Returns the current state of the plugin.
///
public PluginState State
{
@@ -93,8 +93,7 @@ public PluginState State
}
///
- /// Liefert einen Verweis auf ein UserControl das im Hauptfenster
- /// angezeigt wird.
+ /// Returns a reference to a UserControl that is displayed in the main window.
///
public Control Control
{
@@ -102,8 +101,7 @@ public Control Control
}
///
- /// Gibt einen Bytearray aus serialisierten Konfigurationsdaten dieses
- /// Plugins zurück oder legt diesen fest.
+ /// Returns or sets a byte array of serialized configuration data from this plugin.
///
public byte[] Settings
{
@@ -146,9 +144,9 @@ public bool Interrupt
{
get
{
- // Wenn das Spiel läuft oder pausiert ist (also nicht nur bereit)
- // und das Fenster nicht sichtbar, dann wurde es geschlossen und
- // die Simulation kann abgebrochen werden.
+ // If the game is running or paused (and not just ready)
+ // and the window is not visible, then it has been closed
+ // and the simulation can be stopped.
return (pluginStatus != PluginState.Ready && !window.Visible);
}
}
diff --git a/GdiPlusPlugin/Window.Designer.cs b/GdiPlusPlugin/Window.Designer.cs
index 4f9f6ad..8a77c64 100644
--- a/GdiPlusPlugin/Window.Designer.cs
+++ b/GdiPlusPlugin/Window.Designer.cs
@@ -1,14 +1,14 @@
ï»żnamespace AntMe.Plugin.GdiPlusPlugin {
partial class Window {
///
- /// Erforderliche Designervariable.
+ /// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
- /// Verwendete Ressourcen bereinigen.
+ /// Clean up used resources.
///
- /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
+ /// True if managed resources are to be deleted; otherwise False.
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
@@ -16,11 +16,11 @@ protected override void Dispose(bool disposing) {
base.Dispose(disposing);
}
- #region Vom Windows Form-Designer generierter Code
+ #region Code generated by Windows Form Designer
///
- /// Erforderliche Methode fĂŒr die DesignerunterstĂŒtzung.
- /// Der Inhalt der Methode darf nicht mit dem Code-Editor geÀndert werden.
+ /// Required method for designer support. The content of the method
+ /// must not be changed with the code editor.
///
private void InitializeComponent() {
System.Windows.Forms.Label label4;
diff --git a/GdiPlusPlugin/Window.cs b/GdiPlusPlugin/Window.cs
index 86f5e7a..f92b182 100644
--- a/GdiPlusPlugin/Window.cs
+++ b/GdiPlusPlugin/Window.cs
@@ -7,41 +7,40 @@ namespace AntMe.Plugin.GdiPlusPlugin
{
///
- /// Fenster für die 2D-Anzeige.
+ /// Window for 2D-display.
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal partial class Window : Form
{
- // Das Spielfeld-Kontrollelement.
+ // The playground control element.
private Playground playground;
///
- /// Stellt dem Spielfeld-Kontrollelement den Zustand zur Verfügung.
+ /// Provides the state to the playground control element.
///
public SimulationState State = null;
///
- /// Der Fenster-Konstruktor.
+ /// The window constructor.
///
public Window()
{
- // Initialisiert das Fenster wie im Designer in Visual Studio festgelegt.
+ // Initializes the window as set in the Designer in Visual Studio.
InitializeComponent();
- // Sage Windows, daß wir das Puffern beim Zeichnen selbst übernehmen.
+ // Tell Windows that we will do the buffering ourselves when drawing.
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
UpdateStyles();
- // Erzeuge das Spielfeld-Kontrollelement und füge es dem Fenster hinzu.
+ // Create the playfield control and add it to the window.
playground = new Playground(this);
playground.Dock = DockStyle.Fill;
splitContainer.Panel1.Controls.Add(playground);
}
///
- /// Gibt an und legt fest, ob mit eingeschaltetem Anti-Aliasing gezeichnet
- /// werden soll.
+ /// Specifies and sets whether to draw with anti-aliasing turned on.
///
public bool UseAntiAliasing
{
@@ -50,7 +49,7 @@ public bool UseAntiAliasing
}
///
- /// Gibt an und legt fest, ob die Punkte der Spieler angezeigt werden sollen.
+ /// Specifies and defines whether the score chart should be displayed.
///
public bool ShowScore
{
@@ -59,7 +58,7 @@ public bool ShowScore
}
///
- /// Startet das Zeichnen des Spiels.
+ /// Starts drawing of the game.
///
public void Start()
{
@@ -68,7 +67,7 @@ public void Start()
}
///
- /// Stoppt das Zeichnen des Spiels.
+ /// Stops drawing of the game.
///
public void Stop()
{
@@ -77,74 +76,72 @@ public void Stop()
}
///
- /// Stellt einen Zustand auf dem Spielfeld und in den Infokästen dar.
+ /// Represents state off the field and in the info boxes.
///
- ///
+ /// state of simulation
public void Update(SimulationState state)
{
- // Wird zum ersten Mal gezeichnet?
+ // Is this the first time drawing?
bool doResize = State == null;
- // Speichere den Zustand.
+ // Save state.
State = state;
- // Erzwinge das Erzeugen einer neuen Hintergrund-Grafik, wenn zum ersten
- // Mal gezeichnet wird.
+ // Force a new background graphic to be created when drawing for the first time.
if (doResize)
playground.DoResize();
- // Aktualisiere die Informationen und zeichne das Spielfeld.
+ // Update the information and draw the playground.
updateInformation();
playground.Draw();
- // Lass Windows Ereignisse bearbeiten.
+ // Let Windows handle events.
Application.DoEvents();
}
///
- /// Aktualisiert die dargestellten InfoKasten Objekte.
+ /// Refreshes the displayed InfoBox objects.
///
private void updateInformation()
{
- // Die aktuellen Werte aller Insekten sind als Klassen im Zustand
- // gespeichert. Hier in der 2D-Anzeige werden diese Werte auf das Spiel-
- // feld gezeichnet und in Informationskästen angezeigt. Diese Kästen sind
- // für Windows Kontrollemente und ihre Erzeugung ist teuer, d.h. sie
- // kostet relativ viel Zeit. Daher werden sie nicht in jeder Runde neu
- // erzeugt, sondern so lange weiterverwendet, wie das zugehörende Insekt
- // am Leben ist.
-
- // Um die Kästen zu aktualisieren, müssen die Strukturen im Zustand mit
- // den Objekten von hier abgeglichen werden. Der Abgleich erfolgt über
- // die eindeutige Id aller Insekten. Die folgende Schleife ist dafür
- // zuständig, diese Aktualisierung möglichst schnell durchzuführen. Sie
- // läuft dazu gleichzeitig über die vorhandenen InfoKästen und die
- // Insekten im Zustand. Pro Durchlauf der Schleife wird in einer oder in
- // beiden Listen zum Nächsten Element übergegangen.
-
- // Vorraussetzung für diesen Algorithmus ist es, daß die Ids in beiden
- // Listen aufsteigend sortiert sind, und das ein neues Insekt eine Id
- // hat, die noch nicht verwendet wurde und höher ist als alle bisher
- // verwendeten Ids. Die Simulation erfüllt diese Vorraussetzungen.
-
- // In der WPF-Anzeige ist dieser Algorithmus in sehr änhlicher Form
- // ebenfalls enthalten und erfüllt die selbe Aufgabe.
+ // The current values of all insects are stored as classes in the state.
+ // Here in the 2D-display these values are drawn on the playground and
+ // displayed in information boxes. These boxes are control elements for
+ // Windows and their generation is expensive. The generation consumes
+ // relatively much time. Therefore, they are not generated every turn,
+ // but are used as long as the corresponding insect is alive.
+
+ // To update the boxes, the structures in the state must be matched with the
+ // objects from here. The matching is done using the unique ID of all insects.
+ // The following loop is responsible for performing this update as quickly as
+ // possible. It runs simultaneously over the existing info boxes and the insects
+ // in the state. Each time the loop runs, it moves to the next element in one
+ // or both lists.
+
+ // The prerequisite for this algorithm are:
+ // 1) the IDs in both lists are sorted in ascending order
+ // 2) a new insect has an ID that has not yet been used
+ // 3) the ID is higher than all previously used Ids
+ // The simulation fulfills these requirements.
+
+ // This algorithm is also included in the WPF display in a very similar way and
+ // performs the same task.
AntInfoBox antbox;
BugInfoBox bugbox;
- int i = 0; // Index der InfoBox
- int a = 0; // Index der Ameise im Zustand
- int b = 0; // Index der Wanze im Zustand
+ int i = 0; // Index of InfoBox
+ int a = 0; // Index of ant in state
+ int b = 0; // Index of bug in state
- // Aktualisiere die BugInfoBox-Instanzen.
+ // Update the bug InfoBox instances.
while (i < insectsPanel.Controls.Count && b < State.BugStates.Count)
{
- // Wandle das aktuelle Kontrollelement in einen BugInfoBox um.
+ // Convert the current control into a BugInfoBox.
bugbox = insectsPanel.Controls[i] as BugInfoBox;
- // Wenn es keine BugInfoBox ist, muß es eine AntInfoBox sein. Also
- // weiter zur nächsten Schleife.
+ // If it is not a BugInfoBox, it must be an AntInfoBox.
+ // So let's move on to the next loop.
if (bugbox == null)
break;
@@ -164,29 +161,27 @@ private void updateInformation()
{
a = 0;
- // Aktualisiere die AmeisenKästen.
+ // Update the ant InfoBox instances.
while (i < insectsPanel.Controls.Count && a < State.ColonyStates[c].AntStates.Count)
{
- // Wandle das aktuelle Kontrollelement in einen AmeisenKasten um.
- // Hier kann es nur noch ein AmeisenKasten sein.
+ // Convert the current control into a ant InfoBox.
+ // It must be an AntInfoBox.
antbox = (AntInfoBox)insectsPanel.Controls[i];
- // Wenn der Kasten zu einem neuen Volk gehört, dann weiter zur nächsten
- // Schleife.
+ // If the box belongs to a new colony move on to the next loop.
if (antbox.ColonyId != State.ColonyStates[c].Id)
break;
- // Wenn die Id des AmeisenKasten kleiner ist als die Id der aktuellen
- // Ameise im Zustand, dann ist die Ameise für die der Kasten
- // Informationen liefert, nicht mehr um Zustand enthalten, d.h. die
- // Ameise ist gestorben. Der Kasten kann also entfernt werden. Dadurch
- // rücken die folgenden Kästen nach vorne, der Index muß also nicht
- // erhöht werden.
+ // If the ID of the ant box is smaller than the ID of the current ant
+ // in the state, then this ant is no longer included in the state.
+ // That means the ant has died. So the box can be removed.
+ // This moves the following boxes forward.
+ // There is no need to change the indices.
if (antbox.Id < State.ColonyStates[c].AntStates[a].Id)
insectsPanel.Controls.RemoveAt(i);
- // Wenn die Ids übereinstimmen, dann aktualisiere die Informationen
- // und rücke in beiden Listen zum nächsten Element vor.
+ // If the ids match, then update the information and go forward
+ // to the next item in both lists.
else if (antbox.Id == State.ColonyStates[c].AntStates[a].Id)
{
antbox.Ant = State.ColonyStates[c].AntStates[a];
@@ -194,7 +189,7 @@ private void updateInformation()
a++;
}
- // Ansonten fahre mit der nächsten Ameise im Zustand fort.
+ // Otherwise, continue with the next ant in the state.
else
a++;
}
@@ -202,23 +197,19 @@ private void updateInformation()
}
///
- /// Erzeugt InfoKasten Objekte zur Anzeige von Informationen und stellt
- /// diese dar.
+ /// Creates InfoBox objects for displaying information and displays them.
///
public void ShowInformation(List selectedBugs, List selectedAnts)
{
- // Brich ab, falls noch kein Zustand übergeben wurde.
+ // Cancel if no state has been passed yet.
if (State == null)
return;
- // Sage Windows, daß wir jetzt größere Änderungen an den Kontroll-
- // elementen in dem Panel vornehmen.
+ // Tell Windows we are now making major changes to the controls in the panel.
insectsPanel.SuspendLayout();
insectsPanel.Controls.Clear();
- // Erzeuge InfoKästen für alle Insekten, die innerhalb des Auswahl-
- // rechtecks liegen.
-
+ // Create info boxes for all insects that lie within the selection rectangle.
if (selectedBugs.Count > 0)
for (int b = 0; b < State.BugStates.Count; b++)
if (selectedBugs.Contains(State.BugStates[b].Id))
@@ -246,38 +237,35 @@ public void ShowInformation(List selectedBugs, List selectedAnts)
v++;
}
- // Sage Windows, daß die Änderungen abgeschlossen sind.
+ // Tell Windows that the changes are complete.
insectsPanel.ResumeLayout();
}
- // Wird aufgerufen, wenn der Schließen Knopf des Fensters gedrückt wurde.
+ // Called when the close button of the window is pressed.
private void Window_FormClosing(object sender, FormClosingEventArgs e)
{
- // Verhindere, daß das Fenster geschlossen, d.h. das Fenster-Objekt
- // zerstört wird. Verstecke das Fenster stattdessen.
+ // Prevent the window from being closed, i.e. the window object
+ // from being is destroyed. Hide the window instead.
e.Cancel = true;
Hide();
}
- // Wird aufgerufen, wenn die Checkbox für das Anti-Aliasing ihren Status
- // geändert hat.
+ // Called when the anti-aliasing checkbox has changed its state.
private void antialiasingCheckbox_CheckedChanged(object s, EventArgs e)
{
- // Erzwinge das Erzeugen einer neuen Hintergrund-Grafik, damit die
- // Anti-Aliasing Einstellung übernommen wird.
+ // Force a new background graphic to be created so that the
+ // anti-aliasing setting is applied.
playground.DoResize();
}
- // Wird aufgerufen, wenn die Checkbox für das Zeigen der Punktetabelle
- // ihren Status geändert hat.
+ // Called when the checkbox for showing the charts table has changed its status.
private void showPointsCheckbox_CheckedChanged(object sender, EventArgs e)
{
playground.ShowScore = cbShowScore.Checked;
playground.DoResize();
}
- // Wird aufgerufen, wenn der Knopf für das Zurücksetzen der Ansicht
- // gedrückt wurde.
+ // Called when the button for resetting the view is pressed.
private void resetButton_Click(object sender, EventArgs e)
{
playground.ResetView();
diff --git a/PlayerManagement/AntProperties.Designer.cs b/PlayerManagement/AntProperties.Designer.cs
index 89943db..71f9232 100644
--- a/PlayerManagement/AntProperties.Designer.cs
+++ b/PlayerManagement/AntProperties.Designer.cs
@@ -34,29 +34,29 @@ private void InitializeComponent()
this.tabControl = new System.Windows.Forms.TabControl();
this.common = new System.Windows.Forms.TabPage();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.klassennameTextBox = new System.Windows.Forms.TextBox();
+ this.classnameTextBox = new System.Windows.Forms.TextBox();
this.label28 = new System.Windows.Forms.Label();
- this.dateinameTextBox = new System.Windows.Forms.TextBox();
- this.statischLabel = new System.Windows.Forms.Label();
+ this.filenameTextBox = new System.Windows.Forms.TextBox();
+ this.staticLabel = new System.Windows.Forms.Label();
this.label30 = new System.Windows.Forms.Label();
this.debugLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
- this.datumLabel = new System.Windows.Forms.Label();
- this.dateigröĂeLabel = new System.Windows.Forms.Label();
- this.spracheLabel = new System.Windows.Forms.Label();
+ this.dateLabel = new System.Windows.Forms.Label();
+ this.fileSizeLabel = new System.Windows.Forms.Label();
+ this.languageLabel = new System.Windows.Forms.Label();
this.versionLabel = new System.Windows.Forms.Label();
- this.autorLabel = new System.Windows.Forms.Label();
+ this.authorLabel = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.label24 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
- this.kiNameLabel1 = new System.Windows.Forms.Label();
+ this.aiNameLabel1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.castes = new System.Windows.Forms.TabPage();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
- this.kiNameLabel2 = new System.Windows.Forms.Label();
+ this.aiNameLabel2 = new System.Windows.Forms.Label();
this.label29 = new System.Windows.Forms.Label();
this.casteGroupBox = new System.Windows.Forms.GroupBox();
this.rangeLabel = new System.Windows.Forms.Label();
@@ -80,12 +80,12 @@ private void InitializeComponent()
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.security = new System.Windows.Forms.TabPage();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
- this.zusatzinfosTextBox = new System.Windows.Forms.TextBox();
- this.kiNameLabel3 = new System.Windows.Forms.Label();
+ this.additionalInformationTextBox = new System.Windows.Forms.TextBox();
+ this.aiNameLabel3 = new System.Windows.Forms.Label();
this.label31 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
- this.rechteListView = new System.Windows.Forms.ListView();
+ this.securityListView = new System.Windows.Forms.ListView();
this.tabControl.SuspendLayout();
this.common.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -116,25 +116,25 @@ private void InitializeComponent()
//
resources.ApplyResources(this.common, "common");
this.common.Controls.Add(this.pictureBox1);
- this.common.Controls.Add(this.klassennameTextBox);
+ this.common.Controls.Add(this.classnameTextBox);
this.common.Controls.Add(this.label28);
- this.common.Controls.Add(this.dateinameTextBox);
- this.common.Controls.Add(this.statischLabel);
+ this.common.Controls.Add(this.filenameTextBox);
+ this.common.Controls.Add(this.staticLabel);
this.common.Controls.Add(this.label30);
this.common.Controls.Add(this.debugLabel);
this.common.Controls.Add(this.label4);
- this.common.Controls.Add(this.datumLabel);
- this.common.Controls.Add(this.dateigröĂeLabel);
- this.common.Controls.Add(this.spracheLabel);
+ this.common.Controls.Add(this.dateLabel);
+ this.common.Controls.Add(this.fileSizeLabel);
+ this.common.Controls.Add(this.languageLabel);
this.common.Controls.Add(this.versionLabel);
- this.common.Controls.Add(this.autorLabel);
+ this.common.Controls.Add(this.authorLabel);
this.common.Controls.Add(this.label27);
this.common.Controls.Add(this.label26);
this.common.Controls.Add(this.label25);
this.common.Controls.Add(this.label24);
this.common.Controls.Add(this.label23);
this.common.Controls.Add(this.label22);
- this.common.Controls.Add(this.kiNameLabel1);
+ this.common.Controls.Add(this.aiNameLabel1);
this.common.Controls.Add(this.label3);
this.common.Name = "common";
this.common.UseVisualStyleBackColor = true;
@@ -148,9 +148,9 @@ private void InitializeComponent()
//
// klassennameTextBox
//
- resources.ApplyResources(this.klassennameTextBox, "klassennameTextBox");
- this.klassennameTextBox.Name = "klassennameTextBox";
- this.klassennameTextBox.ReadOnly = true;
+ resources.ApplyResources(this.classnameTextBox, "klassennameTextBox");
+ this.classnameTextBox.Name = "klassennameTextBox";
+ this.classnameTextBox.ReadOnly = true;
//
// label28
//
@@ -159,14 +159,14 @@ private void InitializeComponent()
//
// dateinameTextBox
//
- resources.ApplyResources(this.dateinameTextBox, "dateinameTextBox");
- this.dateinameTextBox.Name = "dateinameTextBox";
- this.dateinameTextBox.ReadOnly = true;
+ resources.ApplyResources(this.filenameTextBox, "dateinameTextBox");
+ this.filenameTextBox.Name = "dateinameTextBox";
+ this.filenameTextBox.ReadOnly = true;
//
// statischLabel
//
- resources.ApplyResources(this.statischLabel, "statischLabel");
- this.statischLabel.Name = "statischLabel";
+ resources.ApplyResources(this.staticLabel, "statischLabel");
+ this.staticLabel.Name = "statischLabel";
//
// label30
//
@@ -185,18 +185,18 @@ private void InitializeComponent()
//
// datumLabel
//
- resources.ApplyResources(this.datumLabel, "datumLabel");
- this.datumLabel.Name = "datumLabel";
+ resources.ApplyResources(this.dateLabel, "datumLabel");
+ this.dateLabel.Name = "datumLabel";
//
// dateigröĂeLabel
//
- resources.ApplyResources(this.dateigröĂeLabel, "dateigröĂeLabel");
- this.dateigröĂeLabel.Name = "dateigröĂeLabel";
+ resources.ApplyResources(this.fileSizeLabel, "dateigröĂeLabel");
+ this.fileSizeLabel.Name = "dateigröĂeLabel";
//
// spracheLabel
//
- resources.ApplyResources(this.spracheLabel, "spracheLabel");
- this.spracheLabel.Name = "spracheLabel";
+ resources.ApplyResources(this.languageLabel, "spracheLabel");
+ this.languageLabel.Name = "spracheLabel";
//
// versionLabel
//
@@ -205,8 +205,8 @@ private void InitializeComponent()
//
// autorLabel
//
- resources.ApplyResources(this.autorLabel, "autorLabel");
- this.autorLabel.Name = "autorLabel";
+ resources.ApplyResources(this.authorLabel, "autorLabel");
+ this.authorLabel.Name = "autorLabel";
//
// label27
//
@@ -240,8 +240,8 @@ private void InitializeComponent()
//
// kiNameLabel1
//
- resources.ApplyResources(this.kiNameLabel1, "kiNameLabel1");
- this.kiNameLabel1.Name = "kiNameLabel1";
+ resources.ApplyResources(this.aiNameLabel1, "kiNameLabel1");
+ this.aiNameLabel1.Name = "kiNameLabel1";
//
// label3
//
@@ -252,7 +252,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this.castes, "castes");
this.castes.Controls.Add(this.pictureBox2);
- this.castes.Controls.Add(this.kiNameLabel2);
+ this.castes.Controls.Add(this.aiNameLabel2);
this.castes.Controls.Add(this.label29);
this.castes.Controls.Add(this.casteGroupBox);
this.castes.Controls.Add(this.label5);
@@ -269,8 +269,8 @@ private void InitializeComponent()
//
// kiNameLabel2
//
- resources.ApplyResources(this.kiNameLabel2, "kiNameLabel2");
- this.kiNameLabel2.Name = "kiNameLabel2";
+ resources.ApplyResources(this.aiNameLabel2, "kiNameLabel2");
+ this.aiNameLabel2.Name = "kiNameLabel2";
//
// label29
//
@@ -407,12 +407,12 @@ private void InitializeComponent()
//
resources.ApplyResources(this.security, "security");
this.security.Controls.Add(this.pictureBox3);
- this.security.Controls.Add(this.zusatzinfosTextBox);
- this.security.Controls.Add(this.kiNameLabel3);
+ this.security.Controls.Add(this.additionalInformationTextBox);
+ this.security.Controls.Add(this.aiNameLabel3);
this.security.Controls.Add(this.label31);
this.security.Controls.Add(this.label2);
this.security.Controls.Add(this.label1);
- this.security.Controls.Add(this.rechteListView);
+ this.security.Controls.Add(this.securityListView);
this.security.Name = "security";
this.security.UseVisualStyleBackColor = true;
//
@@ -425,14 +425,14 @@ private void InitializeComponent()
//
// zusatzinfosTextBox
//
- resources.ApplyResources(this.zusatzinfosTextBox, "zusatzinfosTextBox");
- this.zusatzinfosTextBox.Name = "zusatzinfosTextBox";
- this.zusatzinfosTextBox.ReadOnly = true;
+ resources.ApplyResources(this.additionalInformationTextBox, "zusatzinfosTextBox");
+ this.additionalInformationTextBox.Name = "zusatzinfosTextBox";
+ this.additionalInformationTextBox.ReadOnly = true;
//
// kiNameLabel3
//
- resources.ApplyResources(this.kiNameLabel3, "kiNameLabel3");
- this.kiNameLabel3.Name = "kiNameLabel3";
+ resources.ApplyResources(this.aiNameLabel3, "kiNameLabel3");
+ this.aiNameLabel3.Name = "kiNameLabel3";
//
// label31
//
@@ -451,15 +451,15 @@ private void InitializeComponent()
//
// rechteListView
//
- resources.ApplyResources(this.rechteListView, "rechteListView");
- this.rechteListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.rechteListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
- this.rechteListView.Name = "rechteListView";
- this.rechteListView.ShowItemToolTips = true;
- this.rechteListView.SmallImageList = this.imageList;
- this.rechteListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
- this.rechteListView.UseCompatibleStateImageBehavior = false;
- this.rechteListView.View = System.Windows.Forms.View.List;
+ resources.ApplyResources(this.securityListView, "rechteListView");
+ this.securityListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.securityListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
+ this.securityListView.Name = "rechteListView";
+ this.securityListView.ShowItemToolTips = true;
+ this.securityListView.SmallImageList = this.imageList;
+ this.securityListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
+ this.securityListView.UseCompatibleStateImageBehavior = false;
+ this.securityListView.View = System.Windows.Forms.View.List;
//
// AntProperties
//
@@ -518,33 +518,33 @@ private void InitializeComponent()
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ListView castesListView;
private System.Windows.Forms.Label label1;
- private System.Windows.Forms.ListView rechteListView;
+ private System.Windows.Forms.ListView securityListView;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label22;
- private System.Windows.Forms.Label kiNameLabel1;
+ private System.Windows.Forms.Label aiNameLabel1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label datumLabel;
- private System.Windows.Forms.Label dateigröĂeLabel;
- private System.Windows.Forms.Label spracheLabel;
+ private System.Windows.Forms.Label dateLabel;
+ private System.Windows.Forms.Label fileSizeLabel;
+ private System.Windows.Forms.Label languageLabel;
private System.Windows.Forms.Label versionLabel;
- private System.Windows.Forms.Label autorLabel;
- private System.Windows.Forms.Label kiNameLabel2;
+ private System.Windows.Forms.Label authorLabel;
+ private System.Windows.Forms.Label aiNameLabel2;
private System.Windows.Forms.Label label29;
- private System.Windows.Forms.Label kiNameLabel3;
+ private System.Windows.Forms.Label aiNameLabel3;
private System.Windows.Forms.Label label31;
- private System.Windows.Forms.Label statischLabel;
+ private System.Windows.Forms.Label staticLabel;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label debugLabel;
private System.Windows.Forms.Label label4;
- private System.Windows.Forms.TextBox dateinameTextBox;
- private System.Windows.Forms.TextBox klassennameTextBox;
+ private System.Windows.Forms.TextBox filenameTextBox;
+ private System.Windows.Forms.TextBox classnameTextBox;
private System.Windows.Forms.Label label28;
- private System.Windows.Forms.TextBox zusatzinfosTextBox;
+ private System.Windows.Forms.TextBox additionalInformationTextBox;
private System.Windows.Forms.ImageList imageList;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
diff --git a/PlayerManagement/AntProperties.cs b/PlayerManagement/AntProperties.cs
index aa997e1..bbcc4a1 100644
--- a/PlayerManagement/AntProperties.cs
+++ b/PlayerManagement/AntProperties.cs
@@ -20,33 +20,33 @@ public AntProperties(PlayerInfoFilename playerInfo)
player = playerInfo;
InitializeComponent();
- // Daten einfĂŒllen
- kiNameLabel1.Text = player.ColonyName;
- kiNameLabel3.Text = player.ColonyName;
- kiNameLabel2.Text = player.ColonyName;
+ // populate with data
+ aiNameLabel1.Text = player.ColonyName;
+ aiNameLabel3.Text = player.ColonyName;
+ aiNameLabel2.Text = player.ColonyName;
Text = string.Format(Resource.AntPropertiesTitle, player.ColonyName);
- autorLabel.Text = string.Format(Resource.AntPropertiesAuthorFormat, player.FirstName, player.LastName);
+ authorLabel.Text = string.Format(Resource.AntPropertiesAuthorFormat, player.FirstName, player.LastName);
versionLabel.Text = player.SimulationVersion.ToString();
- spracheLabel.Text = player.Language.ToString();
- statischLabel.Text = player.Static ? Resource.Yes : Resource.No;
+ languageLabel.Text = player.Language.ToString();
+ staticLabel.Text = player.Static ? Resource.Yes : Resource.No;
debugLabel.Text = player.HasDebugInformation ? Resource.Yes : Resource.No;
- klassennameTextBox.Text = player.ClassName;
+ classnameTextBox.Text = player.ClassName;
- dateinameTextBox.Text = player.File;
+ filenameTextBox.Text = player.File;
try
{
FileInfo info = new FileInfo(player.File);
- dateigröĂeLabel.Text = info.Length + " Byte";
- datumLabel.Text = info.CreationTime.ToLongDateString() + " " + info.CreationTime.ToShortTimeString();
+ fileSizeLabel.Text = info.Length + " Byte";
+ dateLabel.Text = info.CreationTime.ToLongDateString() + " " + info.CreationTime.ToShortTimeString();
}
catch
{
- dateigröĂeLabel.Text = Resource.AntPropertiesUnknown;
- datumLabel.Text = Resource.AntPropertiesUnknown;
+ fileSizeLabel.Text = Resource.AntPropertiesUnknown;
+ dateLabel.Text = Resource.AntPropertiesUnknown;
}
- // Ameisenkasten einfĂŒgen
+ // populate with ant castes
castesListView.Items.Clear();
foreach (CasteInfo info in player.Castes)
{
@@ -55,38 +55,38 @@ public AntProperties(PlayerInfoFilename playerInfo)
}
select_caste(null, null);
- // Sicherheitsliste
+ // security
int count = 0;
if (player.RequestFileAccess)
{
- rechteListView.Items.Add(Resource.AntPropertiesIoAccess, "security_closed");
+ securityListView.Items.Add(Resource.AntPropertiesIoAccess, "security_closed");
count++;
}
if (player.RequestDatabaseAccess)
{
- rechteListView.Items.Add(Resource.AntPropertiesDbAccess, "security_closed");
+ securityListView.Items.Add(Resource.AntPropertiesDbAccess, "security_closed");
count++;
}
if (player.RequestReferences)
{
- rechteListView.Items.Add(Resource.AntPropertiesRefAccess, "security_closed");
+ securityListView.Items.Add(Resource.AntPropertiesRefAccess, "security_closed");
count++;
}
if (player.RequestUserInterfaceAccess)
{
- rechteListView.Items.Add(Resource.AntPropertiesUiAccess, "security_closed");
+ securityListView.Items.Add(Resource.AntPropertiesUiAccess, "security_closed");
count++;
}
if (player.RequestNetworkAccess)
{
- rechteListView.Items.Add(Resource.AntPropertiesNetAccess, "security_closed");
+ securityListView.Items.Add(Resource.AntPropertiesNetAccess, "security_closed");
count++;
}
if (count == 0)
{
- rechteListView.Items.Add(Resource.AntPropertiesNoAccess, "security_closed");
+ securityListView.Items.Add(Resource.AntPropertiesNoAccess, "security_closed");
}
- zusatzinfosTextBox.Text = player.RequestInformation == string.Empty
+ additionalInformationTextBox.Text = player.RequestInformation == string.Empty
? Resource.AntPropertiesNoAdditionalInfos
: player.RequestInformation;
@@ -94,7 +94,7 @@ public AntProperties(PlayerInfoFilename playerInfo)
private void select_caste(object sender, System.EventArgs e)
{
- // TODO: Resultierende Werte aus den Settings hinzu schreiben
+ // TODO: add resulting values from the settings // Resultierende Werte aus den Settings hinzu schreiben
if (castesListView.SelectedItems.Count > 0)
{
casteGroupBox.Enabled = true;
diff --git a/PlayerManagement/CreateForm.cs b/PlayerManagement/CreateForm.cs
index c3a9cbb..668a377 100644
--- a/PlayerManagement/CreateForm.cs
+++ b/PlayerManagement/CreateForm.cs
@@ -63,7 +63,7 @@ private void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
if (DialogResult != System.Windows.Forms.DialogResult.OK)
return;
- // Check den Namen (muss den Namenskonventionen von Klassennamen entsprechen)
+ // Check the name (must conform to the naming conventions of class names)
if (!Regex.IsMatch(nameTextBox.Text, @"^[a-zA-Z][a-zA-Z0-9]{1,19}$"))
{
MessageBox.Show(Resource.AntColonyNameNotValid);
@@ -71,7 +71,7 @@ private void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
return;
}
- // Finde Generator
+ // Find generator
var generator = generators.Where(g => g.Language.Equals(languageComboBox.Text) && g.ProgrammingLanguage.Equals(codeComboBox.Text)).FirstOrDefault();
if (generator == null)
{
@@ -80,7 +80,7 @@ private void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
return;
}
- // PrĂŒfen, ob das Ausgabeverzeichnis existiert
+ // Check whether the output directory exists
DirectoryInfo root = new DirectoryInfo(folderTextBox.Text);
if (!root.Exists)
{
diff --git a/PlayerManagement/GeneratorFiles.Designer.cs b/PlayerManagement/GeneratorFiles.Designer.cs
index eb72129..63618c2 100644
--- a/PlayerManagement/GeneratorFiles.Designer.cs
+++ b/PlayerManagement/GeneratorFiles.Designer.cs
@@ -73,7 +73,7 @@ internal GeneratorFiles() {
/// /// Diese Datei enthĂ€lt die Beschreibung fĂŒr deine Ameise. Die einzelnen Code-Blöcke
/// /// (Beginnend mit "public override void") fassen zusammen, wie deine Ameise in den
/// /// entsprechenden Situationen reagieren soll. Welche Befehle du hier verwenden kannst,
- /// /// findest du auf der BefehlsĂŒbersicht im Wiki (http://wiki.antme.ne [rest of string was truncated]";.
+ /// /// findest du auf der BefehlsĂŒbersicht im Wiki (https://wiki.antme.net/de/ [rest of string was truncated]"quot;;.
///
internal static string class_cs_de_docu {
get {
diff --git a/PlayerManagement/PlayerStore.cs b/PlayerManagement/PlayerStore.cs
index e204385..7526f71 100644
--- a/PlayerManagement/PlayerStore.cs
+++ b/PlayerManagement/PlayerStore.cs
@@ -9,7 +9,7 @@
namespace AntMe.PlayerManagement
{
///
- /// Zentraler Player Speicher
+ /// Central player store.
///
public sealed class PlayerStore
{
@@ -83,7 +83,7 @@ private void Init()
public ReadOnlyCollection KnownPlayer { get { return knownPlayer.AsReadOnly(); } }
///
- /// Registeres a new File to the Storage.
+ /// Registers a new File to the Storage.
///
///
public void RegisterFile(string file)
@@ -93,7 +93,7 @@ public void RegisterFile(string file)
if (scannedFiles.Contains(file.ToLower()))
return;
- // Kick den alten
+ // Unregister old file.
if (configuration.KnownFiles.Contains(file.ToLower()))
UnregisterFile(file);
@@ -114,7 +114,7 @@ public void RegisterFile(string file)
}
///
- /// Unregisteres a known File from the Storage.
+ /// Unregister a known file from the storage.
///
///
public void UnregisterFile(string file)
@@ -132,7 +132,7 @@ public void UnregisterFile(string file)
}
///
- /// Adds all included Player without adding to the registered files.
+ /// Adds all included players without adding to the registered files.
///
///
private void ScanFile(string file)
diff --git a/SharedComponents/AntVideo/AntVideoReader.cs b/SharedComponents/AntVideo/AntVideoReader.cs
index 1a91188..79ec13f 100644
--- a/SharedComponents/AntVideo/AntVideoReader.cs
+++ b/SharedComponents/AntVideo/AntVideoReader.cs
@@ -195,7 +195,7 @@ public SimulationState Read()
}
}
- // Detect streamend
+ // Detect end of stream
if ((BlockType)serializer.Peek() == BlockType.StreamEnd)
{
complete = true;
@@ -269,7 +269,7 @@ public SimulationState Read()
}
///
- /// Gives the current frame-position.
+ /// Gives the current frame position.
///
public int CurrentFrame
{
@@ -285,7 +285,7 @@ public int TotalFrames
}
///
- /// Gibt an, ob der Stream zu Ende gelesen wurde.
+ /// Complete when the stream has been read to the end.
///
public bool Complete
{
diff --git a/SharedComponents/AntVideo/Block/Ant.cs b/SharedComponents/AntVideo/Block/Ant.cs
index f2eb240..5af8520 100644
--- a/SharedComponents/AntVideo/Block/Ant.cs
+++ b/SharedComponents/AntVideo/Block/Ant.cs
@@ -28,20 +28,20 @@ public Ant(Serializer serializer)
Reset();
}
- public Ant(AntState zustand)
- : base(zustand.ColonyId, zustand.Id)
+ public Ant(AntState state)
+ : base(state.ColonyId, state.Id)
{
- CasteId = zustand.CasteId;
- ViewRange = zustand.ViewRange;
- TargetType = zustand.TargetType;
- PositionX = zustand.PositionX;
- PositionY = zustand.PositionY;
- Direction = zustand.Direction;
- Vitality = zustand.Vitality;
- TargetPositionX = zustand.TargetPositionX;
- TargetPositionY = zustand.TargetPositionY;
- Load = zustand.Load;
- LoadType = zustand.LoadType;
+ CasteId = state.CasteId;
+ ViewRange = state.ViewRange;
+ TargetType = state.TargetType;
+ PositionX = state.PositionX;
+ PositionY = state.PositionY;
+ Direction = state.Direction;
+ Vitality = state.Vitality;
+ TargetPositionX = state.TargetPositionX;
+ TargetPositionY = state.TargetPositionY;
+ Load = state.Load;
+ LoadType = state.LoadType;
Reset();
}
diff --git a/SharedComponents/AntVideo/Block/AntUpdate.cs b/SharedComponents/AntVideo/Block/AntUpdate.cs
index 5c76b2c..a962427 100644
--- a/SharedComponents/AntVideo/Block/AntUpdate.cs
+++ b/SharedComponents/AntVideo/Block/AntUpdate.cs
@@ -4,7 +4,7 @@
namespace AntMe.SharedComponents.AntVideo.Block
{
///
- /// Liste der Felder, die sich durch ein Update Àndern könnten
+ /// List of fields that could change due to an update.
///
[Flags]
internal enum AntFields
@@ -40,7 +40,7 @@ internal sealed class AntUpdate : UpdateBase
public AntUpdate() { }
- // Blocklayout:
+ // Block layout:
// - ...
// - byte TargetType
// - sbyte PositionX
diff --git a/SharedComponents/AntVideo/Block/Bug.cs b/SharedComponents/AntVideo/Block/Bug.cs
index 3b4708b..94924d2 100644
--- a/SharedComponents/AntVideo/Block/Bug.cs
+++ b/SharedComponents/AntVideo/Block/Bug.cs
@@ -22,12 +22,12 @@ public Bug(Serializer serializer) : base(0)
Reset();
}
- public Bug(BugState zustand) : base(zustand.Id)
+ public Bug(BugState state) : base(state.Id)
{
- PositionX = zustand.PositionX;
- PositionY = zustand.PositionY;
- Direction = zustand.Direction;
- Vitality = zustand.Vitality;
+ PositionX = state.PositionX;
+ PositionY = state.PositionY;
+ Direction = state.Direction;
+ Vitality = state.Vitality;
Reset();
}
@@ -62,11 +62,11 @@ public void Update(BugUpdate update)
}
if (update.HasChanged(BugFields.Direction))
{
- dDirection = update.dRichtung;
+ dDirection = update.dDirection;
}
if (update.HasChanged(BugFields.Vitality))
{
- aVitality = update.aEnergie;
+ aVitality = update.aEnergy;
}
}
@@ -93,14 +93,14 @@ public BugUpdate GenerateUpdate(BugState state)
if (state.Direction != Angle.Interpolate(Direction, dDirection))
{
update.Change(BugFields.Direction);
- update.dRichtung = Angle.Delta(Direction, state.Direction);
+ update.dDirection = Angle.Delta(Direction, state.Direction);
changed = true;
}
if (state.Vitality != aVitality)
{
update.Change(BugFields.Vitality);
- update.aEnergie = state.Vitality;
+ update.aEnergy = state.Vitality;
changed = true;
}
diff --git a/SharedComponents/AntVideo/Block/BugUpdate.cs b/SharedComponents/AntVideo/Block/BugUpdate.cs
index 8490234..4c34a48 100644
--- a/SharedComponents/AntVideo/Block/BugUpdate.cs
+++ b/SharedComponents/AntVideo/Block/BugUpdate.cs
@@ -13,10 +13,10 @@ internal enum BugFields
internal sealed class BugUpdate : UpdateBase
{
- public int aEnergie;
+ public int aEnergy;
public int dPositionX;
public int dPositionY;
- public int dRichtung;
+ public int dDirection;
public BugUpdate() { }
@@ -42,12 +42,12 @@ public BugUpdate(Serializer serializer)
if (HasChanged(BugFields.Direction))
{
- dRichtung = serializer.ReadShort();
+ dDirection = serializer.ReadShort();
}
if (HasChanged(BugFields.Vitality))
{
- aEnergie = serializer.ReadUShort();
+ aEnergy = serializer.ReadUShort();
}
}
@@ -66,12 +66,12 @@ public override void Serialize(Serializer serializer)
if (HasChanged(BugFields.Direction))
{
- serializer.SendShort((short)dRichtung);
+ serializer.SendShort((short)dDirection);
}
if (HasChanged(BugFields.Vitality))
{
- serializer.SendUshort((ushort)aEnergie);
+ serializer.SendUshort((ushort)aEnergy);
}
}
diff --git a/SharedComponents/AntVideo/Block/Caste.cs b/SharedComponents/AntVideo/Block/Caste.cs
index b4beb69..ba0fea4 100644
--- a/SharedComponents/AntVideo/Block/Caste.cs
+++ b/SharedComponents/AntVideo/Block/Caste.cs
@@ -4,16 +4,16 @@ namespace AntMe.SharedComponents.AntVideo.Block
{
internal sealed class Caste : CasteState, ISerializable
{
- public Caste(CasteState zustand) : base(zustand.ColonyId, zustand.Id)
+ public Caste(CasteState state) : base(state.ColonyId, state.Id)
{
- Name = zustand.Name;
- SpeedModificator = zustand.SpeedModificator;
- RotationSpeedModificator = zustand.RotationSpeedModificator;
- LoadModificator = zustand.LoadModificator;
- ViewRangeModificator = zustand.ViewRangeModificator;
- RangeModificator = zustand.RangeModificator;
- VitalityModificator = zustand.VitalityModificator;
- AttackModificator = zustand.AttackModificator;
+ Name = state.Name;
+ SpeedModificator = state.SpeedModificator;
+ RotationSpeedModificator = state.RotationSpeedModificator;
+ LoadModificator = state.LoadModificator;
+ ViewRangeModificator = state.ViewRangeModificator;
+ RangeModificator = state.RangeModificator;
+ VitalityModificator = state.VitalityModificator;
+ AttackModificator = state.AttackModificator;
}
public Caste(Serializer serializer)
diff --git a/SharedComponents/AntVideo/Block/Colony.cs b/SharedComponents/AntVideo/Block/Colony.cs
index 2012367..fd429ec 100644
--- a/SharedComponents/AntVideo/Block/Colony.cs
+++ b/SharedComponents/AntVideo/Block/Colony.cs
@@ -4,13 +4,13 @@ namespace AntMe.SharedComponents.AntVideo.Block
{
internal sealed class Colony : ColonyState, IUpdateable, ISerializable
{
- #region Basisinformation
+ #region Base information
public int TeamId;
#endregion
- #region Updateinformation
+ #region Update information
private int aBeatenAnts;
private int aCollectedFood;
@@ -50,7 +50,7 @@ public Colony(Serializer serializer)
}
///
- /// Setzt die Updatedaten auf erwartete Werte
+ /// Sets the update data to expected values.
///
private void Reset()
{
@@ -196,7 +196,7 @@ public bool IsAlive
#region ISerializable Member
- // Blocklayout:
+ // Block layout:
// - ushort ID
// - guid Guid
// - ushort Team
diff --git a/SharedComponents/AntVideo/Block/Frame.cs b/SharedComponents/AntVideo/Block/Frame.cs
index b0190b9..ed11299 100644
--- a/SharedComponents/AntVideo/Block/Frame.cs
+++ b/SharedComponents/AntVideo/Block/Frame.cs
@@ -4,11 +4,11 @@
namespace AntMe.SharedComponents.AntVideo.Block
{
///
- /// ReprÀsentiert den Zustandsblock
+ /// Represents the state block.
///
internal sealed class Frame : SimulationState, IUpdateable, ISerializable
{
- #region Updateinformation
+ #region Update information
private int aCurrentRound;
private DateTime aTimestamp;
@@ -84,7 +84,7 @@ public bool IsAlive
#region ISerializable Member
- // Blocklayout:
+ // Block layout:
// ushort TotalRounds
// ushort Height
// ushort Width
diff --git a/SharedComponents/AntVideo/Block/Fruit.cs b/SharedComponents/AntVideo/Block/Fruit.cs
index c24fcd1..4d147dd 100644
--- a/SharedComponents/AntVideo/Block/Fruit.cs
+++ b/SharedComponents/AntVideo/Block/Fruit.cs
@@ -22,13 +22,13 @@ public Fruit(Serializer serializer)
Reset();
}
- public Fruit(FruitState zustand) : base(zustand.Id)
+ public Fruit(FruitState state) : base(state.Id)
{
- Amount = zustand.Amount;
- Radius = zustand.Radius;
- PositionX = zustand.PositionX;
- PositionY = zustand.PositionY;
- CarryingAnts = zustand.CarryingAnts;
+ Amount = state.Amount;
+ Radius = state.Radius;
+ PositionX = state.PositionX;
+ PositionY = state.PositionY;
+ CarryingAnts = state.CarryingAnts;
Reset();
}
diff --git a/SharedComponents/AntVideo/Block/Marker.cs b/SharedComponents/AntVideo/Block/Marker.cs
index e41571e..1a1e645 100644
--- a/SharedComponents/AntVideo/Block/Marker.cs
+++ b/SharedComponents/AntVideo/Block/Marker.cs
@@ -6,7 +6,7 @@ internal class Marker : MarkerState, IUpdateable, ISe
{
#region Updateinformation
- public int aRichtung;
+ public int aDirection;
public int dRadius;
private bool isAlive;
@@ -20,19 +20,19 @@ public Marker(Serializer serializer)
Reset();
}
- public Marker(MarkerState zustand) : base(zustand.ColonyId, zustand.Id)
+ public Marker(MarkerState markerState) : base(markerState.ColonyId, markerState.Id)
{
- PositionX = zustand.PositionX;
- PositionY = zustand.PositionY;
- Radius = zustand.Radius;
- Direction = zustand.Direction;
+ PositionX = markerState.PositionX;
+ PositionY = markerState.PositionY;
+ Radius = markerState.Radius;
+ Direction = markerState.Direction;
Reset();
}
private void Reset()
{
- aRichtung = Direction;
+ aDirection = Direction;
dRadius = 0;
}
@@ -41,7 +41,7 @@ private void Reset()
public void Interpolate()
{
Radius += dRadius;
- Direction = aRichtung;
+ Direction = aDirection;
}
public void Update(MarkerUpdate update)
@@ -52,7 +52,7 @@ public void Update(MarkerUpdate update)
}
if (update.HasChanged(MarkerFields.Direction))
{
- aRichtung = update.aDirection;
+ aDirection = update.aDirection;
}
}
diff --git a/SharedComponents/AntVideo/Block/Sugar.cs b/SharedComponents/AntVideo/Block/Sugar.cs
index 15dcd9b..0b76646 100644
--- a/SharedComponents/AntVideo/Block/Sugar.cs
+++ b/SharedComponents/AntVideo/Block/Sugar.cs
@@ -20,12 +20,12 @@ public Sugar(Serializer serializer)
Reset();
}
- public Sugar(SugarState zustand) : base(zustand.Id)
+ public Sugar(SugarState state) : base(state.Id)
{
- PositionX = zustand.PositionX;
- PositionY = zustand.PositionY;
- Radius = zustand.Radius;
- Amount = zustand.Amount;
+ PositionX = state.PositionX;
+ PositionY = state.PositionY;
+ Radius = state.Radius;
+ Amount = state.Amount;
Reset();
}
@@ -85,12 +85,12 @@ public SugarUpdate GenerateUpdate(SugarState state)
public SugarState GenerateState()
{
- SugarState zustand = new SugarState(Id);
- zustand.PositionX = PositionX;
- zustand.PositionY = PositionY;
- zustand.Radius = Radius;
- zustand.Amount = Amount;
- return zustand;
+ SugarState state = new SugarState(Id);
+ state.PositionX = PositionX;
+ state.PositionY = PositionY;
+ state.Radius = Radius;
+ state.Amount = Amount;
+ return state;
}
public bool IsAlive
diff --git a/SharedComponents/AntVideo/Block/UpdateBase.cs b/SharedComponents/AntVideo/Block/UpdateBase.cs
index 9f38617..a1f6b48 100644
--- a/SharedComponents/AntVideo/Block/UpdateBase.cs
+++ b/SharedComponents/AntVideo/Block/UpdateBase.cs
@@ -3,7 +3,7 @@
namespace AntMe.SharedComponents.AntVideo.Block
{
///
- /// Basisklasse fĂŒr alle Updateblocks fĂŒr ein einheitliches Speichern der verĂ€nderten Felder
+ /// Base class for all update blocks for consistent saving of changed fields
///
internal abstract class UpdateBase : ISerializable
{
diff --git a/SharedComponents/AntVideo/BlockType.cs b/SharedComponents/AntVideo/BlockType.cs
index 04717a6..c1c7131 100644
--- a/SharedComponents/AntVideo/BlockType.cs
+++ b/SharedComponents/AntVideo/BlockType.cs
@@ -1,7 +1,7 @@
ï»żnamespace AntMe.SharedComponents.AntVideo
{
///
- /// List of possible block-types in stream.
+ /// List of possible block types in stream.
///
internal enum BlockType
{
diff --git a/SharedComponents/AntVideo/Serializer.cs b/SharedComponents/AntVideo/Serializer.cs
index 0f6a026..70e3640 100644
--- a/SharedComponents/AntVideo/Serializer.cs
+++ b/SharedComponents/AntVideo/Serializer.cs
@@ -7,7 +7,7 @@
namespace AntMe.SharedComponents.AntVideo
{
///
- /// Class, to manage all serialize-tasks.
+ /// Class, to manage all serialize tasks.
///
internal sealed class Serializer : IDisposable
{
@@ -163,7 +163,7 @@ public void ReadHello()
throw new NotSupportedException(Resource.AntvideoSerializerWrongHeader);
}
- // Compare version-number
+ // Compare version number
byte[] vers = new byte[4];
stream.Read(vers, 0, 4);
if (vers[0] != version[0] ||
@@ -207,7 +207,7 @@ public void Write(BlockType blocktype)
}
///
- /// Reads the following byte without affect the streamposition.
+ /// Reads the following byte without affect the stream position.
///
/// next byte
public int Peek()
@@ -225,7 +225,7 @@ internal void Flush()
#region Sendemethoden
///
- /// Sendet einen ushort ĂŒber den Stream
+ /// Sends ushort over the stream.
///
/// ushort
public void SendUshort(ushort item)
@@ -234,7 +234,7 @@ public void SendUshort(ushort item)
}
///
- /// Sends a short
+ /// Sends a short.
///
/// short
public void SendShort(short item)
@@ -243,7 +243,7 @@ public void SendShort(short item)
}
///
- /// Sendet einen sbyte ĂŒber den angegebenen stream
+ /// Sends byte over the stream.
///
/// sbyte
public void SendSByte(sbyte item)
@@ -252,7 +252,7 @@ public void SendSByte(sbyte item)
}
///
- /// Sendet einen integer ĂŒber den Stream
+ /// Sends integer over the stream.
///
/// integer
public void SendInt(int item)
@@ -266,7 +266,7 @@ public void SendLong(long item)
}
///
- /// Sendet einen string ĂŒber den Stream
+ /// Sends string over the stream.
///
/// string
public void SendString(string item)
@@ -292,12 +292,12 @@ public void SendByte(byte item)
#endregion
- #region Empfangsmethoden
+ #region Receive methods
///
- /// Liest den nÀchsten ushort aus dem angegebenen Stream
+ /// Reads next ushort from the specified stream.
///
- /// ausgelesener ushort
+ /// read ushort
public ushort ReadUShort()
{
return reader.ReadUInt16();
@@ -309,18 +309,18 @@ public short ReadShort()
}
///
- /// Liest das nÀchste sbyte aus dem angegebenen Stream
+ /// Reads next sbyte from the specified stream.
///
- /// ausgelesener sbyte
+ /// read sbyte
public sbyte ReadSByte()
{
return reader.ReadSByte();
}
///
- /// Liest einen Integer aus dem Stream
+ /// Reads next integer from the specified stream.
///
- /// gelesener int
+ /// read integer
public int ReadInt()
{
return reader.ReadInt32();
@@ -332,18 +332,18 @@ public long ReadLong()
}
///
- /// Liest einen String aus dem stream
+ /// Reads next string from the specified stream.
///
- /// string
+ /// read string
public string ReadString()
{
return reader.ReadString();
}
///
- /// Liest einen DateTime aus dem Stream aus
+ /// Reads next datetime from the specified stream.
///
- /// DateTime
+ /// read DateTime
public DateTime ReadDateTime()
{
return new DateTime(ReadLong());
diff --git a/SharedComponents/States/CasteState.cs b/SharedComponents/States/CasteState.cs
index 8ab7193..938f9ce 100644
--- a/SharedComponents/States/CasteState.cs
+++ b/SharedComponents/States/CasteState.cs
@@ -34,27 +34,27 @@ public CasteState(int colonyId, int id) : base(colonyId, id) { }
public string Name { get; set; }
///
- /// Gets or sets the range-modificator.
+ /// Gets or sets the smell range modificator.
///
public byte RangeModificator { get; set; }
///
- /// Gets or sets the rotation-speed-modificator.
+ /// Gets or sets the rotation speed modificator.
///
public byte RotationSpeedModificator { get; set; }
///
- /// Gets or sets the speed-modificator.
+ /// Gets or sets the speed modificator.
///
public byte SpeedModificator { get; set; }
///
- /// Gets or sets the view-range-modificator.
+ /// Gets or sets the view range modificator.
///
public byte ViewRangeModificator { get; set; }
///
- /// Gets or sets the vitality-modificator.
+ /// Gets or sets the vitality modificator.
///
public byte VitalityModificator { get; set; }
diff --git a/SharedComponents/States/TeamState.cs b/SharedComponents/States/TeamState.cs
index cfb0d6e..7b2094b 100644
--- a/SharedComponents/States/TeamState.cs
+++ b/SharedComponents/States/TeamState.cs
@@ -35,7 +35,7 @@ public TeamState(int id, Guid guid, string name)
#region Properties
///
- /// gets a list of castes.
+ /// Gets a list of castes.
///
public Collection ColonyStates { get; set; }
diff --git a/SharedComponents/Tools/ColorFinder.cs b/SharedComponents/Tools/ColorFinder.cs
index f8040d5..01f0a6b 100644
--- a/SharedComponents/Tools/ColorFinder.cs
+++ b/SharedComponents/Tools/ColorFinder.cs
@@ -1,205 +1,195 @@
using System;
using System.Collections.Generic;
-using System.Drawing;
using AntMe.SharedComponents.Properties;
namespace AntMe.SharedComponents.Tools {
///
- /// Stellt eine Farbe im RGB-Farbraum dar.
+ /// RGB colours.
///
///
- /// Diese Struktur wurde definiert um von den in Windows Forms und Managed
- /// DirectX definierten Farben unabhängig zu sein. Zusätzlich können Farben
- /// durch die Verwendung dieser Struktur gemischt werden.
+ /// Colours defined independent from Windows forms or managed DirectX
+ /// using this struct colours can be created and mixed.
///
/// Wolfgang Gallo (wolfgang@antme.net)
- public struct Farbe {
- private int blau;
- private int grün;
- private int rot;
+ public struct Color {
+ private int blue;
+ private int green;
+ private int red;
///
- /// Der Farbe Konstruktor.
+ /// Constructor to instantiate a new RGB color.
///
- /// Rot-Wert
- /// Grün-Wert
- /// Blau-Wert
- public Farbe(int rot, int grün, int blau) {
- this.rot = rot;
- this.grün = grün;
- this.blau = blau;
+ /// RGB value for red
+ /// RGB value for green
+ /// RGB value for blue
+ public Color(int red, int green, int blue) {
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
}
///
- /// Der Rot-Wert der Farbe.
+ /// RGB red value minimum 0, maximum 255.
///
- public byte Rot {
- get { return rot < 0 ? (byte) 0 : rot > 255 ? (byte) 255 : (byte) rot; }
- set { rot = value; }
+ public byte Red {
+ get => red < 0 ? (byte) 0 : red > 255 ? (byte) 255 : (byte) red;
+ set => red = value;
}
///
- /// Der Grün-Wert der Farbe.
+ /// RGB green value minimum 0, maximum 255.
///
- public byte Grün {
- get { return grün < 0 ? (byte) 0 : grün > 255 ? (byte) 255 : (byte) grün; }
- set { grün = value; }
+ public byte Green {
+ get => green < 0 ? (byte) 0 : green > 255 ? (byte) 255 : (byte) green;
+ set => green = value;
}
///
- /// Der Blau-Wert der Farbe.
+ /// RGB blue value minimum 0, maximum 255.
///
- public byte Blau {
- get { return blau < 0 ? (byte) 0 : blau > 255 ? (byte) 255 : (byte) blau; }
- set { blau = value; }
+ public byte Blue {
+ get => blue < 0 ? (byte) 0 : blue > 255 ? (byte) 255 : (byte) blue;
+ set => blue = value;
}
///
- /// Gibt die Farbe als Zeichenkette zurück.
+ /// RGB color to string.
///
- /// (Rot,Grün,Blau)
+ /// (Red,Green,Blue)
public override string ToString() {
- return "(" + Rot + "," + Grün + "," + Blau + ")";
+ return "(" + Red + "," + Green + "," + Blue + ")";
}
///
- /// Addiert die RGB-Werte zweier Farben.
+ /// Adding up two RGB colours.
///
- /// Um zwei Farben zu mischen muß zusätzlich eine Division durchgeführt
- /// werden: (farbe1 + farbe2) / 2.
+ /// Implemented according to the original remark
+ /// to mix two RGB colours the result must be divided by two
+ /// (colour1 + colour2) / 2
///
- /// Farbe 1
- /// Farbe 2
- /// Farbe
- public static Farbe operator +(Farbe f1, Farbe f2) {
- return new Farbe(f1.rot + f2.rot, f1.grün + f2.grün, f1.blau + f2.blau);
+ /// Color 1
+ /// Color 2
+ /// Color
+ public static Color operator +(Color c1, Color c2) {
+ // Division by two for each RGB value.
+ return new Color((c1.red + c2.red)/2, (c1.green + c2.green)/2, (c1.blue + c2.blue)/2);
}
///
- /// Multipliziert die RGB-Werte einer Farbe mit einer Zahl.
+ /// RGB color multiplied by an integer value
+ /// all RGB values have a maximum of 255.
///
- /// Farbe
- /// Zahl
- /// Farbe
- public static Farbe operator *(Farbe f, int i) {
- return new Farbe(f.rot*i, f.grün*i, f.blau*i);
+ /// Color
+ /// Integer value
+ /// Color
+ public static Color operator *(Color c, int i) {
+ return new Color(c.red*i, c.green*i, c.blue*i);
}
///
- /// Dividiert die RGB-Werte einer Farbe durch eine Zahl.
+ /// New RGB color by dividing all given RGB values by a given integer value.
///
- /// Farbe
- /// Zahl
- /// Farbe
- public static Farbe operator /(Farbe f, int i) {
- return new Farbe(f.rot/i, f.grün/i, f.blau/i);
+ /// Color
+ /// Integer value
+ /// Color
+ public static Color operator /(Color c, int i)
+ {
+ if (i > 0)
+ return new Color(c.red / i, c.green / i, c.blue / i);
+ else
+ return c;
}
///
- /// Bestimmt ein Abstand-Maß zwischen zwei Farben im RGB-Farbraum.
+ /// Distance between two colors in the range 0 - 195075.
///
- /// Wird von der Farbberater-Klasse verwendet.
+ /// Used by the ColorFinder class
+ /// maximum = (maximum deltaColorX) * (maximum deltaColorX) * number of colors
+ /// 255 * 255 * 3 = 195075
///
- /// Farbe 1
- /// Farbe 2
- /// AbstandČ
- public static int operator -(Farbe f1, Farbe f2) {
- int deltaRot = f1.rot - f2.rot;
- int deltaGrün = f1.grün - f2.grün;
- int deltaBlau = f1.blau - f2.blau;
- return deltaRot*deltaRot + deltaGrün*deltaGrün + deltaBlau*deltaBlau;
- //return Math.Abs(deltaRot) + Math.Abs(deltaGrün) + Math.Abs(deltaBlau);
+ /// Color 1
+ /// Color 2
+ /// Color distance as integer value.
+ public static int operator -(Color c1, Color c2) {
+ int deltaRed = c1.red - c2.red;
+ int deltaGreen = c1.green - c2.green;
+ int deltaBlue = c1.blue - c2.blue;
+ return deltaRed*deltaRed + deltaGreen*deltaGreen + deltaBlue*deltaBlue;
+ //return Math.Abs(deltaRed) + Math.Abs(deltaGreen) + Math.Abs(deltaBlue);
}
}
///
- /// Liefert Farben die sie möglichst stark voneinander Unterscheiden.
+ /// Find Color with maximum difference.
///
/// Wolfgang Gallo (wolfgang@antme.net)
public class ColorFinder {
- public static Color ColonyColor1 {
- get { return Settings.Default.ColonyColor1; }
- }
+ public static System.Drawing.Color ColonyColor1 => Settings.Default.ColonyColor1;
- public static Color ColonyColor2 {
- get { return Settings.Default.ColonyColor2; }
- }
+ public static System.Drawing.Color ColonyColor2 => Settings.Default.ColonyColor2;
- public static Color ColonyColor3 {
- get { return Settings.Default.ColonyColor3; }
- }
+ public static System.Drawing.Color ColonyColor3 => Settings.Default.ColonyColor3;
- public static Color ColonyColor4 {
- get { return Settings.Default.ColonyColor4; }
- }
+ public static System.Drawing.Color ColonyColor4 => Settings.Default.ColonyColor4;
- public static Color ColonyColor5 {
- get { return Settings.Default.ColonyColor5; }
- }
+ public static System.Drawing.Color ColonyColor5 => Settings.Default.ColonyColor5;
- public static Color ColonyColor6 {
- get { return Settings.Default.ColonyColor6; }
- }
+ public static System.Drawing.Color ColonyColor6 => Settings.Default.ColonyColor6;
- public static Color ColonyColor7 {
- get { return Settings.Default.ColonyColor7; }
- }
+ public static System.Drawing.Color ColonyColor7 => Settings.Default.ColonyColor7;
- public static Color ColonyColor8 {
- get { return Settings.Default.ColonyColor8; }
- }
+ public static System.Drawing.Color ColonyColor8 => Settings.Default.ColonyColor8;
- private readonly List farben = new List();
+ private readonly List colorsList = new List();
///
- /// Markiert eine neue Farbe als bereits vorhanden.
+ /// Marks new Color as already existing.
///
- /// Neue Farbe.
- public void BelegeFarbe(Farbe farbe) {
- farben.Add(farbe);
+ /// New Color.
+ public void AddColorToColorList(Color color) {
+ colorsList.Add(color);
}
///
- /// Entfernt eine vorhandene Farbe.
+ /// Remove Color from ColorList.
///
- /// Vorhandene Farbe.
- public void EntferneFarbe(Farbe farbe) {
- farben.Remove(farbe);
+ /// Existing Color.
+ public void RemoveColorFromColorList(Color color) {
+ colorsList.Remove(color);
}
- private int bestimmeMinimalenAbstand(Farbe farbe) {
- int besterAbstand = int.MaxValue;
- for (int f = 0; f < farben.Count; f++) {
- int abstand = farben[f] - farbe;
- if (abstand < besterAbstand) {
- besterAbstand = abstand;
+ private int DetermineMinimumDistance(Color color) {
+ int minimumDistance = int.MaxValue;
+ for (int f = 0; f < colorsList.Count; f++) {
+ int distance = colorsList[f] - color;
+ if (distance < minimumDistance) {
+ minimumDistance = distance;
}
}
- return besterAbstand;
+ return minimumDistance;
}
///
- /// Erzeugt eine neue Farbe mit möglichst großem Abstand zu den bereits
- /// vorhandenen Farben.
+ /// Create Color with maximum distance.
///
- /// Neue Farbe.
- public Farbe ErzeugeFarbe() {
- int besterAbstand = 0;
- Farbe besteFarbe = new Farbe(0, 0, 0);
+ /// New Color.
+ public Color CreateNewColor() {
+ int bestDistance = 0;
+ Color bestColor = new Color(0, 0, 0);
int r, g, b;
int r0 = 0, g0 = 0, b0 = 0;
- int abstand;
- Farbe farbe;
+ int distance;
+ Color color;
for (r = 8; r < 256; r += 16) {
for (g = 8; g < 256; g += 16) {
for (b = 8; b < 256; b += 16) {
- farbe = new Farbe(r, g, b);
- abstand = bestimmeMinimalenAbstand(farbe);
- if (abstand > besterAbstand) {
- besterAbstand = abstand;
+ color = new Color(r, g, b);
+ distance = DetermineMinimumDistance(color);
+ if (distance > bestDistance) {
+ bestDistance = distance;
r0 = r;
g0 = g;
b0 = b;
@@ -211,55 +201,54 @@ public Farbe ErzeugeFarbe() {
for (r = -8; r < 8; r++) {
for (g = -8; g < 8; g++) {
for (b = -8; b < 8; b++) {
- farbe = new Farbe(r0 + r, g0 + g, b0 + b);
- abstand = bestimmeMinimalenAbstand(farbe);
- if (abstand > besterAbstand) {
- besterAbstand = abstand;
- besteFarbe = farbe;
+ color = new Color(r0 + r, g0 + g, b0 + b);
+ distance = DetermineMinimumDistance(color);
+ if (distance > bestDistance) {
+ bestDistance = distance;
+ bestColor = color;
}
}
}
}
- return besteFarbe;
+ return bestColor;
}
///
- /// Erzeugt eine neue Farbe mit möglichst großem Abstand zu den bereits
- /// vorhandenen Farben und verändert sie leicht.
+ /// Create new Color with maximum distance and randomize the result.
///
- /// Neue Farbe.
- public Farbe ErzeugeFarbe(int streuung) {
- Farbe farbe = ErzeugeFarbe();
- Random zufall = new Random();
+ /// Scatter value for the random number generator
+ /// new Color.
+ public Color CreateNewColor(int scatter) {
+ Color color = CreateNewColor();
+ Random random = new Random();
return
- new Farbe
+ new Color
(
- (farbe.Rot*100)/(100 + zufall.Next(-streuung, streuung)),
- (farbe.Grün*100)/(100 + zufall.Next(-streuung, streuung)),
- (farbe.Blau*100)/(100 + zufall.Next(-streuung, streuung)));
+ (color.Red*100)/(100 + random.Next(-scatter, scatter)),
+ (color.Green*100)/(100 + random.Next(-scatter, scatter)),
+ (color.Blue*100)/(100 + random.Next(-scatter, scatter)));
}
///
- /// Erzeugt eine neue Farbe mit möglichst großem Abstand zu den bereits
- /// vorhandenen Farben und markiert sie als belegt.
+ /// Create Color and add it to the colorsList.
///
- /// Neue Farbe.
- public Farbe ErzeugeUndBelegeFarbe() {
- Farbe farbe = ErzeugeFarbe();
- BelegeFarbe(farbe);
- return farbe;
+ /// New Color.
+ public Color CreateColorAndAddToColorsList() {
+ Color color = CreateNewColor();
+ AddColorToColorList(color);
+ return color;
}
///
- /// Erzeugt eine neue Farbe mit möglichst großem Abstand zu den bereits
- /// vorhandenen Farben, verändert sie leicht und markiert sie als belegt.
+ /// Create Color, randomize it and add it to the colorsList.
///
- /// Neue Farbe.
- public Farbe ErzeugeUndBelegeFarbe(int streuung) {
- Farbe farbe = ErzeugeFarbe(streuung);
- BelegeFarbe(farbe);
- return farbe;
+ /// Scatter value for the random number generator
+ /// New Color.
+ public Color CreateColorAndAddToColorsList(int scatter) {
+ Color color = CreateNewColor(scatter);
+ AddColorToColorList(color);
+ return color;
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Deutsch/Ameise.cs b/SimulationCore/Deutsch/Ameise.cs
index 9140c13..95cae21 100644
--- a/SimulationCore/Deutsch/Ameise.cs
+++ b/SimulationCore/Deutsch/Ameise.cs
@@ -12,7 +12,7 @@ internal Ameise(Simulation.CoreAnt ant) : base(ant) { }
///
public int AktuelleLast
{
- get { return ((Simulation.CoreAnt)element).AktuelleLastBase; }
+ get { return ((Simulation.CoreAnt)element).CurrentLoadCoreInsect; }
}
///
@@ -23,13 +23,13 @@ public Obst GetragenesObst
get
{
Simulation.CoreAnt temp = (Simulation.CoreAnt)element;
- if (temp.GetragenesObstBase == null)
+ if (temp.CarryingFruitCoreInsect == null)
{
return null;
}
else
{
- return new Obst(temp.GetragenesObstBase);
+ return new Obst(temp.CarryingFruitCoreInsect);
}
}
}
@@ -39,7 +39,7 @@ public Obst GetragenesObst
///
public int MaximaleLast
{
- get { return ((Simulation.CoreAnt)element).MaximaleLastBase; }
+ get { return ((Simulation.CoreAnt)element).MaximumLoadCoreInsect; }
}
///
@@ -47,7 +47,7 @@ public int MaximaleLast
///
public int Reichweite
{
- get { return ((Simulation.CoreAnt)element).ReichweiteBase; }
+ get { return ((Simulation.CoreAnt)element).RangeCoreInsect; }
}
///
@@ -55,7 +55,7 @@ public int Reichweite
///
public string Volk
{
- get { return ((Simulation.CoreAnt)element).colony.Player.ColonyName; }
+ get { return ((Simulation.CoreAnt)element).Colony.Player.ColonyName; }
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Deutsch/Basisameise.cs b/SimulationCore/Deutsch/Basisameise.cs
index c04c33d..1142ce9 100644
--- a/SimulationCore/Deutsch/Basisameise.cs
+++ b/SimulationCore/Deutsch/Basisameise.cs
@@ -12,9 +12,9 @@ public abstract class Basisameise : CoreAnt
{
#region Event-Wrapper
- internal override string BestimmeKasteBase(Dictionary anzahl)
+ internal override string DetermineCasteCoreAnt(Dictionary number)
{
- return BestimmeKaste(anzahl);
+ return BestimmeKaste(number);
}
///
@@ -30,7 +30,7 @@ public virtual string BestimmeKaste(Dictionary anzahl)
return "";
}
- internal override void IstGestorbenBase(CoreKindOfDeath todesArt)
+ internal override void HasDiedCoreAnt(CoreKindOfDeath todesArt)
{
IstGestorben((Todesart)(int)todesArt);
}
@@ -46,7 +46,7 @@ public virtual void IstGestorben(Todesart todesart)
{
}
- internal override void RiechtFreundBase(CoreMarker markierung)
+ internal override void SpotsFriendCoreAnt(CoreMarker markierung)
{
RiechtFreund(new Markierung(markierung));
}
@@ -60,7 +60,7 @@ internal override void RiechtFreundBase(CoreMarker markierung)
/// Die gerochene Markierung
public virtual void RiechtFreund(Markierung markierung) { }
- internal override void SiehtBase(CoreFruit obst)
+ internal override void SpotsCoreAnt(CoreFruit obst)
{
Sieht(new Obst(obst));
}
@@ -73,7 +73,7 @@ internal override void SiehtBase(CoreFruit obst)
/// Das gesichtete StĂŒck Obst
public virtual void Sieht(Obst obst) { }
- internal override void SiehtBase(CoreSugar zucker)
+ internal override void SpotsCoreAnt(CoreSugar zucker)
{
Sieht(new Zucker(zucker));
}
@@ -86,7 +86,7 @@ internal override void SiehtBase(CoreSugar zucker)
/// Der gesichtete ZuckerhĂŒgel
public virtual void Sieht(Zucker zucker) { }
- internal override void SiehtFeindBase(CoreAnt ameise)
+ internal override void SpotsEnemyCoreAnt(CoreAnt ameise)
{
SiehtFeind(new Ameise(ameise));
}
@@ -100,7 +100,7 @@ internal override void SiehtFeindBase(CoreAnt ameise)
/// ErspÀhte feindliche Ameise
public virtual void SiehtFeind(Ameise ameise) { }
- internal override void SiehtFeindBase(CoreBug wanze)
+ internal override void SpotsEnemyCoreAnt(CoreBug wanze)
{
SiehtFeind(new Wanze(wanze));
}
@@ -113,7 +113,7 @@ internal override void SiehtFeindBase(CoreBug wanze)
/// ErspÀhte Wanze
public virtual void SiehtFeind(Wanze wanze) { }
- internal override void SiehtFreundBase(CoreAnt ameise)
+ internal override void SpotsFriendCoreAnt(CoreAnt ameise)
{
SiehtFreund(new Ameise(ameise));
}
@@ -127,7 +127,7 @@ internal override void SiehtFreundBase(CoreAnt ameise)
/// ErspÀhte befreundete Ameise
public virtual void SiehtFreund(Ameise ameise) { }
- internal override void SiehtVerbĂŒndetenBase(CoreAnt ameise)
+ internal override void SpotsTeamMemberCoreAnt(CoreAnt ameise)
{
SiehtVerbĂŒndeten(new Ameise(ameise));
}
@@ -141,7 +141,7 @@ public virtual void SiehtFreund(Ameise ameise) { }
/// ErspĂ€hte verbĂŒndete Ameise
public virtual void SiehtVerbĂŒndeten(Ameise ameise) { }
- internal override void TickBase()
+ internal override void TickCoreAnt()
{
Tick();
}
@@ -154,7 +154,7 @@ internal override void TickBase()
///
public virtual void Tick() { }
- internal override void WartetBase()
+ internal override void WaitingCoreAnt()
{
Wartet();
}
@@ -166,7 +166,7 @@ internal override void WartetBase()
///
public virtual void Wartet() { }
- internal override void WirdAngegriffenBase(CoreAnt ameise)
+ internal override void IsUnderAttackCoreAnt(CoreAnt ameise)
{
WirdAngegriffen(new Ameise(ameise));
}
@@ -180,7 +180,7 @@ internal override void WirdAngegriffenBase(CoreAnt ameise)
/// Angreifende Ameise
public virtual void WirdAngegriffen(Ameise ameise) { }
- internal override void WirdAngegriffenBase(CoreBug wanze)
+ internal override void UnderAttackCoreAnt(CoreBug wanze)
{
WirdAngegriffen(new Wanze(wanze));
}
@@ -194,7 +194,7 @@ internal override void WirdAngegriffenBase(CoreBug wanze)
/// Angreifende Wanze
public virtual void WirdAngegriffen(Wanze wanze) { }
- internal override void WirdMĂŒdeBase()
+ internal override void IsGettingTiredCoreAnt()
{
WirdMĂŒde();
}
@@ -205,7 +205,7 @@ public virtual void WirdAngegriffen(Wanze wanze) { }
///
public virtual void WirdMĂŒde() { }
- internal override void ZielErreichtBase(CoreFruit obst)
+ internal override void ArrivedAtTargetCoreAnt(CoreFruit obst)
{
ZielErreicht(new Obst(obst));
}
@@ -219,7 +219,7 @@ internal override void ZielErreichtBase(CoreFruit obst)
/// Das erreichte StĂŒck Obst
public virtual void ZielErreicht(Obst obst) { }
- internal override void ZielErreichtBase(CoreSugar zucker)
+ internal override void ArrivedAtTargetCoreAnt(CoreSugar zucker)
{
ZielErreicht(new Zucker(zucker));
}
@@ -245,7 +245,7 @@ public virtual void ZielErreicht(Zucker zucker) { }
/// Zielrichtung
public void DreheInRichtung(int richtung)
{
- DreheInRichtungBase(richtung);
+ TurnToDirectionCoreInsect(richtung);
}
///
@@ -256,7 +256,7 @@ public void DreheInRichtung(int richtung)
/// Winkel
public void DreheUmWinkel(int winkel)
{
- DreheUmWinkelBase(winkel);
+ TurnByDegreesCoreInsect(winkel);
}
///
@@ -266,7 +266,7 @@ public void DreheUmWinkel(int winkel)
///
public void DreheUm()
{
- DreheUmBase();
+ TurnAroundCoreInsect();
}
///
@@ -276,7 +276,7 @@ public void DreheUm()
/// Anvisiertes Ziel
public void DreheZuZiel(Spielobjekt ziel)
{
- DreheZuZielBase(ziel.Element);
+ TurnToTargetCoreInsect(ziel.Element);
}
///
@@ -286,7 +286,7 @@ public void DreheZuZiel(Spielobjekt ziel)
///
public void BleibStehen()
{
- BleibStehenBase();
+ StopMovementCoreInsect();
}
///
@@ -297,7 +297,7 @@ public void BleibStehen()
///
public void GeheGeradeaus()
{
- GeheGeradeausBase();
+ GoForwardCoreInsect();
}
///
@@ -309,7 +309,7 @@ public void GeheGeradeaus()
/// Zu laufende Strecke in Ameisenschritten
public void GeheGeradeaus(int entfernung)
{
- GeheGeradeausBase(entfernung);
+ GoForwardCoreInsect(entfernung);
}
///
@@ -321,7 +321,7 @@ public void GeheGeradeaus(int entfernung)
/// Objekt, vor dem weggegangen werden soll
public void GeheWegVon(Spielobjekt ziel)
{
- GeheWegVonBase(ziel.Element);
+ GoAwayFromCoreInsect(ziel.Element);
}
///
@@ -334,7 +334,7 @@ public void GeheWegVon(Spielobjekt ziel)
/// Entfernung, die zurĂŒckgelegt werden soll
public void GeheWegVon(Spielobjekt ziel, int entfernung)
{
- GeheWegVonBase(ziel.Element, entfernung);
+ GoAwayFromCoreInsect(ziel.Element, entfernung);
}
///
@@ -344,7 +344,7 @@ public void GeheWegVon(Spielobjekt ziel, int entfernung)
/// Ziel
public void GeheZuZiel(Spielobjekt ziel)
{
- GeheZuZielBase(ziel.Element);
+ GoToTargetCoreInsect(ziel.Element);
}
///
@@ -353,7 +353,7 @@ public void GeheZuZiel(Spielobjekt ziel)
///
public void GeheZuBau()
{
- GeheZuBauBase();
+ GoToAnthillCoreInsect();
}
///
@@ -365,7 +365,7 @@ public void GeheZuBau()
/// Angriffsziel
public void GreifeAn(Insekt ziel)
{
- GreifeAnBase((CoreInsect)ziel.Element);
+ AttackCoreInsect((CoreInsect)ziel.Element);
}
///
@@ -381,11 +381,11 @@ public void Nimm(Nahrung nahrung)
{
if (nahrung is Zucker)
{
- NimmBase((CoreSugar)nahrung.Element);
+ TakeCoreInsect((CoreSugar)nahrung.Element);
}
else if (nahrung is Obst)
{
- NimmBase((CoreFruit)nahrung.Element);
+ TakeCoreInsect((CoreFruit)nahrung.Element);
}
}
@@ -398,7 +398,7 @@ public void Nimm(Nahrung nahrung)
///
public void LasseNahrungFallen()
{
- LasseNahrungFallenBase();
+ DropFood();
}
///
@@ -412,7 +412,7 @@ public void LasseNahrungFallen()
/// Information
public void SprĂŒheMarkierung(int information)
{
- SprĂŒheMarkierungBase(information);
+ MakeMarkerCoreInsects(information);
}
///
@@ -427,7 +427,7 @@ public void LasseNahrungFallen()
/// GröĂe der Markierung in Ameisenschritten
public void SprĂŒheMarkierung(int information, int gröĂe)
{
- SprĂŒheMarkierungBase(information, gröĂe);
+ MakeMarkerCoreInsects(information, gröĂe);
}
///
@@ -438,7 +438,7 @@ public void LasseNahrungFallen()
/// Nachricht
public void Denke(string nachricht)
{
- DenkeCore(nachricht);
+ ThinkCore(nachricht);
}
#endregion
@@ -451,7 +451,7 @@ public void Denke(string nachricht)
///
public int MaximaleEnergie
{
- get { return MaximaleEnergieBase; }
+ get { return MaximumEnergyCoreInsect; }
}
///
@@ -460,7 +460,7 @@ public int MaximaleEnergie
///
public int MaximaleGeschwindigkeit
{
- get { return MaximaleGeschwindigkeitBase; }
+ get { return MaximumSpeedCoreInsect; }
}
///
@@ -471,7 +471,7 @@ public int MaximaleGeschwindigkeit
///
public int MaximaleLast
{
- get { return MaximaleLastBase; }
+ get { return MaximumLoadCoreInsect; }
}
///
@@ -483,7 +483,7 @@ public int MaximaleLast
///
public int Reichweite
{
- get { return ReichweiteBase; }
+ get { return RangeCoreInsect; }
}
///
@@ -494,7 +494,7 @@ public int Reichweite
///
public int Angriff
{
- get { return AngriffBase; }
+ get { return AttackStrengthCoreInsect; }
}
///
@@ -505,7 +505,7 @@ public int Angriff
///
public int Sichtweite
{
- get { return SichtweiteBase; }
+ get { return ViewRangeCoreInsect; }
}
///
@@ -515,7 +515,7 @@ public int Sichtweite
///
public int Drehgeschwindigkeit
{
- get { return DrehgeschwindigkeitBase; }
+ get { return RotationSpeedCoreInsect; }
}
///
@@ -526,7 +526,7 @@ public int Drehgeschwindigkeit
///
public int AktuelleEnergie
{
- get { return AktuelleEnergieBase; }
+ get { return CurrentEnergyCoreInsect; }
}
///
@@ -540,7 +540,7 @@ public int AktuelleEnergie
///
public int AktuelleGeschwindigkeit
{
- get { return AktuelleGeschwindigkeitBase; }
+ get { return CurrentSpeedCoreInsect; }
}
///
@@ -550,7 +550,7 @@ public int AktuelleGeschwindigkeit
///
public int AktuelleLast
{
- get { return AktuelleLastBase; }
+ get { return CurrentLoadCoreInsect; }
}
///
@@ -560,7 +560,7 @@ public int AktuelleLast
///
public int AnzahlAmeisenInSichtweite
{
- get { return FriendlyAntsInViewrange; }
+ get { return ColonyAntsInViewRange; }
}
///
@@ -571,7 +571,7 @@ public int AnzahlAmeisenInSichtweite
///
public int AnzahlAmeisenDerSelbenKasteInSichtweite
{
- get { return FriendlyAntsFromSameCasteInViewrange; }
+ get { return CasteAntsInViewRange; }
}
///
@@ -581,7 +581,7 @@ public int AnzahlAmeisenDerSelbenKasteInSichtweite
///
public int AnzahlAmeisenDesTeamsInSichtweite
{
- get { return TeamAntsInViewrange; }
+ get { return TeamAntsInViewRange; }
}
///
@@ -591,7 +591,7 @@ public int AnzahlAmeisenDesTeamsInSichtweite
///
public int AnzahlFremderAmeisenInSichtweite
{
- get { return ForeignAntsInViewrange; }
+ get { return EnemyAntsInViewRange; }
}
///
@@ -601,7 +601,7 @@ public int AnzahlFremderAmeisenInSichtweite
///
public int WanzenInSichtweite
{
- get { return BugsInViewrange; }
+ get { return BugsInViewRange; }
}
///
@@ -610,7 +610,7 @@ public int WanzenInSichtweite
///
public int EntfernungZuBau
{
- get { return EntfernungZuBauBase; }
+ get { return DistanceToAnthillCoreInsect; }
}
///
@@ -622,9 +622,9 @@ public Obst GetragenesObst
{
get
{
- if (GetragenesObstBase != null)
+ if (CarryingFruitCoreInsect != null)
{
- return new Obst(GetragenesObstBase);
+ return new Obst(CarryingFruitCoreInsect);
}
else
{
@@ -639,7 +639,7 @@ public Obst GetragenesObst
///
public string Kaste
{
- get { return KasteBase; }
+ get { return CasteCoreInsect; }
}
///
@@ -651,29 +651,29 @@ public Spielobjekt Ziel
{
get
{
- if (ZielBase is CoreSugar)
+ if (DestinationCoreInsect is CoreSugar)
{
- return new Zucker((CoreSugar)ZielBase);
+ return new Zucker((CoreSugar)DestinationCoreInsect);
}
- else if (ZielBase is CoreFruit)
+ else if (DestinationCoreInsect is CoreFruit)
{
- return new Obst((CoreFruit)ZielBase);
+ return new Obst((CoreFruit)DestinationCoreInsect);
}
- else if (ZielBase is CoreAnt)
+ else if (DestinationCoreInsect is CoreAnt)
{
- return new Ameise((CoreAnt)ZielBase);
+ return new Ameise((CoreAnt)DestinationCoreInsect);
}
- else if (ZielBase is CoreBug)
+ else if (DestinationCoreInsect is CoreBug)
{
- return new Wanze((CoreBug)ZielBase);
+ return new Wanze((CoreBug)DestinationCoreInsect);
}
- else if (ZielBase is CoreMarker)
+ else if (DestinationCoreInsect is CoreMarker)
{
- return new Markierung((CoreMarker)ZielBase);
+ return new Markierung((CoreMarker)DestinationCoreInsect);
}
- else if (ZielBase is CoreAnthill)
+ else if (DestinationCoreInsect is CoreAnthill)
{
- return new Bau((CoreAnthill)ZielBase);
+ return new Bau((CoreAnthill)DestinationCoreInsect);
}
else
{
@@ -691,7 +691,7 @@ public Spielobjekt Ziel
///
public bool IstMĂŒde
{
- get { return IstMĂŒdeBase; }
+ get { return IsTiredCoreAnt; }
}
///
@@ -702,7 +702,7 @@ public bool IstMĂŒde
///
public int RestStrecke
{
- get { return RestStreckeBase; }
+ get { return DistanceToDestinationCoreInsect; }
}
///
@@ -713,7 +713,7 @@ public int RestStrecke
///
public int RestWinkel
{
- get { return RestWinkelBase; }
+ get { return ResidualAngle; }
}
///
@@ -724,7 +724,7 @@ public int RestWinkel
///
public int Richtung
{
- get { return RichtungBase; }
+ get { return GetDirectionCoreInsect(); }
}
///
@@ -733,7 +733,7 @@ public int Richtung
///
public bool Angekommen
{
- get { return AngekommenBase; }
+ get { return ArrivedCoreInsect; }
}
///
@@ -743,7 +743,7 @@ public bool Angekommen
///
public int ZurĂŒckgelegteStrecke
{
- get { return ZurĂŒckgelegteStreckeBase; }
+ get { return NumberStepsWalked; }
}
private Zufall zufall;
@@ -760,7 +760,7 @@ public Zufall Zufall
get
{
if (zufall == null)
- zufall = new Zufall(RandomBase);
+ zufall = new Zufall(RandomCoreInsect);
return zufall;
}
}
@@ -777,7 +777,7 @@ public Zufall Zufall
/// Braucht noch TrÀger
public bool BrauchtNochTrÀger(Obst obst)
{
- return ((CoreFruit)obst.Element).BrauchtNochTrÀger(colony);
+ return ((CoreFruit)obst.Element).NeedSupport(Colony);
}
#endregion
diff --git a/SimulationCore/Deutsch/Insekt.cs b/SimulationCore/Deutsch/Insekt.cs
index afb701e..0d5643d 100644
--- a/SimulationCore/Deutsch/Insekt.cs
+++ b/SimulationCore/Deutsch/Insekt.cs
@@ -12,7 +12,7 @@ internal Insekt(Simulation.CoreInsect insekt) : base(insekt) { }
///
public override int Id
{
- get { return ((Simulation.CoreInsect)element).id; }
+ get { return ((Simulation.CoreInsect)element).Id; }
}
///
@@ -20,7 +20,7 @@ public override int Id
///
public int AktuelleEnergie
{
- get { return ((Simulation.CoreInsect)element).AktuelleEnergieBase; }
+ get { return ((Simulation.CoreInsect)element).CurrentEnergyCoreInsect; }
}
///
@@ -28,15 +28,15 @@ public int AktuelleEnergie
///
public int AktuelleGeschwindigkeit
{
- get { return ((Simulation.CoreInsect)element).AktuelleGeschwindigkeitBase; }
+ get { return ((Simulation.CoreInsect)element).CurrentSpeedCoreInsect; }
}
///
/// Gibt die AngriffsstÀrke an
///
- public int Angriff
+ public int Angriffstaerke
{
- get { return ((Simulation.CoreInsect)element).AngriffBase; }
+ get { return ((Simulation.CoreInsect)element).AttackStrengthCoreInsect; }
}
///
@@ -44,7 +44,7 @@ public int Angriff
///
public int Drehgeschwindigkeit
{
- get { return ((Simulation.CoreInsect)element).DrehgeschwindigkeitBase; }
+ get { return ((Simulation.CoreInsect)element).RotationSpeedCoreInsect; }
}
///
@@ -52,7 +52,7 @@ public int Drehgeschwindigkeit
///
public int MaximaleEnergie
{
- get { return ((Simulation.CoreInsect)element).MaximaleEnergieBase; }
+ get { return ((Simulation.CoreInsect)element).MaximumEnergyCoreInsect; }
}
///
@@ -60,7 +60,7 @@ public int MaximaleEnergie
///
public int MaximaleGeschwindigkeit
{
- get { return ((Simulation.CoreInsect)element).MaximaleGeschwindigkeitBase; }
+ get { return ((Simulation.CoreInsect)element).MaximumSpeedCoreInsect; }
}
///
@@ -68,7 +68,7 @@ public int MaximaleGeschwindigkeit
///
public int Sichtweite
{
- get { return ((Simulation.CoreInsect)element).SichtweiteBase; }
+ get { return ((Simulation.CoreInsect)element).ViewRangeCoreInsect; }
}
///
@@ -76,7 +76,7 @@ public int Sichtweite
///
public int RestWinkel
{
- get { return ((Simulation.CoreInsect)element).RestWinkelBase; }
+ get { return ((Simulation.CoreInsect)element).ResidualAngle; }
}
///
@@ -84,7 +84,7 @@ public int RestWinkel
///
public int Richtung
{
- get { return ((Simulation.CoreInsect)element).RichtungBase; }
+ get { return ((Simulation.CoreInsect)element).GetDirectionCoreInsect(); }
}
///
@@ -92,7 +92,7 @@ public int Richtung
///
public int RestStrecke
{
- get { return ((Simulation.CoreInsect)element).RestStreckeBase; }
+ get { return ((Simulation.CoreInsect)element).DistanceToDestinationCoreInsect; }
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Deutsch/Koordinate.cs b/SimulationCore/Deutsch/Koordinate.cs
index 64dbdd5..26d146a 100644
--- a/SimulationCore/Deutsch/Koordinate.cs
+++ b/SimulationCore/Deutsch/Koordinate.cs
@@ -15,7 +15,7 @@ public static class Koordinate
/// Entfernung in Schritten
public static int BestimmeEntfernung(Spielobjekt objekt1, Spielobjekt objekt2)
{
- return CoreCoordinate.BestimmeEntfernung(objekt1.Element, objekt2.Element);
+ return CoreCoordinate.DetermineDistance(objekt1.Element, objekt2.Element);
}
///
@@ -26,7 +26,7 @@ public static int BestimmeEntfernung(Spielobjekt objekt1, Spielobjekt objekt2)
/// Entfernung in Schritten
public static int BestimmeEntfernung(CoreAnt objekt1, Spielobjekt objekt2)
{
- return CoreCoordinate.BestimmeEntfernung(objekt1, objekt2.Element);
+ return CoreCoordinate.DetermineDistance(objekt1, objekt2.Element);
}
///
@@ -37,7 +37,7 @@ public static int BestimmeEntfernung(CoreAnt objekt1, Spielobjekt objekt2)
/// Entfernung in Schritten
public static int BestimmeEntfernung(Spielobjekt objekt1, CoreAnt objekt2)
{
- return CoreCoordinate.BestimmeEntfernung(objekt1.Element, objekt2);
+ return CoreCoordinate.DetermineDistance(objekt1.Element, objekt2);
}
///
@@ -48,7 +48,7 @@ public static int BestimmeEntfernung(Spielobjekt objekt1, CoreAnt objekt2)
/// Entfernung in Schritten
public static int BestimmeEntfernung(CoreAnt objekt1, CoreAnt objekt2)
{
- return CoreCoordinate.BestimmeEntfernung(objekt1, objekt2);
+ return CoreCoordinate.DetermineDistance(objekt1, objekt2);
}
///
@@ -59,7 +59,7 @@ public static int BestimmeEntfernung(CoreAnt objekt1, CoreAnt objekt2)
/// Entfernung in Gradschritten
public static int BestimmeRichtung(Spielobjekt objekt1, Spielobjekt objekt2)
{
- return CoreCoordinate.BestimmeRichtung(objekt1.Element, objekt2.Element);
+ return CoreCoordinate.DetermineDirection(objekt1.Element, objekt2.Element);
}
///
@@ -70,7 +70,7 @@ public static int BestimmeRichtung(Spielobjekt objekt1, Spielobjekt objekt2)
/// Entfernung in Gradschritten
public static int BestimmeRichtung(CoreAnt objekt1, Spielobjekt objekt2)
{
- return CoreCoordinate.BestimmeRichtung(objekt1, objekt2.Element);
+ return CoreCoordinate.DetermineDirection(objekt1, objekt2.Element);
}
///
@@ -81,7 +81,7 @@ public static int BestimmeRichtung(CoreAnt objekt1, Spielobjekt objekt2)
/// Entfernung in Gradschritten
public static int BestimmeRichtung(Spielobjekt objekt1, CoreAnt objekt2)
{
- return CoreCoordinate.BestimmeRichtung(objekt1.Element, objekt2);
+ return CoreCoordinate.DetermineDirection(objekt1.Element, objekt2);
}
///
@@ -92,7 +92,7 @@ public static int BestimmeRichtung(Spielobjekt objekt1, CoreAnt objekt2)
/// Entfernung in Gradschritten
public static int BestimmeRichtung(CoreAnt objekt1, CoreAnt objekt2)
{
- return CoreCoordinate.BestimmeRichtung(objekt1, objekt2);
+ return CoreCoordinate.DetermineDirection(objekt1, objekt2);
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Deutsch/Nahrung.cs b/SimulationCore/Deutsch/Nahrung.cs
index 1161ec3..304a6da 100644
--- a/SimulationCore/Deutsch/Nahrung.cs
+++ b/SimulationCore/Deutsch/Nahrung.cs
@@ -12,7 +12,7 @@ internal Nahrung(Simulation.CoreFood nahrung) : base(nahrung) { }
///
public int Menge
{
- get { return ((Simulation.CoreFood)element).Menge; }
+ get { return ((Simulation.CoreFood)element).Amount; }
}
///
diff --git a/SimulationCore/English/AccessAttribute.cs b/SimulationCore/English/AccessAttribute.cs
index fc6adcd..3d8ec9d 100644
--- a/SimulationCore/English/AccessAttribute.cs
+++ b/SimulationCore/English/AccessAttribute.cs
@@ -3,7 +3,7 @@
namespace AntMe.English
{
///
- /// Baseattribute for all access-requesting attributes.
+ /// Base attribute for all access requesting attributes.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public abstract class AccessAttribute : Attribute
diff --git a/SimulationCore/English/Ant.cs b/SimulationCore/English/Ant.cs
index 8fc22ff..3d150c4 100644
--- a/SimulationCore/English/Ant.cs
+++ b/SimulationCore/English/Ant.cs
@@ -3,7 +3,7 @@
namespace AntMe.English
{
///
- /// Represents a foreign ant
+ /// Represents a foreign ant.
///
public sealed class Ant : Insect
{
@@ -12,26 +12,23 @@ internal Ant(CoreAnt ant) : base(ant) { }
///
/// Delivers the current load of this ant.
///
- public int CurrentLoad
- {
- get { return ((CoreAnt)Baseitem).AktuelleLastBase; }
- }
+ public int CurrentLoad => ((CoreAnt)Baseitem).CurrentLoadCoreInsect;
///
- /// delivers the current carried fruit.
+ /// Delivers the current carried fruit.
///
public Fruit CarriedFruit
{
get
{
CoreAnt temp = (CoreAnt)Baseitem;
- if (temp.GetragenesObstBase == null)
+ if (temp.CarryingFruitCoreInsect == null)
{
return null;
}
else
{
- return new Fruit(temp.GetragenesObstBase);
+ return new Fruit(temp.CarryingFruitCoreInsect);
}
}
}
@@ -39,25 +36,16 @@ public Fruit CarriedFruit
///
/// Delivers the maximum load.
///
- public int MaximumLoad
- {
- get { return ((CoreAnt)Baseitem).MaximaleLastBase; }
- }
+ public int MaximumLoad => ((CoreAnt)Baseitem).MaximumLoadCoreInsect;
///
/// Delivers the range.
///
- public int Range
- {
- get { return ((CoreAnt)Baseitem).ReichweiteBase; }
- }
+ public int Range => ((CoreAnt)Baseitem).RangeCoreInsect;
///
- /// Delivers the Colony-Name.
+ /// Delivers the colony name.
///
- public string Colony
- {
- get { return ((CoreAnt)Baseitem).colony.Player.ColonyName; }
- }
+ public string Colony => ((CoreAnt)Baseitem).Colony.Player.ColonyName;
}
}
\ No newline at end of file
diff --git a/SimulationCore/English/Anthill.cs b/SimulationCore/English/Anthill.cs
index 271705e..5512833 100644
--- a/SimulationCore/English/Anthill.cs
+++ b/SimulationCore/English/Anthill.cs
@@ -3,14 +3,14 @@
namespace AntMe.English
{
///
- /// Represents an anthill
+ /// Represents an ant hill
///
public sealed class Anthill : Item
{
internal Anthill(CoreAnthill anthill) : base(anthill) { }
///
- /// Delivers the unique ID of this anthill
+ /// Delivers the unique ID of this ant hill
///
public override int Id
{
diff --git a/SimulationCore/English/BaseAnt.cs b/SimulationCore/English/BaseAnt.cs
index ecd76c4..2fe2a82 100644
--- a/SimulationCore/English/BaseAnt.cs
+++ b/SimulationCore/English/BaseAnt.cs
@@ -1,4 +1,5 @@
-ï»żusing AntMe.Simulation;
+ï»żusing System;
+using AntMe.Simulation;
using System.Collections.Generic;
namespace AntMe.English
@@ -9,136 +10,129 @@ namespace AntMe.English
///
public abstract class BaseAnt : CoreAnt
{
- #region Eventwrapper
+ #region Event wrapper
- internal override string BestimmeKasteBase(Dictionary anzahl)
+ internal override string DetermineCasteCoreAnt(Dictionary number)
{
- return ChooseCaste(anzahl);
+ return ChooseCaste(number);
}
///
- /// Every time that a new ant is born, its job group must be set. You can do
+ /// Every time a new ant is born, its caste must be set. You can do
/// so with the help of the value returned by this method.
- /// Read more
///
- /// Number of ants for every caste
- /// Caste-Name for the next ant
- public virtual string ChooseCaste(Dictionary typeCount)
+ /// Dictionary with caste name and corresponding number of ants in this caste
+ /// Caste name for the next ant
+ public virtual string ChooseCaste(Dictionary number)
{
return string.Empty;
}
-
- internal override void IstGestorbenBase(CoreKindOfDeath todesArt)
- {
- HasDied((KindOfDeath)(int)todesArt);
- }
-
///
/// This method is called if an ant dies. It informs you that the ant has
/// died. The ant cannot undertake any more actions from that point forward.
- /// Read more
///
/// Kind of Death
public virtual void HasDied(KindOfDeath kindOfDeath) { }
- internal override void RiechtFreundBase(CoreMarker markierung)
+
+ internal override void HasDiedCoreAnt(CoreKindOfDeath kindOfDeath)
{
- DetectedScentFriend(new Marker(markierung));
+ HasDied((KindOfDeath)(int)kindOfDeath);
+ }
+
+ internal override void SpotsFriendCoreAnt(CoreMarker marker)
+ {
+ SpotsFriend(new Marker(marker));
}
///
/// Friendly ants can detect markers left by other ants. This method is
/// called when an ant smells a friendly marker for the first time.
- /// Read more
///
/// Marker
- public virtual void DetectedScentFriend(Marker marker) { }
+ public virtual void SpotsFriend(Marker marker) { }
- internal override void SiehtBase(CoreFruit obst)
+ internal override void SpotsCoreAnt(CoreFruit fruit)
{
- Spots(new Fruit(obst));
+ Spots(new Fruit(fruit));
}
///
/// This method is called as soon as an ant sees an apple within its
/// 360° visual range. The parameter is the piece of fruit that the
/// ant has spotted.
- /// Read more
///
/// spotted fruit
public virtual void Spots(Fruit fruit) { }
- internal override void SiehtBase(CoreSugar zucker)
+ internal override void SpotsCoreAnt(CoreSugar sugar)
{
- Spots(new Sugar(zucker));
+ Spots(new Sugar(sugar));
}
///
- /// This method is called as soon as an ant sees a mound of sugar in
- /// its 360° visual range. The parameter is the mound of sugar that
+ /// This method is called as soon as an ant sees a fruit hill in
+ /// its 360° visual range. The parameter is the fruit hill that
/// the ant has spotted.
- /// Read more
///
- /// spotted sugar
+ /// spotted fruit
public virtual void Spots(Sugar sugar) { }
- internal override void SiehtFeindBase(CoreAnt ameise)
+ internal override void SpotsEnemyCoreAnt(CoreAnt ant)
{
- SpotsEnemy(new Ant(ameise));
+ SpotsEnemy(new Ant(ant));
}
///
/// Just as ants can see various types of food, they can also visually
/// detect other game elements. This method is called if the ant detects
/// an ant from an enemy colony.
- /// Read more
///
- /// spotted ant
- public virtual void SpotsEnemy(Ant ant) { }
+ /// Spotted enemy ant.
+ public virtual void SpotsEnemy(Ant ant)
+ {
+ }
- internal override void SiehtFeindBase(CoreBug wanze)
+ internal override void SpotsEnemyCoreAnt(CoreBug bug)
{
- SpotsEnemy(new Bug(wanze));
+ SpotsEnemy(new Bug(bug));
}
///
/// Just as ants can see various types of food, they can also visually
/// detect other game elements. This method is called if the ant sees
/// a bug.
- /// Read more
///
/// spotted bug
public virtual void SpotsEnemy(Bug bug) { }
- internal override void SiehtFreundBase(CoreAnt ameise)
+ internal override void SpotsFriendCoreAnt(CoreAnt ant)
{
- SpotsFriend(new Ant(ameise));
+ SpotsFriend(new Ant(ant));
}
///
/// Just as ants can see various types of food, they can also visually
/// detect other game elements. This method is called if the ant sees an
/// ant from the same colony.
- /// Read more
///
/// spotted ant
public virtual void SpotsFriend(Ant ant) { }
- internal override void SiehtVerbĂŒndetenBase(CoreAnt ameise)
+ internal override void SpotsTeamMemberCoreAnt(CoreAnt ant)
{
- SpotsTeammate(new Ant(ameise));
+ SpotsTeammate(new Ant(ant));
}
///
/// Just as ants can see various types of food, they can also visually
/// detect other game elements. This method is called if the ant detects
/// an ant from a friendly colony (an ant on the same team).
- /// Read more
///
/// spotted ant
public virtual void SpotsTeammate(Ant ant) { }
- internal override void TickBase()
+ internal override void TickCoreAnt()
{
Tick();
}
@@ -147,11 +141,10 @@ internal override void TickBase()
/// This method is called in every simulation round, regardless of additional
/// conditions. It is ideal for actions that must be executed but that are not
/// addressed by other methods.
- /// Read more
///
public virtual void Tick() { }
- internal override void WartetBase()
+ internal override void WaitingCoreAnt()
{
Waiting();
}
@@ -159,366 +152,374 @@ internal override void WartetBase()
///
/// If the ant has no assigned tasks, it waits for new tasks. This method
/// is called to inform you that it is waiting.
- /// Read more
///
public virtual void Waiting() { }
- internal override void WirdAngegriffenBase(CoreAnt ameise)
+ internal override void IsUnderAttackCoreAnt(CoreAnt ant)
{
- UnderAttack(new Ant(ameise));
+ UnderAttack(new Ant(ant));
}
///
/// Enemy creatures may actively attack the ant. This method is called if an
/// enemy ant attacks. the ant can then decide how to react.
- /// Read more
///
/// attacking ant
public virtual void UnderAttack(Ant ant) { }
- internal override void WirdAngegriffenBase(CoreBug wanze)
+ internal override void UnderAttackCoreAnt(CoreBug bug)
{
- UnderAttack(new Bug(wanze));
+ UnderAttack(new Bug(bug));
}
///
/// Enemy creatures may actively attack the ant. This method is called if a
/// bug attacks. the ant can decide how to react.
- /// Read more
///
/// attacking bug
public virtual void UnderAttack(Bug bug) { }
- internal override void WirdMĂŒdeBase()
+ internal override void IsGettingTiredCoreAnt()
{
GettingTired();
}
///
/// This method is called when an ant has travelled one third of its movement range.
- /// Read more
///
public virtual void GettingTired() { }
- internal override void ZielErreichtBase(CoreFruit obst)
+ internal override void ArrivedAtTargetCoreAnt(CoreFruit fruit)
{
- DestinationReached(new Fruit(obst));
+ DestinationReached(new Fruit(fruit));
}
///
/// If the antâs destination is a piece of fruit, this method is called as soon
/// as the ant reaches its destination. It means that the ant is now near enough
/// to its destination/target to interact with it.
- /// Read more
///
/// reached fruit
public virtual void DestinationReached(Fruit fruit) { }
- internal override void ZielErreichtBase(CoreSugar zucker)
+ internal override void ArrivedAtTargetCoreAnt(CoreSugar sugar)
{
- DestinationReached(new Sugar(zucker));
+ DestinationReached(new Sugar(sugar));
}
///
- /// If the antâs destination is a mound of sugar, this method is called as soon
+ /// If the antâs destination is a sugar pile, this method is called as soon
/// as the ant has reached its destination. It means that the ant is now near
/// enough to its destination/target to interact with it.
- /// Read more
///
- /// reached sugar
+ /// Reached sugar pile.
public virtual void DestinationReached(Sugar sugar) { }
#endregion
- #region Command-Wrapper
-
+ #region Command wrapper
///
- /// The ant turns in the specified direction. The angle around which it
- /// turns is determined automatically.
- /// Read more
+ /// The ant moves forward. The antâs destination remains unaltered. If a
+ /// value is specified, the ant will aim for its destination again as soon
+ /// as it has travelled the specified distance.
///
- /// direction
- public void TurnToDirection(int direction)
+ public void GoForward()
{
- DreheInRichtungBase(direction);
+ GoForwardCoreInsect();
}
///
- /// The ant turns itself around the specified angle. Positive values turn
- /// the ant to the right, negative values turn it to the left.
- /// Read more
+ /// The ant moves forward. The antâs destination remains unaltered. If a
+ /// value is specified, the ant will aim for its destination again as soon
+ /// as it has travelled the specified distance.
+ /// Read more
///
- /// degrees
- public void TurnByDegrees(int degrees)
+ /// steps
+ public void GoForward(int steps)
{
- DreheUmWinkelBase(degrees);
+ GoForwardCoreInsect(steps);
}
///
- /// The ant turns 180 degrees in the opposite direction. Has the same effect
- /// as TurnByDegrees(180).
- /// Read more
+ /// The ant saves the specified destination and walks to it.
+ /// Read more
///
- public void TurnAround()
+ /// destination
+ public void GoToDestination(Item destination)
{
- DreheUmBase();
+ GoToTargetCoreInsect(destination.Baseitem);
}
///
- /// The ant turns in the direction of the specified destination.
- /// Read more
+ /// The ant saves the nearest anthill as its destination and walks towards it.
+ /// Read more
///
- /// item
- public void TurnToDetination(Item destination)
+ public void GoToAnthill()
{
- DreheZuZielBase(destination.Baseitem);
+ GoToAnthillCoreInsect();
}
///
- /// The ant stands still and forgets its current destination. In the next
- /// round the result of Waiting() is called.
- /// Read more
+ /// The ant picks up the specified food. In the case of a mound of fruit,
+ /// it takes as much as possible until it reaches its maximum load (see
+ /// CurrentLoad and MaximumLoad). In the case of a piece of fruit, the ant
+ /// begins carrying the fruit (see CarryingFruit).
+ /// Read more
///
- public void Stop()
+ /// food
+ public void Take(Food food)
{
- BleibStehenBase();
+ if (food is Sugar)
+ {
+ TakeCoreInsect((CoreSugar)food.Baseitem);
+ }
+ else if (food is Fruit)
+ {
+ TakeCoreInsect((CoreFruit)food.Baseitem);
+ }
}
///
- /// The ant moves forward. The antâs destination remains unaltered. If a
- /// value is specified, the ant will aim for its destination again as soon
- /// as it has travelled the specified distance.
- /// Read more
+ /// The ant sprays a scent marker at the current location. The possible
+ /// parameters are data contained in the marker (these can be read out of the
+ /// result of Spots(Marker) via marker.Information) and how far the maker
+ /// spreads out. The farther the marker spreads out, the faster it will disappear.
+ /// Read more
///
- public void GoForward()
+ /// information
+ public void MakeMarker(int information)
{
- GeheGeradeausBase();
+ MakeMarkerCoreInsects(information);
}
///
- /// The ant moves forward. The antâs destination remains unaltered. If a
- /// value is specified, the ant will aim for its destination again as soon
- /// as it has travelled the specified distance.
- /// Read more
+ /// The ant sprays a scent marker at the current location. The possible parameters
+ /// are data contained in the marker (these can be read out of the result of
+ /// Spots(Marker) via marker.Information) and how far the maker spreads out.
+ /// The farther the marker spreads out, the faster it will disappear.
+ /// Read more
///
- /// steps
- public void GoForward(int steps)
+ /// information
+ /// range
+ public void MakeMarker(int information, int range)
{
- GeheGeradeausBase(steps);
+ MakeMarkerCoreInsects(information, range);
}
+
+ #endregion
+
+ #region Property-Wrapper
+
///
- /// The ant turns in the direction opposite the specified destination and
- /// then walks straight ahead. The antâs destination remains unaltered and
- /// the walking distance can be specified.
- /// Read more
+ /// Returns the antâs maximum energy. The unit is hit points.
+ /// Read more
///
- /// item
- public void GoAwayFrom(Item item)
- {
- GeheWegVonBase(item.Baseitem);
- }
+ public int MaximumEnergy => MaximumEnergyCoreInsect;
///
- /// The ant turns in the direction opposite the specified destination and
- /// then walks straight ahead. The antâs destination remains unaltered and
- /// the walking distance can be specified.
- /// Read more
+ /// Returns the antâs current energy. The unit is hit points. If an ant has 0
+ /// hit points or fewer, it dies. This value is always less than or equal to
+ /// MaximumEnergy.
+ /// Read more
///
- /// item
- /// steps
- public void GoAwayFrom(Item item, int steps)
- {
- GeheWegVonBase(item.Baseitem, steps);
- }
+ public int CurrentEnergy => CurrentEnergyCoreInsect;
///
- /// The ant saves the specified destination and walks to it.
- /// Read more
+ /// Returns the ant's current destination. If the ant currently has no
+ /// destination, the value returned is null.
+ /// Read more
///
- /// destination
- public void GoToDestination(Item destination)
+ public Item Destination
{
- GeheZuZielBase(destination.Baseitem);
+ get
+ {
+ switch (DestinationCoreInsect)
+ {
+ case CoreSugar _:
+ return new Sugar((CoreSugar)DestinationCoreInsect);
+ case CoreFruit _:
+ return new Fruit((CoreFruit)DestinationCoreInsect);
+ case CoreAnt _:
+ return new Ant((CoreAnt)DestinationCoreInsect);
+ case CoreBug _:
+ return new Bug((CoreBug)DestinationCoreInsect);
+ case CoreMarker _:
+ return new Marker((CoreMarker)DestinationCoreInsect);
+ case CoreAnthill _:
+ return new Anthill((CoreAnthill)DestinationCoreInsect);
+ default:
+ return null;
+ }
+ }
+ set => throw new NotImplementedException();
}
///
- /// The ant saves the nearest anthill as its destination and walks towards it.
- /// Read more
+ /// Returns whether the ant is tired. The ant becomes tired as soon
+ /// as it has travelled a third of its maximum range. Once this value
+ /// has been exceeded, this property changes from false to true and
+ /// the event GettingTired() is called.
+ /// Read more
///
- public void GoToAnthill()
- {
- GeheZuBauBase();
- }
+ public bool IsTired => IsTiredCoreAnt;
+ #endregion
+
+ #region Fight
+
///
/// The ant saves the specified bug or the specified enemy ant as its
/// destination and walks toward it. When the ant arrives at its destination,
/// it begins to fight.
- /// Read more
+ /// Read more
///
/// target
public void Attack(Insect target)
{
- GreifeAnBase((CoreInsect)target.Baseitem);
+ AttackCoreInsect((CoreInsect)target.Baseitem);
}
+/////////// from here
///
- /// The ant picks up the specified food. In the case of a mound of sugar,
- /// it takes as much as possible until it reaches its maximum load (see
- /// CurrentLoad and MaximumLoad). In the case of a piece of fruit, the ant
- /// begins carrying the fruit (see CarryingFruit).
- /// Read more
+ /// The ant turns in the specified direction. The angle which it
+ /// turns around is determined automatically.
///
- /// food
- public void Take(Food food)
+ /// Direction as integer value.
+ public void TurnToDirection(int direction)
{
- if (food is Sugar)
- {
- NimmBase((CoreSugar)food.Baseitem);
- }
- else if (food is Fruit)
- {
- NimmBase((CoreFruit)food.Baseitem);
- }
+ TurnToDirectionCoreInsect(direction);
}
///
- /// The ant drops the food that it is currently carrying. Sugar is lost while
- /// apples remain where they fall and can be picked up again later. The command
- /// is not necessary when delivering food to an anthillâthat occurs automatically.
- /// Read more
+ /// The ant turns itself around the specified angle. Positive values turn
+ /// the ant to the right, negative values turn it to the left.
///
- public void Drop()
+ /// Degrees as integer value.
+ public void TurnByDegrees(int degrees)
{
- LasseNahrungFallenBase();
+ TurnByDegreesCoreInsect(degrees);
}
///
- /// The ant sprays a scent marker at the current location. The possible
- /// parameters are data contained in the marker (these can be read out of the
- /// result of Spots(Marker) via marker.Information) and how far the maker
- /// spreads out. The farther the marker spreads out, the faster it will disappear.
- /// Read more
+ /// The ant turns 180 degrees in the opposite direction. The same
+ /// as TurnByDegrees(180).
///
- /// information
- public void MakeMark(int information)
+ public void TurnAround()
{
- SprĂŒheMarkierungBase(information);
+ TurnAroundCoreInsect();
}
///
- /// The ant sprays a scent marker at the current location. The possible parameters
- /// are data contained in the marker (these can be read out of the result of
- /// Spots(Marker) via marker.Information) and how far the maker spreads out.
- /// The farther the marker spreads out, the faster it will disappear.
- /// Read more
+ /// The ant turns into the direction of the specified item.
///
- /// information
- /// range
- public void MakeMark(int information, int range)
+ /// Destination is an item.
+ public void TurnToDestination(Item destination)
{
- SprĂŒheMarkierungBase(information, range);
+ TurnToTargetCoreInsect(destination.Baseitem);
}
///
- /// This command causes the ant to display thought bubbles that can be used for
- /// troubleshooting and debugging.
- /// Read more
+ /// The ant stands still and forgets its current destination. In the next
+ /// round the result of Waiting() is called.
///
- /// message
- public void Think(string message)
+ public void Stop()
{
- DenkeCore(message);
+ StopMovementCoreInsect();
}
- #endregion
+ ///
+ /// The ant turns in the direction opposite the specified destination and
+ /// then walks straight ahead. The antâs destination remains unaltered and
+ /// the walking distance can be specified.
+ /// Read more
+ ///
+ /// item
+ public void GoAwayFrom(Item item)
+ {
+ GoAwayFromCoreInsect(item.Baseitem);
+ }
- #region Property-Wrapper
+ ///
+ /// The ant turns in the direction opposite the specified destination and
+ /// then walks straight ahead. The antâs destination remains unaltered and
+ /// the walking distance can be specified.
+ /// Read more
+ ///
+ /// item
+ /// steps
+ public void GoAwayFrom(Item item, int steps)
+ {
+ GoAwayFromCoreInsect(item.Baseitem, steps);
+ }
///
- /// Returns the antâs maximum energy. The unit is hit points.
- /// Read more
+ /// The ant drops the food that it is currently carrying. Sugar is lost while
+ /// apples remain where they fall and can be picked up again later. The command
+ /// is not necessary when delivering food to an anthillâthat occurs automatically.
+ /// Read more
///
- public int MaximumEnergy
+ public void Drop()
{
- get { return MaximaleEnergieBase; }
+ DropFood();
}
///
- /// Returns the antâs maximum speed. The unit is steps per round.
- /// Read more
+ /// This command causes the ant to display thought bubbles that can be used for
+ /// troubleshooting and debugging.
+ /// Read more
///
- public int MaximumSpeed
+ /// message
+ public void Think(string message)
{
- get { return MaximaleGeschwindigkeitBase; }
+ ThinkCore(message);
}
+ ///
+ /// Returns the antâs maximum speed. The unit is steps per round.
+ /// Read more
+ ///
+ public int MaximumSpeed => ((CoreInsect)this).MaximumSpeedCoreInsect;
+
///
/// Returns the maximum load that the ant can bear. The unit is food points.
- /// This value determines how much sugar the ant can carry at once and how
+ /// This value determines how much fruit the ant can carry at once and how
/// fast it can carry an apple without the help of other ants.
- /// Read more
+ /// Read more
///
- public int MaximumLoad
- {
- get { return MaximaleLastBase; }
- }
+ public int MaximumLoad => ((CoreInsect)this).MaximumLoadCoreInsect;
///
/// Specifies the distance in steps that the ant can travel before it dies of
/// hunger. After the ant has travelled a third of the value, the event
/// GettingTired() is called and the value of IsTired is set to "true". (See WalkedRange).
- /// Read more
+ /// Read more
///
- public int Range
- {
- get { return ReichweiteBase; }
- }
+ public int Range => ((CoreInsect)this).RangeCoreInsect;
///
/// Specifies the antâs attack value. The attack value determines how
/// many hit points the ant deducts from an enemy in each round. The
/// unit is hit points.
- /// Read more
+ /// Read more
///
- public int Strength
- {
- get { return AngriffBase; }
- }
+ public int Strength => ((CoreInsect)this).AttackStrengthCoreInsect;
///
/// Specifies the antâs visual range in steps. This range determines how
- /// far the ant must be from game elements like sugar in order for the ant
+ /// far the ant must be from game elements like fruit in order for the ant
/// to see them. The direction that the ant is facing does not play a role
/// (ants have 360 vision in this game).
- /// Read more
+ /// Read more
///
- public int Viewrange
- {
- get { return SichtweiteBase; }
- }
+ public int ViewRange => ((CoreInsect)this).ViewRangeCoreInsect;
///
/// Specifies the speed with which an ant can turn. The unit is degrees per
/// round.
- /// Read more
- ///
- public int RotationSpeed
- {
- get { return DrehgeschwindigkeitBase; }
- }
-
- ///
- /// Returns the antâs current energy. The unit is hit points. If an ant has 0
- /// hit points or fewer, it dies. This value is always less than or equal to
- /// MaximumEnergy.
- /// Read more
+ /// Read more
///
- public int CurrentEnergy
- {
- get { return AktuelleEnergieBase; }
- }
+ public int RotationSpeed => ((CoreInsect)this).RotationSpeedCoreInsect;
///
/// Returns the antâs current possible speed. The unit is steps per round. The
@@ -526,246 +527,159 @@ public int CurrentEnergy
/// load can only travel at half of their maximum speed. The property always
/// returns a value greater than 0, even if the ant is standing still. This value
/// is always less than or equal to MaximumSpeed.
- /// Read more
+ /// Read more
///
- public int CurrentSpeed
- {
- get { return AktuelleGeschwindigkeitBase; }
- }
+ public int CurrentSpeed => ((CoreInsect)this).CurrentSpeedCoreInsect;
///
/// Returns the weight of the load that the ant is currently carrying. The unit
/// is food points. This value is always smaller than or equal to MaximumLoad.
- /// Read more
+ /// Read more
///
- public int CurrentLoad
- {
- get { return AktuelleLastBase; }
- }
+ public int CurrentLoad => ((CoreInsect)this).CurrentLoadCoreInsect;
///
/// Returns the number of friendly ants from the same colony in the antâs 360° visual
/// range. The result of the calculation depends on the antâs visual range.
- /// Read more
+ /// Read more
///
- public new int FriendlyAntsInViewrange
- {
- get { return base.FriendlyAntsInViewrange; }
- }
+ public int FriendlyAntsInViewRange => ((CoreInsect)this).ColonyAntsInViewRange;
///
/// Returns the number of friendly ants from the same colony and the same caste in
/// the antâs 360° visual range. The result of this calculation depends on the antâs
/// visual range.
- /// Read more
+ /// Read more
///
- public new int FriendlyAntsFromSameCasteInViewrange
- {
- get { return base.FriendlyAntsFromSameCasteInViewrange; }
- }
+ public new int CasteAntsInViewRange => ((CoreInsect)this).CasteAntsInViewRange;
///
/// Returns the number of friendly ants from the same team in the antâs 360° visual
/// range. The result of this calculation depends on the antâs visual range.
- /// Read more
+ /// Read more
///
- public new int TeamAntsInViewrange
- {
- get { return base.TeamAntsInViewrange; }
- }
+ public new int TeamAntsInViewRange => ((CoreInsect)this).TeamAntsInViewRange;
///
/// Returns the number of enemy ants in the antâs 360° visual range. The result of
/// this calculation depends on the antâs visual range.
- /// Read more
+ /// Read more
///
- public new int ForeignAntsInViewrange
- {
- get { return base.ForeignAntsInViewrange; }
- }
+ public new int EnemyAntsInViewRange => ((CoreInsect)this).EnemyAntsInViewRange;
///
/// Returns the number of bugs in the antâs 360° visual range. The result of this
/// calculation depends on the antâs visual range.
- /// Read more
+ /// Read more
///
- public int BugsInViewrange
- {
- get { return base.BugsInViewrange; }
- }
-
+ public new int BugsInViewRange => ((CoreInsect)this).BugsInViewRange;
+
///
/// Returns the distance in steps to the nearest friendly anthill.
- /// Read more
+ /// Read more
///
- public int DistanceToAnthill
- {
- get { return EntfernungZuBauBase; }
- }
+ public int DistanceToAnthill => ((CoreInsect)this).DistanceToAnthillCoreInsect;
+
///
- /// Returns the piece of fruit the ant is currently carrying. If the ant is not
- /// carrying a piece of fruit, the value returned is null.
- /// Read more
+ /// Returns the fruit the ant is currently carrying. If the ant is not
+ /// carrying a fruit, the value returned is null.
+ /// Read more
///
public Fruit CarryingFruit
{
get
{
- if (GetragenesObstBase != null)
+ CoreAnt temp = this;
+ if (temp.CarryingFruitCoreInsect != null)
{
- return new Fruit(GetragenesObstBase);
+ return new Fruit(temp.CarryingFruitCoreInsect);
}
- else
- {
return null;
- }
}
}
+
///
/// Returns the name of the ant's caste.
- /// Read more
+ /// Read more
///
public string Caste
- {
- get { return KasteBase; }
- }
-
- ///
- /// Returns the ant's current destination. If the ant currently has no
- /// destination, the value returned is null.
- /// Read more
- ///
- public Item Destination
{
get
{
- if (ZielBase is CoreSugar)
- {
- return new Sugar((CoreSugar)ZielBase);
- }
- else if (ZielBase is CoreFruit)
- {
- return new Fruit((CoreFruit)ZielBase);
- }
- else if (ZielBase is CoreAnt)
+ try
{
- return new Ant((CoreAnt)ZielBase);
+ return CasteCoreInsect;
}
- else if (ZielBase is CoreBug)
+ catch (Exception e)
{
- return new Bug((CoreBug)ZielBase);
- }
- else if (ZielBase is CoreMarker)
- {
- return new Marker((CoreMarker)ZielBase);
- }
- else if (ZielBase is CoreAnthill)
- {
- return new Anthill((CoreAnthill)ZielBase);
- }
- else
- {
- return null;
+ Console.WriteLine(e);
+ throw;
}
}
}
- ///
- /// Returns whether the ant is tired. The ant becomes tired as soon
- /// as it has travelled a third of its maximum range. Once this value
- /// has been exceeded, this property changes from false to true and
- /// the event GettingTired() is called.
- /// Read more
- ///
- public bool IsTired
- {
- get { return IstMĂŒdeBase; }
- }
-
///
/// Returns how many steps forward the ant must go before it reaches
/// its destination. This value is reduced each round by CurrentSpeed.
- /// Read more
+ /// Read more
///
- public int DistanceToDestination
- {
- get { return RestStreckeBase; }
- }
+ public new int DistanceToDestination => ((CoreInsect)this).DistanceToDestinationCoreInsect;
///
/// Returns how many degrees the ant still has to turn before it moves
/// forward again. This value is reduced each round by RotationSpeed.
- /// Read more
+ /// Read more
///
- public int DegreesToDestination
- {
- get { return RestWinkelBase; }
- }
+ public new int ResidualAngle => ((CoreInsect)this).ResidualAngle;
///
/// Returns the direction that the ant is facing on the map.
- /// Read more
+ /// Read more
///
- public int Direction
- {
- get { return RichtungBase; }
- }
+ public int Direction => ((CoreInsect)this).GetDirectionCoreInsect();
///
/// Returns whether the ant has reached its destination or not.
- /// Read more
+ /// Read more
///
- public bool ReachedDestination
- {
- get { return AngekommenBase; }
- }
+ public bool Arrived => ((CoreInsect)this).ArrivedCoreInsect;
///
/// This property returns the total number of steps that the ant has
/// travelled since its last visit to an anthill. See Range.
- /// Read more
+ /// Read more
///
- public int WalkedRange
- {
- get { return ZurĂŒckgelegteStreckeBase; }
- }
+ public new int NumberStepsWalked => ((CoreInsect)this).NumberStepsWalked;
private RandomNumber randomNumber;
-
///
/// Generates a random number within the specified limits. If only one parameter
/// is specified, a random number will be generated between 0 and the specified
/// limit -1. If two parameters are specified, a number between will be generated
/// between the lower limit and the upper limit -1.
- ///
+ ///
///
public RandomNumber RandomNumber
{
get
{
if (randomNumber == null)
- randomNumber = new RandomNumber(RandomBase);
+ randomNumber = new RandomNumber(RandomCoreInsect);
return randomNumber;
}
}
- #endregion
-
- #region Supporting Methodes
-
///
/// Evaluates if the specified fruit needs more ants to carry it.
- /// Read more
+ /// Read more
///
/// fruit
/// more ants required
- public bool NeedsCarrier(Fruit fruit)
- {
- return ((CoreFruit)fruit.Baseitem).BrauchtNochTrÀger(colony);
- }
-
+ public bool NeedsCarrier(Fruit fruit) => ((CoreFruit)fruit.Baseitem).NeedSupport(Colony);
+
#endregion
+
}
}
\ No newline at end of file
diff --git a/SimulationCore/English/Bug.cs b/SimulationCore/English/Bug.cs
index 50c7493..becf75a 100644
--- a/SimulationCore/English/Bug.cs
+++ b/SimulationCore/English/Bug.cs
@@ -3,7 +3,7 @@
namespace AntMe.English
{
///
- /// Represents a bug
+ /// Represents a bug.
///
public sealed class Bug : Insect
{
diff --git a/SimulationCore/English/CasteAttribute.cs b/SimulationCore/English/CasteAttribute.cs
index ac6102e..fabbb8d 100644
--- a/SimulationCore/English/CasteAttribute.cs
+++ b/SimulationCore/English/CasteAttribute.cs
@@ -3,48 +3,48 @@
namespace AntMe.English
{
///
- /// Attribute to descripe the different professions of ants
+ /// Attribute to describe the different professions of ants.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class CasteAttribute : Attribute
{
///
- /// The Attackstrength
+ /// The attack strength modifier.
///
public int AttackModifier = 0;
///
- /// Hitpoints
+ /// Rotation speed modifier.
///
- public int EnergyModifier = 0;
+ public int RotationSpeedModifier = 0;
///
- /// Load
+ /// Energy or hit points modifier.
///
- public int LoadModifier = 0;
+ public int EnergyModifier = 0;
///
- /// name
+ /// Speed modifier.
///
- public string Name = string.Empty;
+ public int SpeedModifier = 0;
///
- /// range
+ /// Load modifier.
///
- public int RangeModifier = 0;
+ public int LoadModifier = 0;
///
- /// Rotationspeed
+ /// Name.
///
- public int RotationSpeedModifier = 0;
+ public string Name = string.Empty;
///
- /// Spped
+ /// Range modifier.
///
- public int SpeedModifier = 0;
+ public int RangeModifier = 0;
///
- /// viewrange
+ /// View range modifier.
///
public int ViewRangeModifier = 0;
}
diff --git a/SimulationCore/English/Colony.cs b/SimulationCore/English/Colony.cs
index d6f98d1..2faa9d4 100644
--- a/SimulationCore/English/Colony.cs
+++ b/SimulationCore/English/Colony.cs
@@ -15,7 +15,7 @@ internal Colony(CoreColony colony)
}
///
- /// Delivers the Name of that colony
+ /// Delivers the name of that colony
///
public string Name
{
diff --git a/SimulationCore/English/Coordinate.cs b/SimulationCore/English/Coordinate.cs
index c9009c5..b75800e 100644
--- a/SimulationCore/English/Coordinate.cs
+++ b/SimulationCore/English/Coordinate.cs
@@ -7,92 +7,98 @@ namespace AntMe.English
///
public static class Coordinate
{
+ #region Distance
///
- /// Gives the distance between the to given objects
+ /// Gives the distance between two given objects.
///
- /// object 1
- /// object 2
+ /// Item 1
+ /// Item 2
/// Distance between
public static int GetDistanceBetween(Item a, Item b)
{
- return CoreCoordinate.BestimmeEntfernung(a.Baseitem, b.Baseitem);
+ return CoreCoordinate.DetermineDistance(a.Baseitem, b.Baseitem);
}
-
+
///
- /// Gives the distance between the to given objects
+ /// Gives the distance between two given objects.
///
- /// object 1
- /// object 2
+ /// Ant.
+ /// Item b.
/// Distance between
public static int GetDistanceBetween(CoreAnt a, Item b)
{
- return CoreCoordinate.BestimmeEntfernung(a, b.Baseitem);
+ return CoreCoordinate.DetermineDistance(a, b.Baseitem);
}
///
- /// Gives the distance between the to given objects
+ /// Gives the distance between two given objects.
///
- /// object 1
- /// object 2
+ /// Item a.
+ /// Ant.
/// Distance between
public static int GetDistanceBetween(Item a, CoreAnt b)
{
- return CoreCoordinate.BestimmeEntfernung(a.Baseitem, b);
+ return CoreCoordinate.DetermineDistance(a.Baseitem, b);
}
///
- /// Gives the distance between the to given objects
+ /// Gives the distance between two given objects.
///
- /// object 1
- /// object 2
+ /// Ant a
+ /// Ant b
/// Distance between
public static int GetDistanceBetween(CoreAnt a, CoreAnt b)
{
- return CoreCoordinate.BestimmeEntfernung(a, b);
+ return CoreCoordinate.DetermineDistance(a, b);
}
+ #endregion
+ #region Directions
+
///
- /// Gives the direction from object 1 to object 2
+ /// Gives the direction from one object to another
///
- /// object 1
- /// object 2
- /// direction
- public static int GetDegreesBetween(Item a, Item b)
+ /// Item a.
+ /// Item b.
+ /// Direction from a to b.
+ public static int GetDirectionFromTo(Item a, Item b)
{
- return CoreCoordinate.BestimmeRichtung(a.Baseitem, b.Baseitem);
+ return CoreCoordinate.DetermineDirection(a.Baseitem, b.Baseitem);
}
///
- /// Gives the direction from object 1 to object 2
+ /// Gives the direction from one object to another
///
- /// object 1
- /// object 2
- /// direction
- public static int GetDegreesBetween(CoreAnt a, Item b)
+ /// Ant a.
+ /// Item b.
+ /// Direction from a to b.
+ public static int GetDirectionFromTo(CoreAnt a, Item b)
{
- return CoreCoordinate.BestimmeRichtung(a, b.Baseitem);
+ return CoreCoordinate.DetermineDirection(a, b.Baseitem);
}
///
- /// Gives the direction from object 1 to object 2
+ /// Gives the direction from one object to another
///
- /// object 1
- /// object 2
- /// direction
- public static int GetDegreesBetween(Item a, CoreAnt b)
+ /// Item a.
+ /// Ant b.
+ /// Direction from a to b.
+ public static int GetDirectionFromTo(Item a, CoreAnt b)
{
- return CoreCoordinate.BestimmeRichtung(a.Baseitem, b);
+ return CoreCoordinate.DetermineDirection(a.Baseitem, b);
}
///
- /// Gives the direction from object 1 to object 2
+ /// Gives the direction from one object to another
///
- /// object 1
- /// object 2
- /// direction
- public static int GetDegreesBetween(CoreAnt a, CoreAnt b)
+ /// Ant a.
+ /// Ant b.
+ /// Direction from a to b.
+ public static int GetDirectionFromTo(CoreAnt a, CoreAnt b)
{
- return CoreCoordinate.BestimmeRichtung(a, b);
+ return CoreCoordinate.DetermineDirection(a, b);
}
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/SimulationCore/English/Food.cs b/SimulationCore/English/Food.cs
index 5bddfec..838a07e 100644
--- a/SimulationCore/English/Food.cs
+++ b/SimulationCore/English/Food.cs
@@ -14,7 +14,7 @@ internal Food(CoreFood food) : base(food) { }
///
public int Amount
{
- get { return ((CoreFood)Baseitem).Menge; }
+ get { return ((CoreFood)Baseitem).Amount; }
}
///
diff --git a/SimulationCore/English/Insect.cs b/SimulationCore/English/Insect.cs
index 6786e61..996376e 100644
--- a/SimulationCore/English/Insect.cs
+++ b/SimulationCore/English/Insect.cs
@@ -3,98 +3,65 @@
namespace AntMe.English
{
///
- /// Its the interface for all lifeforms on playground
+ /// Its the interface for all lifeforms on playground.
///
public abstract class Insect : Item
{
- internal Insect(CoreInsect insekt) : base(insekt) { }
+ internal Insect(CoreInsect insect) : base(insect) { }
///
- /// Returns the unique ID of this insect
+ /// Returns the unique ID of this insect.
///
- public override int Id
- {
- get { return ((CoreInsect)Baseitem).id; }
- }
+ public override int Id => ((CoreInsect)Baseitem).Id;
///
- /// Delivers the current energy of this ant
+ /// Returns the current energy of this insect.
///
- public int CurrentEnergy
- {
- get { return ((CoreInsect)Baseitem).AktuelleEnergieBase; }
- }
+ public int CurrentEnergy => ((CoreInsect)Baseitem).CurrentEnergyCoreInsect;
///
- /// Delivers the current speed
+ /// Returns the current speed of the insect.
///
- public int CurrentSpeed
- {
- get { return ((CoreInsect)Baseitem).AktuelleGeschwindigkeitBase; }
- }
+ public int CurrentSpeed => ((CoreInsect)Baseitem).CurrentSpeedCoreInsect;
///
- /// Delivers the strength
+ /// Returns the attack strength of the insect.
///
- public int AttackStrength
- {
- get { return ((CoreInsect)Baseitem).AngriffBase; }
- }
+ public int AttackStrength => ((CoreInsect)Baseitem).AttackStrengthCoreInsect;
///
- /// Delivers the rotationspeed
+ /// Returns the rotation speed of the insect.
///
- public int RotationSpeed
- {
- get { return ((CoreInsect)Baseitem).DrehgeschwindigkeitBase; }
- }
+ public int RotationSpeed => ((CoreInsect)Baseitem).RotationSpeedCoreInsect;
///
- /// delivers the maximum energy
+ /// Returns the maximum energy of the insect.
///
- public int MaximumEnergy
- {
- get { return ((CoreInsect)Baseitem).MaximaleEnergieBase; }
- }
+ public int MaximumEnergy => ((CoreInsect)Baseitem).MaximumEnergyCoreInsect;
///
- /// delivers the maximum speed
+ /// Returns the maximum speed of the insect.
///
- public int MaximumSpeed
- {
- get { return ((CoreInsect)Baseitem).MaximaleGeschwindigkeitBase; }
- }
+ public int MaximumSpeed => ((CoreInsect)Baseitem).MaximumSpeedCoreInsect;
///
- /// delivers the viewrange
+ /// Returns the view range of the insect.
///
- public int Viewrange
- {
- get { return ((CoreInsect)Baseitem).SichtweiteBase; }
- }
+ public int ViewRange => ((CoreInsect)Baseitem).ViewRangeCoreInsect;
///
- /// delivers the degrees to rotate
+ /// Returns the residual angle of the insect.
///
- public int DegreesToTarget
- {
- get { return ((CoreInsect)Baseitem).RestWinkelBase; }
- }
+ public int ResidualAngle => ((CoreInsect)Baseitem).ResidualAngle;
///
- /// delivers the direction
+ /// Returns the direction the insect is heading to.
///
- public int Direction
- {
- get { return ((CoreInsect)Baseitem).RichtungBase; }
- }
+ public int Direction => ((CoreInsect)Baseitem).GetDirectionCoreInsect();
///
- /// delivers the distance to go
+ /// Returns the distance the insect has to cover.
///
- public int DistanceToTarget
- {
- get { return ((CoreInsect)Baseitem).RestStreckeBase; }
- }
+ public int DistanceToDestination => ((CoreInsect)Baseitem).DistanceToDestinationCoreInsect;
}
}
\ No newline at end of file
diff --git a/SimulationCore/English/Item.cs b/SimulationCore/English/Item.cs
index 308f9e2..7038a4c 100644
--- a/SimulationCore/English/Item.cs
+++ b/SimulationCore/English/Item.cs
@@ -3,12 +3,12 @@
namespace AntMe.English
{
///
- /// Baseclass for all items on playground
+ /// Baseclass for all items on playground.
///
public abstract class Item
{
///
- /// Saves the reference to the original simulation-object
+ /// Saves the reference to the original simulation object.
///
private readonly ICoordinate item;
@@ -18,7 +18,7 @@ internal Item(ICoordinate item)
}
///
- /// Delivers the base-item
+ /// Delivers the base item.
///
internal ICoordinate Baseitem
{
@@ -26,7 +26,7 @@ internal ICoordinate Baseitem
}
///
- /// Gives the unique ID of this item
+ /// Gives the unique ID of this item.
///
public abstract int Id { get; }
@@ -42,10 +42,10 @@ public override int GetHashCode()
}
///
- /// Vergleich zwischen zwei Objekten
+ /// Comparison between this item object and another.
///
- /// Vergleichsobjekt
- /// beide meinen das gleiche Element
+ /// Item object to compare with.
+ /// True if both refer to the same element. With check against null objects.
public override bool Equals(object obj)
{
if (obj == null)
@@ -61,19 +61,15 @@ public override bool Equals(object obj)
///
/// operator ==
///
- ///
- ///
- ///
+ /// a
+ /// b
+ /// True if both refer to the same element. With check against null objects.
public static bool operator ==(Item a, Item b)
{
// check, if both items are null
if ((object)a == null)
{
- if ((object)b == null)
- {
- return true;
- }
- return false;
+ return (object)b == null;
}
// check, if b is null
@@ -89,9 +85,9 @@ public override bool Equals(object obj)
///
/// operator !=
///
- ///
- ///
- ///
+ /// a
+ /// b
+ /// True if both refer to different elements. No check against null objects.
public static bool operator !=(Item a, Item b)
{
return !(a == b);
diff --git a/SimulationCore/English/KindOfDeath.cs b/SimulationCore/English/KindOfDeath.cs
index 840ea03..f0d581d 100644
--- a/SimulationCore/English/KindOfDeath.cs
+++ b/SimulationCore/English/KindOfDeath.cs
@@ -6,17 +6,17 @@
public enum KindOfDeath
{
///
- /// The ant was running out of food
+ /// The ant was running out of food.
///
Starved = 1,
///
- /// The ant was eaten up by a bug
+ /// The ant was eaten up by a bug.
///
Eaten = 2,
///
- /// The ant was killed by a foreign ant
+ /// The ant was killed by a foreign ant.
///
Beaten = 4
}
diff --git a/SimulationCore/English/Marker.cs b/SimulationCore/English/Marker.cs
index 680de92..d71c553 100644
--- a/SimulationCore/English/Marker.cs
+++ b/SimulationCore/English/Marker.cs
@@ -3,14 +3,14 @@
namespace AntMe.English
{
///
- /// Represents a marker
+ /// Represents a marker.
///
public sealed class Marker : Item
{
- internal Marker(CoreMarker markierung) : base(markierung) { }
+ internal Marker(CoreMarker marker) : base(marker) { }
///
- /// Gives the information saved in that mark
+ /// Gives the information saved in that mark.
///
public int Information
{
@@ -18,7 +18,7 @@ public int Information
}
///
- /// Delivers the unique ID of this marker
+ /// Delivers the unique ID of this marker.
///
public override int Id
{
diff --git a/SimulationCore/English/PlayerAttribute.cs b/SimulationCore/English/PlayerAttribute.cs
index 01a4143..36381bf 100644
--- a/SimulationCore/English/PlayerAttribute.cs
+++ b/SimulationCore/English/PlayerAttribute.cs
@@ -3,24 +3,41 @@
namespace AntMe.English
{
///
- /// Attribute to descripe an ant
+ /// Attribute to describe an ant.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class PlayerAttribute : Attribute
{
+
+ private string colonyName = string.Empty;
+ private string lastName = string.Empty;
+ private string firstName = string.Empty;
+
///
- /// First name of the player
+ /// Colony name (obligatory).
///
- public string FirstName = string.Empty;
+ public string ColonyName
+ {
+ get { return colonyName; }
+ set { colonyName = value; }
+ }
///
- /// Name of the colony
+ /// Last name (nice to have).
///
- public string ColonyName = string.Empty;
+ public string LastName
+ {
+ get { return lastName; }
+ set { lastName = value; }
+ }
///
- /// Last name of the player
+ /// First name of the player (nice to have).
///
- public string LastName = string.Empty;
+ public string FirstName
+ {
+ get { return firstName; }
+ set { firstName = value; }
+ }
}
}
\ No newline at end of file
diff --git a/SimulationCore/English/RandomNumber.cs b/SimulationCore/English/RandomNumber.cs
index a8516db..c7d7b6b 100644
--- a/SimulationCore/English/RandomNumber.cs
+++ b/SimulationCore/English/RandomNumber.cs
@@ -3,7 +3,7 @@
namespace AntMe.English
{
///
- /// Helper-class to generate some random numbers
+ /// Helper class to generate a random number.
///
public class RandomNumber
{
@@ -15,21 +15,21 @@ internal RandomNumber(Random random)
}
///
- /// Gives a random number between 0 and the given maximum
+ /// Gives a random number between 0 and the given maximum.
///
- /// maximum
- /// random number
+ /// Maximum.
+ /// Random number.
public int Number(int maximum)
{
return random.Next(maximum);
}
///
- /// Gives a random number between the given minimum and the given maximum
+ /// Gives a random number between the given minimum and the given maximum.
///
- /// minimum
- /// maximum
- /// random number
+ /// Minimum,
+ /// Maximum.
+ /// Random number.
public int Number(int minimum, int maximum)
{
if (minimum > maximum)
diff --git a/SimulationCore/English/Sugar.cs b/SimulationCore/English/Sugar.cs
index 97bade7..7021e02 100644
--- a/SimulationCore/English/Sugar.cs
+++ b/SimulationCore/English/Sugar.cs
@@ -3,10 +3,10 @@
namespace AntMe.English
{
///
- /// Represents a sugarhill
+ /// Represents a sugar pile
///
public sealed class Sugar : Food
{
- internal Sugar(CoreSugar zucker) : base(zucker) { }
+ internal Sugar(CoreSugar sugar) : base(sugar) { }
}
}
\ No newline at end of file
diff --git a/SimulationCore/English/UserinterfaceAccessAttribute.cs b/SimulationCore/English/UserinterfaceAccessAttribute.cs
index 94c61fc..b861946 100644
--- a/SimulationCore/English/UserinterfaceAccessAttribute.cs
+++ b/SimulationCore/English/UserinterfaceAccessAttribute.cs
@@ -3,7 +3,7 @@
namespace AntMe.English
{
///
- /// Attribute to request access to the userinterface.
+ /// Attribute to request access to the user interface.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class UserinterfaceAccessAttribute : AccessAttribute { }
diff --git a/SimulationCore/Resource.Designer.cs b/SimulationCore/Resource.Designer.cs
index 2f0cdc5..c49832f 100644
--- a/SimulationCore/Resource.Designer.cs
+++ b/SimulationCore/Resource.Designer.cs
@@ -358,7 +358,7 @@ internal static string SimulationCoreNegativeMarkerSize {
}
///
- /// Looks up a localized string similar to The PlayerAttribute of class {0} does not contain a name..
+ /// Looks up a localized string similar to the player attribute of class {0} does not contain a name..
///
internal static string SimulationCorePlayerRuleNoName {
get {
diff --git a/SimulationCore/Simulation/AiAnalysis.cs b/SimulationCore/Simulation/AiAnalysis.cs
index e6a4f6a..c73103c 100644
--- a/SimulationCore/Simulation/AiAnalysis.cs
+++ b/SimulationCore/Simulation/AiAnalysis.cs
@@ -6,7 +6,7 @@
namespace AntMe.Simulation
{
///
- /// Class, to extract PlayerInfos from given Ai-Assembly.
+ /// Class extracting player information from given AI assembly.
///
/// Tom Wendel (tom@antme.net)
public static class AiAnalysis
@@ -14,10 +14,10 @@ public static class AiAnalysis
#region public, static Methods
///
- /// Analyzes a Ai-File based on filename.
+ /// Analyse AI file for given assembly filename
///
- /// Ai-File to analyze.
- /// List of found PlayerInfos
+ /// AI file to analyse
+ /// list of from the given assembly file
///
///
///
@@ -36,11 +36,11 @@ public static List Analyse(string filename)
}
///
- /// Analyzes a Ai-File based on filename.
+ /// Analyse AI file for given assembly filename.
///
- /// Ai-File to analyze.
- /// True, if Analyser should also check player-rules.
- /// List of found PlayerInfos
+ /// AI file to analyse
+ /// true to check player rules
+ /// list of from assembly file
///
///
///
@@ -59,10 +59,10 @@ public static List Analyse(string filename, bool checkRules)
}
///
- /// Analyzes a Ai-File based on binary file-dump.
+ /// Analyse AI file based on binary file dump.
///
- /// Ai-File to analyze.
- /// List of found PlayerInfos
+ /// AI file to analyse
+ /// list of from binary file
///
///
///
@@ -74,11 +74,11 @@ public static List Analyse(byte[] file)
}
///
- /// Analyzes a Ai-File based on binary file-dump.
+ /// Analyzes a AI binary file
///
- /// Ai-File to analyze.
- /// True, if Analyser should also check player-rules.
- /// List of found PlayerInfos
+ /// AI file to analyze.
+ /// true for check player rules
+ /// list of from binary file
///
///
///
@@ -87,16 +87,15 @@ public static List Analyse(byte[] file)
public static List Analyse(byte[] file, bool checkRules)
{
PlayerAnalysis analysisHost = new PlayerAnalysis();
- // analies and return list of PlayerInfo
+ // analyses and return list of
return analysisHost.Analyse(file, checkRules);
-
}
///
/// Find a specific Player-information in given Ai-File.
///
- /// File as binary file-dump
- /// Class-name of Ai
+ /// File as binary file dump
+ /// className of AI
/// the right
///
public static PlayerInfoFiledump FindPlayerInformation(byte[] file, string className)
diff --git a/SimulationCore/Simulation/AiException.cs b/SimulationCore/Simulation/AiException.cs
index a62c95e..a854150 100644
--- a/SimulationCore/Simulation/AiException.cs
+++ b/SimulationCore/Simulation/AiException.cs
@@ -5,42 +5,40 @@
namespace AntMe.Simulation
{
///
- /// Exception for implementation-Problems in player-ai-files.
+ /// Exceptions for implementation problems in player AI files.
///
[Serializable]
public sealed class AiException : AntMeException
{
///
- /// KOnstruktor der Regelverletzung ohne weitere Angaben
+ /// Constructor of AI exception.
///
- /// Player ID
public AiException()
{
}
///
- /// Konsruktor der Regelverletzung mit der Ăbergabe einer Beschreibung zur Verletzung
+ /// Constructor of AI exception corresponding to a rule violation with handover of the description,
///
- /// Player ID
- /// Beschreibung der Regelverletzung
+ /// description of the rule violation
public AiException(string message)
: base(message)
{
}
///
- /// Konstruktor zur Regelverletung mit ĂŒbergabe einer Nachricht sowie einer verursachenden Exception
+ /// Constructor of AI exception corresponding to a rule violation with handover of the description,
+ /// and the corresponding exception
///
- /// Player ID
- /// Beschreibung zum Problem
- /// Verursachende Exception
+ /// description of the rule violation
+ /// exception
public AiException(string message, Exception innerException)
: base(message, innerException)
{
}
///
- /// Konstruktor fĂŒr die Serialisierung dieser Exception
+ /// Constructor for serialization of the AI exception,
///
///
///
diff --git a/SimulationCore/Simulation/CasteInfo.cs b/SimulationCore/Simulation/CasteInfo.cs
index 2306c77..cc3adf4 100644
--- a/SimulationCore/Simulation/CasteInfo.cs
+++ b/SimulationCore/Simulation/CasteInfo.cs
@@ -10,59 +10,59 @@ namespace AntMe.Simulation
public sealed class CasteInfo
{
///
- /// Der Angriffmodifikator der Kaste.
+ /// Attack modificator of the caste.
///
public int Attack = 0;
///
- /// Der Drehgeschwindigkeitmodifikator der Kaste.
+ /// Rotation speed modificator of the caste.
///
public int RotationSpeed = 0;
///
- /// Der Energiemodifikator der Kaste.
+ /// Energy modificator of the caste.
///
public int Energy = 0;
///
- /// Der Geschwindigkeitmodifikator der Kaste.
+ /// Movement speed modificator of the caste.
///
public int Speed = 0;
///
- /// Der Lastmodifikator der Kaste.
+ /// Load modificator of the caste.
///
public int Load = 0;
///
- /// Der Name der Kaste.
+ /// Name of the caste.
///
public string Name = string.Empty;
///
- /// Der Reichweitenmodifikator der Kaste.
+ /// Movement range modificator of the caste.
///
public int Range = 0;
///
- /// Der Sichtweitenmodifikator der Kaste.
+ /// View range modificator of the caste.
///
public int ViewRange = 0;
///
- /// Prüft, ob diese Ameisenkaste den Regeln entspricht
+ /// Checks caste against rule set.
///
/// RuleViolationException
public void Rulecheck(string aiName)
{
- // Ignoriere die Kaste, wenn er keinen Namen hat.
+ // Caste is ignored if it has no name.
if (string.IsNullOrEmpty(Name))
{
throw new RuleViolationException(
string.Format(Resource.SimulationCoreCasteRuleNoName, aiName));
}
- // Prüfen, ob der Geschindwigkeitsmodifikator im Rahmen ist
+ // Speed modificator check against allowed minimum and maximum.
if (Speed < SimulationSettings.Custom.CasteSettings.MinIndex ||
Speed > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -71,7 +71,7 @@ public void Rulecheck(string aiName)
Resource.SimulationCoreCasteRuleSpeedFailed, Name, aiName));
}
- // Prüfen, ob der Drehgeschwindigkeitsmodifikator im Rahmen ist
+ // Rotation speed modificator check against allowed minimum and maximum.
if (RotationSpeed < SimulationSettings.Custom.CasteSettings.MinIndex ||
RotationSpeed > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -82,7 +82,7 @@ public void Rulecheck(string aiName)
aiName));
}
- // Prüfen, ob der Lastmodifikator im Rahmen ist
+ // Load modificator check against allowed minimum and maximum.
if (Load < SimulationSettings.Custom.CasteSettings.MinIndex ||
Load > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -90,7 +90,7 @@ public void Rulecheck(string aiName)
string.Format(Resource.SimulationCoreCasteRuleLoadFailed, Name, aiName));
}
- // Prüfen, ob der Sichtweitemodifikator im Rahmen ist
+ // View range modificator check against allowed minimum and maximum.
if (ViewRange < SimulationSettings.Custom.CasteSettings.MinIndex ||
ViewRange > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -99,7 +99,7 @@ public void Rulecheck(string aiName)
Resource.SimulationCoreCasteRuleViewRangeFailed, Name, aiName));
}
- // Prüfen, ob der Riechweitemodifikator im Rahmen ist
+ // Range modificator check against allowed minimum and maximum.
if (Range < SimulationSettings.Custom.CasteSettings.MinIndex ||
Range > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -108,7 +108,7 @@ public void Rulecheck(string aiName)
Resource.SimulationCoreCasteRuleRangeFailed, Name, aiName));
}
- // Prüfen, ob der Energiemodifikator im Rahmen ist
+ // Energy modificator check against allowed minimum and maximum.
if (Energy < SimulationSettings.Custom.CasteSettings.MinIndex ||
Energy > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -116,7 +116,7 @@ public void Rulecheck(string aiName)
string.Format(Resource.SimulationCoreCasteRuleEnergyFailed, Name, aiName));
}
- // Prüfen, ob der Angriffsmodifikator im Rahmen ist
+ // Attack modificator check against allowed minimum and maximum.
if (Attack < SimulationSettings.Custom.CasteSettings.MinIndex ||
Attack > SimulationSettings.Custom.CasteSettings.MaxIndex)
{
@@ -124,7 +124,7 @@ public void Rulecheck(string aiName)
string.Format(Resource.SimulationCoreCasteRuleAttackFailed, Name, aiName));
}
- // Prüfen, ob die Eigenschaftssumme stimmt
+ // Check the sum of all modificator against the allowed sum.
if (Speed +
RotationSpeed +
Load +
@@ -139,9 +139,9 @@ public void Rulecheck(string aiName)
}
///
- /// Gibt an, ob es sich bei dieser Ameisenkaste um die Standard-Kaste handelt
+ /// Indicates whether this ant caste is the default caste.
///
- /// Standardwert
+ /// true for default caste
public bool IsEmpty()
{
return Name == String.Empty &&
@@ -155,10 +155,10 @@ public bool IsEmpty()
}
///
- /// Erzeugt ein CasteState-Objekt.
+ /// Creates a caste state object.
///
///
- public CasteState CreateState(int colonyId, int id)
+ public CasteState CreateCasteStateInfo(int colonyId, int id)
{
CasteState state = new CasteState(colonyId, id);
state.Name = Name;
diff --git a/SimulationCore/Simulation/CoreAnt.cs b/SimulationCore/Simulation/CoreAnt.cs
index a52f329..b832a1d 100644
--- a/SimulationCore/Simulation/CoreAnt.cs
+++ b/SimulationCore/Simulation/CoreAnt.cs
@@ -7,7 +7,7 @@ namespace AntMe.Simulation
///
- /// Abstrakte Basisklasse fĂŒr alle Ameisen.
+ /// Abstract base class for all ants.
///
/// Wolfgang Gallo (wolfgang@antme.net)
public abstract class CoreAnt : CoreInsect
@@ -16,14 +16,14 @@ internal override void Init(CoreColony colony, Random random, Dictionary
- /// Bestimmt die Kaste einer neuen Ameise.
+ /// Determine caste for a new ant.
///
- /// Die Anzahl der von jeder Klaste bereits vorhandenen Ameisen.
- /// Der Name der Kaste der Ameise.
- internal virtual string BestimmeKasteBase(Dictionary anzahl)
+ /// Ants in caste per colony.
+ /// Name of the caste for the new ant.
+ internal virtual string DetermineCasteCoreAnt(Dictionary number)
{
return "";
}
///
- /// Erzeugt ein AmeiseZustand-Objekt mit den aktuellen Daten der Ameise.
+ /// Generate ant state information
///
- internal AntState ErzeugeInfo()
+ internal AntState GenerateAntStateInfo()
{
- AntState zustand = new AntState(colony.Id, id);
+ AntState antState = new AntState(Colony.Id, Id);
- zustand.CasteId = CasteIndexBase;
- zustand.PositionX = CoordinateBase.X / SimulationEnvironment.PLAYGROUND_UNIT;
- zustand.PositionY = CoordinateBase.Y / SimulationEnvironment.PLAYGROUND_UNIT;
- zustand.ViewRange = SichtweiteBase;
- zustand.DebugMessage = debugMessage;
+ antState.CasteId = CasteIndexCoreInsect;
+ antState.PositionX = CoordinateCoreInsect.X / SimulationEnvironment.PLAYGROUND_UNIT;
+ antState.PositionY = CoordinateCoreInsect.Y / SimulationEnvironment.PLAYGROUND_UNIT;
+ antState.ViewRange = ViewRangeCoreInsect;
+ antState.DebugMessage = debugMessage;
debugMessage = string.Empty;
- zustand.Direction = CoordinateBase.Richtung;
- if (ZielBase != null)
+ antState.Direction = CoordinateCoreInsect.Direction;
+ if (DestinationCoreInsect != null)
{
- zustand.TargetPositionX = ZielBase.CoordinateBase.X / SimulationEnvironment.PLAYGROUND_UNIT;
- zustand.TargetPositionY = ZielBase.CoordinateBase.Y / SimulationEnvironment.PLAYGROUND_UNIT;
+ antState.TargetPositionX = DestinationCoreInsect.CoordinateCoreInsect.X / SimulationEnvironment.PLAYGROUND_UNIT;
+ antState.TargetPositionY = DestinationCoreInsect.CoordinateCoreInsect.Y / SimulationEnvironment.PLAYGROUND_UNIT;
}
else
{
- zustand.TargetPositionX = 0;
- zustand.TargetPositionY = 0;
+ antState.TargetPositionX = 0;
+ antState.TargetPositionY = 0;
}
- zustand.Load = AktuelleLastBase;
- if (AktuelleLastBase > 0)
- if (GetragenesObstBase != null)
- zustand.LoadType = LoadType.Fruit;
+ antState.Load = CurrentLoadCoreInsect;
+ if (CurrentLoadCoreInsect > 0)
+ if (CarryingFruitCoreInsect != null)
+ antState.LoadType = LoadType.Fruit;
else
- zustand.LoadType = LoadType.Sugar;
- zustand.Vitality = AktuelleEnergieBase;
-
- if (ZielBase is CoreAnthill)
- zustand.TargetType = TargetType.Anthill;
- else if (ZielBase is CoreSugar)
- zustand.TargetType = TargetType.Sugar;
- else if (ZielBase is CoreFruit)
- zustand.TargetType = TargetType.Fruit;
- else if (ZielBase is CoreBug)
- zustand.TargetType = TargetType.Bug;
- else if (ZielBase is CoreMarker)
- zustand.TargetType = TargetType.Marker;
- else if (ZielBase is CoreAnt)
- zustand.TargetType = TargetType.Ant;
+ antState.LoadType = LoadType.Sugar;
+ antState.Vitality = CurrentEnergyCoreInsect;
+
+ if (DestinationCoreInsect is CoreAnthill)
+ antState.TargetType = TargetType.Anthill;
+ else if (DestinationCoreInsect is CoreSugar)
+ antState.TargetType = TargetType.Sugar;
+ else if (DestinationCoreInsect is CoreFruit)
+ antState.TargetType = TargetType.Fruit;
+ else if (DestinationCoreInsect is CoreBug)
+ antState.TargetType = TargetType.Bug;
+ else if (DestinationCoreInsect is CoreMarker)
+ antState.TargetType = TargetType.Marker;
+ else if (DestinationCoreInsect is CoreAnt)
+ antState.TargetType = TargetType.Ant;
else
- zustand.TargetType = TargetType.None;
+ antState.TargetType = TargetType.None;
- return zustand;
+ return antState;
}
- #region Fortbewegung
+ #region Movement
- private bool istMĂŒde;
+ private bool isTired;
///
- /// Gibt an, ob die Ameise mĂŒde ist.
+ /// True if ant is tired.
///
- internal bool IstMĂŒdeBase
+ internal bool IsTiredCoreAnt
{
- get { return istMĂŒde; }
- set { istMĂŒde = value; }
+ get { return isTired; }
+ set { isTired = value; }
}
///
- /// Wird wiederholt aufgerufen, wenn der die Ameise nicht weiss wo sie
- /// hingehen soll.
+ /// Waiting is the standard action if the ant has no target.
///
- internal virtual void WartetBase() { }
+ internal virtual void WaitingCoreAnt() { }
///
- /// Wird einmal aufgerufen, wenn die Ameise ein Drittel ihrer maximalen
- /// Reichweite ĂŒberschritten hat.
+ /// Evoked once when the ant has reached one third of its maximum operational range.
///
- internal virtual void WirdMĂŒdeBase() { }
+ internal virtual void IsGettingTiredCoreAnt() { }
#endregion
- #region Nahrung
+ #region Food
///
- /// Wird wiederholt aufgerufen, wenn die Ameise mindestens einen
- /// Zuckerhaufen sieht.
+ /// Evoked when ant sees a sugar hill.
///
- /// Der nÀchstgelegene Zuckerhaufen.
- internal virtual void SiehtBase(CoreSugar zucker) { }
+ /// Spotted sugar hill.
+ internal virtual void SpotsCoreAnt(CoreSugar sugar) { }
///
- /// Wird wiederholt aufgerufen, wenn die Ameise mindstens ein
- /// ObststĂŒck sieht.
+ /// Evoked when ant sees a fruit.
///
- /// Das nĂ€chstgelegene ObststĂŒck.
- internal virtual void SiehtBase(CoreFruit obst) { }
+ /// Nearest fruit.
+ internal virtual void SpotsCoreAnt(CoreFruit fruit) { }
///
- /// Wird einmal aufgerufen, wenn die Ameise einen Zuckerhaufen als Ziel
- /// hat und bei diesem ankommt.
+ /// Evoked when ant arrived at sugar hill.
///
- /// Der Zuckerhaufen.
- internal virtual void ZielErreichtBase(CoreSugar zucker) { }
+ /// Sugar hill.
+ internal virtual void ArrivedAtTargetCoreAnt(CoreSugar sugar) { }
///
- /// Wird einmal aufgerufen, wenn die Ameise ein ObststĂŒck als Ziel hat und
- /// bei diesem ankommt.
+ /// Evoked when ant arrived at fruit.
///
- /// Das ObstĂŒck.
- internal virtual void ZielErreichtBase(CoreFruit obst) { }
+ /// Fruit.
+ internal virtual void ArrivedAtTargetCoreAnt(CoreFruit fruit) { }
#endregion
- #region Kommunikation
+ #region Communication
///
- /// Wird einmal aufgerufen, wenn die Ameise eine Markierung des selben
- /// Volkes riecht. Einmal gerochene Markierungen werden nicht erneut
- /// gerochen.
+ /// Evoked when ant spots marker of a friendly ant from the same colony for the first time
+ /// already seen marks will be remembered.
///
- /// Die nÀchste neue Markierung.
- internal virtual void RiechtFreundBase(CoreMarker markierung) { }
+ /// Marker of a friendly ant.
+ internal virtual void SpotsFriendCoreAnt(CoreMarker marker) { }
///
- /// Wird wiederholt aufgerufen, wenn die Ameise mindstens eine Ameise des
- /// selben Volkes sieht.
+ /// Evoked when ant spots a friendly ant from the same colony.
+ /// Will be evoked every time.
///
- /// Die nÀchstgelegene befreundete Ameise.
- internal virtual void SiehtFreundBase(CoreAnt ameise) { }
+ /// Friendly ant from same colony.
+ internal virtual void SpotsFriendCoreAnt(CoreAnt ant) { }
///
- /// Wird wiederholt aufgerufen, wenn die Ameise mindestens eine Ameise verbĂŒndeter
- /// Völker sieht.
+ /// Evoked when ant spots a friendly ant from a team colony.
+ /// Will be evoked every time.
///
- ///
- internal virtual void SiehtVerbĂŒndetenBase(CoreAnt ameise) { }
+ /// Friendly ant from a team colony.
+ internal virtual void SpotsTeamMemberCoreAnt(CoreAnt ant) { }
#endregion
- #region Kampf
+ #region Fight
///
- /// Wird wiederholt aufgerufen, wenn die Ameise mindestens eine Wanze
- /// sieht.
+ /// Evoked when ant spots a bug.
+ /// Will be evoked every time.
///
- /// Die nÀchstgelegene Wanze.
- internal virtual void SiehtFeindBase(CoreBug wanze) { }
+ /// Bug.
+ internal virtual void SpotsEnemyCoreAnt(CoreBug bug) { }
///
- /// Wird wiederholt aufgerufen, wenn die Ameise mindestens eine Ameise eines
- /// anderen Volkes sieht.
+ /// Evoked when ant spots an enemy ant.
+ /// Will be evoked every time.
///
- /// Die nÀchstgelegen feindliche Ameise.
- internal virtual void SiehtFeindBase(CoreAnt ameise) { }
+ /// Enemy ant.
+ internal virtual void SpotsEnemyCoreAnt(CoreAnt ant) { }
///
- /// Wird wiederholt aufgerufen, wenn die Ameise von einer Wanze angegriffen
- /// wird.
+ /// Evoked when ant is attacked by a bug.
+ /// Will be evoked every time.
///
- /// Die angreifende Wanze.
- internal virtual void WirdAngegriffenBase(CoreBug wanze) { }
+ /// attacking Bug.
+ internal virtual void UnderAttackCoreAnt(CoreBug bug) { }
///
- /// Wird wiederholt aufgerufen in der die Ameise von einer Ameise eines
- /// anderen Volkes Ameise angegriffen wird.
+ /// Evoked when ant is attacked by an enemy ant.
+ /// Will be evoked every time.
///
- /// Die angreifende feindliche Ameise.
- internal virtual void WirdAngegriffenBase(CoreAnt ameise) { }
+ /// Attacking ant.
+ internal virtual void IsUnderAttackCoreAnt(CoreAnt ant) { }
#endregion
- #region Sonstiges
+ #region other
///
- /// Wird einmal aufgerufen, wenn die Ameise gestorben ist.
+ /// Evoked when ant has died.
///
- /// Die Todesart der Ameise
- internal virtual void IstGestorbenBase(CoreKindOfDeath todesArt) { }
+ /// Ants kind of death.
+ internal virtual void HasDiedCoreAnt(CoreKindOfDeath kindOfDeath) { }
///
- /// Wird unabhĂ€ngig von Ă€uĂeren UmstĂ€nden in jeder Runde aufgerufen.
+ /// Tick will be evoked in every round for every ant regardless of other circumstances.
///
- internal virtual void TickBase() { }
+ internal virtual void TickCoreAnt() { }
#endregion
}
diff --git a/SimulationCore/Simulation/CoreAnthill.cs b/SimulationCore/Simulation/CoreAnthill.cs
index d03003f..fcd11a5 100644
--- a/SimulationCore/Simulation/CoreAnthill.cs
+++ b/SimulationCore/Simulation/CoreAnthill.cs
@@ -3,60 +3,60 @@
namespace AntMe.Simulation
{
///
- /// Ein Bau eines Ameisenvolkes.
+ /// An ant hill.
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal sealed class CoreAnthill : ICoordinate
{
- // Die Id des nächsten erzeugten Bau.
+ // The ID of the next generated ant hill.
private static int neueId = 0;
///
- /// Die Id die den Bau während eines Spiels eindeutig identifiziert.
+ /// The ID that uniquely identifies the ant hill during a match.
///
public readonly int Id;
private readonly int colonyId;
- private CoreCoordinate koordinate;
+ private CoreCoordinate coordinate;
///
- /// Erzeugt eine neue Instanz der Bau-Klasse.
- /// X-Koordinate
- /// Y.Koordinate
+ /// Creates a new instance of the ant hill class.
+ /// X-coordinate
+ /// Y-coordinate
/// Radius
- /// Volk ID
+ /// Colony ID
///
internal CoreAnthill(int x, int y, int radius, int colonyId)
{
this.colonyId = colonyId;
Id = neueId++;
- koordinate = new CoreCoordinate(x, y, radius);
+ coordinate = new CoreCoordinate(x, y, radius);
}
#region IKoordinate Members
///
- /// Die Position des Bau auf dem Spielfeld.
+ /// The position of the ant hill on the playground.
///
- public CoreCoordinate CoordinateBase
+ public CoreCoordinate CoordinateCoreInsect
{
- get { return koordinate; }
- internal set { koordinate = value; }
+ get { return coordinate; }
+ internal set { coordinate = value; }
}
#endregion
///
- /// Erzeugt ein BauZustand-Objekt mit den aktuellen Daten des Bau.
+ /// Creates an ant hill state object with the current its data.
///
- internal AnthillState ErzeugeInfo()
+ internal AnthillState GenerateAnthillStateInfo()
{
- AnthillState zustand = new AnthillState(colonyId, Id);
- zustand.PositionX = koordinate.X / SimulationEnvironment.PLAYGROUND_UNIT;
- zustand.PositionY = koordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT;
- zustand.Radius = koordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT;
- return zustand;
+ AnthillState state = new AnthillState(colonyId, Id);
+ state.PositionX = coordinate.X / SimulationEnvironment.PLAYGROUND_UNIT;
+ state.PositionY = coordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT;
+ state.Radius = coordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT;
+ return state;
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Simulation/CoreBug.cs b/SimulationCore/Simulation/CoreBug.cs
index f8cd0a8..ac01c37 100644
--- a/SimulationCore/Simulation/CoreBug.cs
+++ b/SimulationCore/Simulation/CoreBug.cs
@@ -5,36 +5,36 @@
namespace AntMe.Simulation
{
///
- /// Eine Wanze
+ /// Bug
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal sealed class CoreBug : CoreInsect
{
///
- /// Gibt an, ob die Wanze sich in der aktuellen Runde noch bewegen kann.
+ /// Indicates whether bug can do movement in this simulation round.
///
- internal bool KannSichNochBewegen = true;
+ internal bool CanMoveInThisRound = true;
- internal override void Init(CoreColony colony, Random random, Dictionary vorhandeneInsekten)
+ internal override void Init(CoreColony colony, Random random, Dictionary existingInsects)
{
- base.Init(colony, random, vorhandeneInsekten);
- koordinate.Radius = 4;
- AktuelleEnergieBase = colony.Energie[0];
- aktuelleGeschwindigkeitI = colony.GeschwindigkeitI[0];
- AngriffBase = colony.Angriff[0];
+ base.Init(colony, random, existingInsects);
+ Coordinate.Radius = 4;
+ CurrentEnergyCoreInsect = colony.EnergyI[0];
+ currentSpeedICoreInsect = colony.SpeedI[0];
+ AttackStrengthCoreInsect = colony.AttackI[0];
}
///
- /// Erzeugt ein BugState-Objekt mit dem aktuellen Daten der Wanzen.
+ /// Bug state object with all current data of bug is created.
///
///
- internal BugState ErzeugeInfo()
+ internal BugState GenerateInformation()
{
- BugState info = new BugState((ushort)id);
- info.PositionX = (ushort)(CoordinateBase.X / SimulationEnvironment.PLAYGROUND_UNIT);
- info.PositionY = (ushort)(CoordinateBase.Y / SimulationEnvironment.PLAYGROUND_UNIT);
- info.Direction = (ushort)CoordinateBase.Richtung;
- info.Vitality = (ushort)AktuelleEnergieBase;
+ BugState info = new BugState((ushort)Id);
+ info.PositionX = (ushort)(CoordinateCoreInsect.X / SimulationEnvironment.PLAYGROUND_UNIT);
+ info.PositionY = (ushort)(CoordinateCoreInsect.Y / SimulationEnvironment.PLAYGROUND_UNIT);
+ info.Direction = (ushort)CoordinateCoreInsect.Direction;
+ info.Vitality = (ushort)CurrentEnergyCoreInsect;
return info;
}
}
diff --git a/SimulationCore/Simulation/CoreColony.cs b/SimulationCore/Simulation/CoreColony.cs
index 877bf93..3c4a966 100644
--- a/SimulationCore/Simulation/CoreColony.cs
+++ b/SimulationCore/Simulation/CoreColony.cs
@@ -5,13 +5,13 @@
namespace AntMe.Simulation
{
///
- /// Ein Ameisenvolk. Kapselt alle Informationen die zur Laufzeit eines Spiels
- /// zu einem Spieler anfallen.
+ /// The CoreColony holds all information about the colony
+ /// during the entire simulation
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal sealed class CoreColony
{
- // Die Id des nächsten erzeugten Volkes.
+ // The nextID is the ID of the next colony created.
private static int nextId = 0;
private readonly int[] antsInCaste;
internal readonly List AntHills = new List();
@@ -20,192 +20,196 @@ internal sealed class CoreColony
internal readonly List EatenInsects = new List();
///
- /// Die Id die das Volk während eines laufenden Spiels idenzifiziert.
+ /// The ID will be the identifier for the colony in the simulation.
///
public int Id { get; private set; }
///
- /// Die Guid, die das Volk eindeutig identifiziert.
+ /// The GUID will be the identifier for the colony in the simulation.
///
public Guid Guid { get; private set; }
- internal readonly List Insects = new List();
- private readonly Type Klasse;
+ internal readonly List InsectsList = new List();
+ private readonly Type pClass;
internal Grid Marker { get; private set; }
internal readonly List NewMarker = new List();
///
- /// Der Spieler der das Verhalten des Volkes steuert.
+ /// The player is responsible for the performance of the colony.
///
internal readonly PlayerInfo Player;
- internal readonly List VerhungerteInsekten = new List();
+ internal readonly List StarvedInsects = new List();
- internal int BreiteI;
- internal int BreiteI2;
- internal int HöheI;
- internal int HöheI2;
+ internal int WidthI;
+ internal int WidthI2;
+ internal int HeightI;
+ internal int HeightI2;
internal CorePlayground Playground;
- internal PlayerStatistics Statistik = new PlayerStatistics();
- internal PlayerStatistics StatistikDurchschnitt = new PlayerStatistics();
+ internal PlayerStatistics Statistic = new PlayerStatistics();
+ internal PlayerStatistics StatisticMeanAverage = new PlayerStatistics();
///
- /// Zählt die Anzahl an Runden herunter, bis wieder eine neus Insekt erzeugt
- /// werden kann.
+ /// Delay for the creation of a new insect in number of rounds.
///
internal int insectDelay = 0;
internal int insectCountDown;
- #region Fähigkeiten
+ #region Capabilities
///
- /// Die Angriffswerte aller Kasten des Volkes.
+ /// Attack value of all castes of the colony.
///
- internal readonly int[] Angriff;
+ internal readonly int[] AttackI;
///
- /// Gitter für die verschiedenen Sichtweiten.
+ /// Grid for the different visibility ranges.
///
internal readonly Grid[] Grids;
///
- /// Die Drehgeschwindigkeiten aller Kasten des Volkes in Grad pro Runde.
+ /// Rotation speed of all castes of the colony
+ /// in degrees per round.
///
- internal readonly int[] Drehgeschwindigkeit;
+ internal readonly int[] RotationSpeedI;
///
- /// Die Lebenspunkte aller Kasten des Volkes.
+ /// Energy or health points of all castes of the colony.
///
- internal readonly int[] Energie;
+ internal readonly int[] EnergyI;
///
- /// Die Geschwindigkeiten aller Kasten des Volkes in der internen Einheit.
+ /// Movement speed of all castes of the colony
+ /// in internal unit.
///
- internal readonly int[] GeschwindigkeitI;
+ internal readonly int[] SpeedI;
///
- /// Die maximalen Lastwerte aller Kasten des Volkes.
+ /// Maximum load value of all castes of the colony.
///
- internal readonly int[] Last;
+ internal readonly int[] LoadI;
///
- /// Die Reichweiten aller Kasten des Volkes in der internen Einheit.
+ /// Movement range of all castes of the colony
+ /// in internal unit.
///
- internal readonly int[] ReichweiteI;
+ internal readonly int[] RangeI;
///
- /// Die Sichtweiten aller Kasten des Volkes in der internen Einheit.
+ /// View range of all castes of the colony
+ /// in internal unit.
///
- internal readonly int[] SichtweiteI;
+ internal readonly int[] ViewRangeI;
#endregion
///
- /// Erzeugt eine neue Instanz der Volk-Klasse. Erzeugt ein Wanzen-Volk.
+ /// Bug constructor for a new instance of the colony class.
+ /// This is not an ant class but for the bugs.
///
- /// Das Spielfeld.
- internal CoreColony(CorePlayground spielfeld)
+ /// the playground
+ internal CoreColony(CorePlayground playground)
{
- InitPlayground(spielfeld);
+ InitPlayground(playground);
- // Die Wanzen werden vom Spiel gesteuert.
+ // The bugs are not under control of a player.
Player = null;
- // Die Klasse ist in diesem Fall bereits bekannt.
- Klasse = typeof(CoreBug);
+ // The class is CoreBug.
+ pClass = typeof(CoreBug);
- //TODO: Werte überprüfen.
- GeschwindigkeitI = new int[1] { SimulationSettings.Custom.BugSpeed * SimulationEnvironment.PLAYGROUND_UNIT };
- Drehgeschwindigkeit = new int[1] { SimulationSettings.Custom.BugRotationSpeed };
- ReichweiteI = new int[1] { int.MaxValue };
- SichtweiteI = new int[1] { 0 };
- Last = new int[1] { 0 };
- Energie = new int[1] { SimulationSettings.Custom.BugEnergy };
- Angriff = new int[1] { SimulationSettings.Custom.BugAttack };
+ // TODO: check values of bugs
+ SpeedI = new int[1] { SimulationSettings.Custom.BugSpeed * SimulationEnvironment.PLAYGROUND_UNIT };
+ RotationSpeedI = new int[1] { SimulationSettings.Custom.BugRotationSpeed };
+ RangeI = new int[1] { int.MaxValue };
+ ViewRangeI = new int[1] { 0 };
+ LoadI = new int[1] { 0 };
+ EnergyI = new int[1] { SimulationSettings.Custom.BugEnergy };
+ AttackI = new int[1] { SimulationSettings.Custom.BugAttack };
Grids = new Grid[1];
Grids[0] =
Grid.Create
(
- spielfeld.Width * SimulationEnvironment.PLAYGROUND_UNIT,
- spielfeld.Height * SimulationEnvironment.PLAYGROUND_UNIT,
+ playground.Width * SimulationEnvironment.PLAYGROUND_UNIT,
+ playground.Height * SimulationEnvironment.PLAYGROUND_UNIT,
SimulationSettings.Custom.BattleRange * SimulationEnvironment.PLAYGROUND_UNIT);
antsInCaste = new int[1];
}
///
- /// Erzeugt eine neue Instanz der Volk-Klasse. Erzeugt ein Ameisen-Volk.
+ /// Constructor of a new instance of a ant colony.
///
- /// Das Spielfeld.
- /// Das Spieler zu dem das Volk gehört.
- /// Das dazugehörige Team.
- internal CoreColony(CorePlayground spielfeld, PlayerInfo spieler, CoreTeam team)
+ /// the playground
+ /// player is owner of the colony
+ /// team the player belongs to
+ internal CoreColony(CorePlayground playground, PlayerInfo player, CoreTeam team)
{
- InitPlayground(spielfeld);
+ InitPlayground(playground);
Team = team;
- Player = spieler;
- Klasse = spieler.assembly.GetType(spieler.ClassName, true, false);
+ Player = player;
+ pClass = player.assembly.GetType(player.ClassName, true, false);
- // Basisameisenkaste erstellen, falls keine Kasten definiert wurden
- if (spieler.Castes.Count == 0)
+ // If there is no definition for the caste, create a new base ant caste.
+ if (player.Castes.Count == 0)
{
- spieler.Castes.Add(new CasteInfo());
+ player.Castes.Add(new CasteInfo());
}
- GeschwindigkeitI = new int[spieler.Castes.Count];
- Drehgeschwindigkeit = new int[spieler.Castes.Count];
- Last = new int[spieler.Castes.Count];
- SichtweiteI = new int[spieler.Castes.Count];
- Grids = new Grid[spieler.Castes.Count];
- ReichweiteI = new int[spieler.Castes.Count];
- Energie = new int[spieler.Castes.Count];
- Angriff = new int[spieler.Castes.Count];
- antsInCaste = new int[spieler.Castes.Count];
+ SpeedI = new int[player.Castes.Count];
+ RotationSpeedI = new int[player.Castes.Count];
+ LoadI = new int[player.Castes.Count];
+ ViewRangeI = new int[player.Castes.Count];
+ Grids = new Grid[player.Castes.Count];
+ RangeI = new int[player.Castes.Count];
+ EnergyI = new int[player.Castes.Count];
+ AttackI = new int[player.Castes.Count];
+ antsInCaste = new int[player.Castes.Count];
int index = 0;
- foreach (CasteInfo caste in spieler.Castes)
+ foreach (CasteInfo caste in player.Castes)
{
- GeschwindigkeitI[index] = SimulationEnvironment.PLAYGROUND_UNIT;
- GeschwindigkeitI[index] *= SimulationSettings.Custom.CasteSettings[caste.Speed].Speed;
- Drehgeschwindigkeit[index] = SimulationSettings.Custom.CasteSettings[caste.RotationSpeed].RotationSpeed;
- Last[index] = SimulationSettings.Custom.CasteSettings[caste.Load].Load;
- SichtweiteI[index] = SimulationEnvironment.PLAYGROUND_UNIT;
- SichtweiteI[index] *= SimulationSettings.Custom.CasteSettings[caste.ViewRange].ViewRange;
- ReichweiteI[index] = SimulationEnvironment.PLAYGROUND_UNIT;
- ReichweiteI[index] *= SimulationSettings.Custom.CasteSettings[caste.Range].Range;
- Energie[index] = SimulationSettings.Custom.CasteSettings[caste.Energy].Energy;
- Angriff[index] = SimulationSettings.Custom.CasteSettings[caste.Attack].Attack;
+ SpeedI[index] = SimulationEnvironment.PLAYGROUND_UNIT;
+ SpeedI[index] *= SimulationSettings.Custom.CasteSettings[caste.Speed].Speed;
+ RotationSpeedI[index] = SimulationSettings.Custom.CasteSettings[caste.RotationSpeed].RotationSpeed;
+ LoadI[index] = SimulationSettings.Custom.CasteSettings[caste.Load].Load;
+ ViewRangeI[index] = SimulationEnvironment.PLAYGROUND_UNIT;
+ ViewRangeI[index] *= SimulationSettings.Custom.CasteSettings[caste.ViewRange].ViewRange;
+ RangeI[index] = SimulationEnvironment.PLAYGROUND_UNIT;
+ RangeI[index] *= SimulationSettings.Custom.CasteSettings[caste.Range].Range;
+ EnergyI[index] = SimulationSettings.Custom.CasteSettings[caste.Energy].Energy;
+ AttackI[index] = SimulationSettings.Custom.CasteSettings[caste.Attack].Attack;
Grids[index] =
Grid.Create
(
- spielfeld.Width * SimulationEnvironment.PLAYGROUND_UNIT,
- spielfeld.Height * SimulationEnvironment.PLAYGROUND_UNIT,
- SichtweiteI[index]);
+ playground.Width * SimulationEnvironment.PLAYGROUND_UNIT,
+ playground.Height * SimulationEnvironment.PLAYGROUND_UNIT,
+ ViewRangeI[index]);
index++;
}
}
- private void InitPlayground(CorePlayground spielfeld)
+ private void InitPlayground(CorePlayground playground)
{
- Playground = spielfeld;
- BreiteI = spielfeld.Width * SimulationEnvironment.PLAYGROUND_UNIT;
- HöheI = spielfeld.Height * SimulationEnvironment.PLAYGROUND_UNIT;
- BreiteI2 = BreiteI * 2;
- HöheI2 = HöheI * 2;
+ Playground = playground;
+ WidthI = playground.Width * SimulationEnvironment.PLAYGROUND_UNIT;
+ HeightI = playground.Height * SimulationEnvironment.PLAYGROUND_UNIT;
+ WidthI2 = WidthI * 2;
+ HeightI2 = HeightI * 2;
Marker =
new Grid
(
- spielfeld.Width * SimulationEnvironment.PLAYGROUND_UNIT,
- spielfeld.Height * SimulationEnvironment.PLAYGROUND_UNIT,
+ playground.Width * SimulationEnvironment.PLAYGROUND_UNIT,
+ playground.Height * SimulationEnvironment.PLAYGROUND_UNIT,
SimulationSettings.Custom.MaximumMarkerSize * SimulationEnvironment.PLAYGROUND_UNIT);
Id = nextId++;
@@ -213,17 +217,17 @@ private void InitPlayground(CorePlayground spielfeld)
}
///
- /// Die Anzahl von Insektenkasten in diesem Volk.
+ /// Colonies caste count.
///
- public int AnzahlKasten
+ public int CasteCount
{
get { return Player.Castes.Count; }
}
///
- /// Erstellt eine neues Insekt.
+ /// Constructor for a new insect instance.
///
- internal void NeuesInsekt(Random random)
+ internal void NewInsect(Random random)
{
Dictionary dictionary = null;
@@ -244,67 +248,68 @@ internal void NeuesInsekt(Random random)
// Klasse.Assembly.CreateInstance
// (Klasse.FullName, false, BindingFlags.Default, null, new object[] {this, dictionary}, null,
// new object[] {});
- CoreInsect insekt = (CoreInsect)Klasse.Assembly.CreateInstance(Klasse.FullName);
- insekt.Init(this, random, dictionary);
+ CoreInsect insect = (CoreInsect)pClass.Assembly.CreateInstance(pClass.FullName);
+ insect.Init(this, random, dictionary);
- // Merke das Insekt.
- Insects.Add(insekt);
- antsInCaste[insekt.CasteIndexBase]++;
+ // add insect to the insects list
+ InsectsList.Add(insect);
+ antsInCaste[insect.CasteIndexCoreInsect]++;
}
///
- /// Entfernt ein Insekt.
+ /// Remove insect.
///
- /// Insekt
- internal void EntferneInsekt(CoreInsect insekt)
+ /// insect
+ internal void RemoveInsect(CoreInsect insect)
{
- if (Insects.Remove(insekt))
+ if (InsectsList.Remove(insect))
{
- antsInCaste[insekt.CasteIndexBase]--;
+ antsInCaste[insect.CasteIndexCoreInsect]--;
}
}
///
- /// Erzeugt ein VolkZustand Objekt mit dem aktuellen Zustand des Volkes.
+ /// Constructor of a colony state information instance
+ /// holds the current information about the colony.
///
///
- public ColonyState ErzeugeInfo()
+ public ColonyState GenerateColonyStateInfo()
{
ColonyState info = new ColonyState(Id, Player.Guid, Player.ColonyName, Player.FirstName + " " + Player.LastName);
- info.CollectedFood = Statistik.CollectedFood;
- info.CollectedFruits = Statistik.CollectedFruits;
- info.StarvedAnts = Statistik.StarvedAnts;
- info.EatenAnts = Statistik.EatenAnts;
- info.BeatenAnts = Statistik.BeatenAnts;
- info.KilledBugs = Statistik.KilledBugs;
- info.KilledEnemies = Statistik.KilledAnts;
- info.Points = Statistik.Points;
+ info.CollectedFood = Statistic.CollectedFood;
+ info.CollectedFruits = Statistic.CollectedFruits;
+ info.StarvedAnts = Statistic.StarvedAnts;
+ info.EatenAnts = Statistic.EatenAnts;
+ info.BeatenAnts = Statistic.BeatenAnts;
+ info.KilledBugs = Statistic.KilledBugs;
+ info.KilledEnemies = Statistic.KilledAnts;
+ info.Points = Statistic.Points;
int index;
for (index = 0; index < AntHills.Count; index++)
{
- info.AnthillStates.Add(AntHills[index].ErzeugeInfo());
+ info.AnthillStates.Add(AntHills[index].GenerateAnthillStateInfo());
}
for (index = 1; index < Player.Castes.Count; index++)
{
- info.CasteStates.Add(Player.Castes[index].CreateState(Id, index));
+ info.CasteStates.Add(Player.Castes[index].CreateCasteStateInfo(Id, index));
}
- for (index = 0; index < Insects.Count; index++)
+ for (index = 0; index < InsectsList.Count; index++)
{
- info.AntStates.Add(((CoreAnt)Insects[index]).ErzeugeInfo());
+ info.AntStates.Add(((CoreAnt)InsectsList[index]).GenerateAntStateInfo());
}
- // Markierungen ist ein Bucket und die Bucket Klasse enthält keinen
- // Indexer. Daher können wir hier keine for Schleife verwenden, wie eben
- // bei den Bauten und den Ameisen. Daher benutzen wir eine foreach
- // Schleife für die wir eine extra Laufvariable benötigen.
- foreach (CoreMarker markierung in Marker)
+ // Markers are buckets and the bucket class does not contain an indexer.
+ // Therefore, we cannot use a for loop here, as we just did with the
+ // ant hills and the ants. Therefore we use a foreach loop for which
+ // we need an extra run variable.
+ foreach (CoreMarker marker in Marker)
{
- info.MarkerStates.Add(markierung.ErzeugeInfo());
+ info.MarkerStates.Add(marker.PopulateMarkerState());
}
return info;
diff --git a/SimulationCore/Simulation/CoreCoordinate.cs b/SimulationCore/Simulation/CoreCoordinate.cs
index bde7924..05c2386 100644
--- a/SimulationCore/Simulation/CoreCoordinate.cs
+++ b/SimulationCore/Simulation/CoreCoordinate.cs
@@ -5,83 +5,85 @@ namespace AntMe.Simulation
///
- /// Die Position eines Objekts auf dem Spielfeld.
+ /// Item coordinates on the playground.
///
/// Wolfgang Gallo (wolfgang@antme.net)
public struct CoreCoordinate
{
private int radius;
- private int richtung;
+ private int direction;
private int x;
private int y;
///
- /// Erzeugt eine neue Instanz der Koordinate-Struktur.
+ /// Constructor for new instances of a coordinate struct for an item.
///
- /// Der X-Wert des Elementes.
- /// Der Y-Wert des Elementes.
- /// Der Radius des Elementes.
- /// Die Richtung in die das Element blickt.
- internal CoreCoordinate(int x, int y, int radius, int richtung)
+ /// X coordinate of the item.
+ /// Y coordinate of the item.
+ /// Radius of the item.
+ /// Direction the item is oriented to.
+ internal CoreCoordinate(int x, int y, int radius, int direction)
{
this.x = x * SimulationEnvironment.PLAYGROUND_UNIT;
this.y = y * SimulationEnvironment.PLAYGROUND_UNIT;
- // In diesem Konstruktor müssen alle Werte der Struktur initialisiert
- // werden, deswegen werden Radius und Richtung hier gesetzt, obwohl sie
- // im Anschluß gleich wieder überschrieben werden.
+ // All parameters of the constructor must be initialized.
+ // That's why radius and direction are set 0 now
+ // they will be overwritten afterwards.
this.radius = 0;
- this.richtung = 0;
+ this.direction = 0;
Radius = radius * SimulationEnvironment.PLAYGROUND_UNIT;
- Richtung = richtung;
+ Direction = direction;
}
///
- /// Erzeugt eine neue Instanz der Koordinate-Struktur.
+ /// Constructor for new instances of a coordinate struct
+ /// without direction.
///
- /// Der X-Wert des Elementes.
- /// Der Y-Wert des Elementes.
- /// Der Radius des Elementes.
+ /// X coordinate of the item.
+ /// Y coordinate of the item.
+ /// Radius of the item.
internal CoreCoordinate(int x, int y, int radius)
{
this.x = x * SimulationEnvironment.PLAYGROUND_UNIT;
this.y = y * SimulationEnvironment.PLAYGROUND_UNIT;
this.radius = 0;
- richtung = 0;
+ direction = 0;
Radius = radius * SimulationEnvironment.PLAYGROUND_UNIT;
}
///
- /// Erzeugt eine neue Instanz der Koordinate-Struktur.
+ /// Constructor for new instances of a coordinate struct
+ /// without direction or radius.
///
- /// Der X-Wert des Elementes.
- /// Der Y-Wert des Elementes.
+ /// X coordinate of the item.
+ /// Y coordinate of the item.
internal CoreCoordinate(int x, int y)
{
this.x = x * SimulationEnvironment.PLAYGROUND_UNIT;
this.y = y * SimulationEnvironment.PLAYGROUND_UNIT;
radius = 0;
- richtung = 0;
+ direction = 0;
}
///
- /// Erzeugt eine neue Instanz der Koordinate-Struktur ausgehend von einer
- /// bestehenden Koordinate.
+ /// Constructor for new instances of a coordinate struct
+ /// in relation to the given coordinate.
///
- /// Die bestehende Koordinate.
- /// Der X-Wert relativ zu der Koordinate.
- /// Der Y-Wert relativ zu der Koordinate.
- internal CoreCoordinate(CoreCoordinate k, int deltaX, int deltaY)
+ /// The given coordinate.
+ /// X coordinate of the item in relation to the given coordinate.
+ /// Y coordinate of the item in relation to the given coordinate.
+ internal CoreCoordinate(CoreCoordinate c, int deltaX, int deltaY)
{
- x = k.x + deltaX;
- y = k.y + deltaY;
- radius = k.radius;
- richtung = k.richtung;
+ x = c.x + deltaX;
+ y = c.y + deltaY;
+ radius = c.radius;
+ direction = c.direction;
}
///
- /// Der X-Wert des Elements.
+ /// The x value of an item coordinate.
///
internal int X
{
@@ -90,7 +92,7 @@ internal int X
}
///
- /// Der Y-Wert des Elements.
+ /// The y value of an item coordinate.
///
internal int Y
{
@@ -99,9 +101,10 @@ internal int Y
}
///
- /// Der Radius des Elementes. Da alle Berechnungen in der Spiel (z.B.
- /// die Bestimmung von Entfernungen) auf Punkten und Kreisen basiert, wird
- /// auch der Radius eines Objektes in der IKoordinate Struktur gespeichert.
+ /// Radius of the item coordinate.
+ /// All calculations of the the simulation are based on coordinates
+ /// and associated hemispheres like the distance between items
+ /// therefor the radius is part of the coordinate struct.
///
internal int Radius
{
@@ -110,100 +113,97 @@ internal int Radius
}
///
- /// Die Richtung in die das Element blickt. Eine Richtung ist zwar kein
- /// echter Teil einer Koordinate und nicht alle Elemente die eine Koordinate
- /// haben benötigen die Richtung, aber die IKoordinate-Struktur ist der
- /// beste Platz um auch die Richtung eines Objektes zu speichern.
+ /// Direction the item is oriented to, not all items need a direction.
+ /// The items needing a direction usually have methods to turn themself
+ /// to a direction. This is not part of conventional coordinate systems
+ /// but the CoreCoordinate struct is good place to store this information.
///
- internal int Richtung
+ internal int Direction
{
- get { return richtung; }
+ get { return direction; }
set
{
- richtung = value;
- while (richtung < 0)
+ direction = value;
+ while (direction < 0)
{
- richtung += 360;
+ direction += 360;
}
- while (richtung > 359)
+ while (direction > 359)
{
- richtung -= 360;
+ direction -= 360;
}
}
}
///
- /// Bestimmt die Entfernung zweier Objekte auf dem Spielfeld in Schritten.
+ /// Determine the distance between two items on the playground in steps.
///
- /// Objekt 1.
- /// Objekt 2.
- /// Die Entfernung.
- internal static int BestimmeEntfernung(ICoordinate o1, ICoordinate o2)
+ /// Object 1.
+ /// Object 2.
+ /// Distance in steps.
+ internal static int DetermineDistance(ICoordinate o1, ICoordinate o2)
{
- return BestimmeEntfernungI(o1.CoordinateBase, o2.CoordinateBase) / SimulationEnvironment.PLAYGROUND_UNIT;
+ return DetermineDistanceI(o1.CoordinateCoreInsect, o2.CoordinateCoreInsect) / SimulationEnvironment.PLAYGROUND_UNIT;
}
///
- /// Bestimmt die Richtung von einem Objekt auf dem Spielfeld zu einem
- /// anderen.
+ /// Determine direction from one item on the playground to another.
///
- /// Das Start Objekt.
- /// Das Ziel Objekt.
- /// Die Richtung.
- internal static int BestimmeRichtung(ICoordinate o1, ICoordinate o2)
+ /// Source item.
+ /// Destination item.
+ /// Direction.
+ internal static int DetermineDirection(ICoordinate i1, ICoordinate i2)
{
- return BestimmeRichtung(o1.CoordinateBase, o2.CoordinateBase);
+ return DetermineDirection(i1.CoordinateCoreInsect, i2.CoordinateCoreInsect);
}
///
- /// Bestimmt die Entfernung zweier Koordinaten auf dem Spielfeld in der
- /// internen Einheit.
+ /// Determine the distance between two item coordinates on the playground in internal unit.
///
- /// Koordinate 1.
- /// Koordinate 2.
- /// Die Entfernung.
- internal static int BestimmeEntfernungI(CoreCoordinate k1, CoreCoordinate k2)
+ /// Coordinate 1.
+ /// Coordinate 2.
+ /// Distance between coordinates in internal unit.
+ internal static int DetermineDistanceI(CoreCoordinate c1, CoreCoordinate c2)
{
- double deltaX = k1.x - k2.x;
- double deltaY = k1.y - k2.y;
- int entfernung = (int)Math.Round(Math.Sqrt(deltaX * deltaX + deltaY * deltaY));
- entfernung = entfernung - k1.radius - k2.radius;
- if (entfernung < 0)
+ double deltaX = c1.x - c2.x;
+ double deltaY = c1.y - c2.y;
+ int distance = (int)Math.Round(Math.Sqrt(deltaX * deltaX + deltaY * deltaY));
+ distance = distance - c1.radius - c2.radius;
+ if (distance < 0)
{
return 0;
}
- return entfernung;
+ return distance;
}
///
- /// Bestimmt die Entfernung zweier Koordinaten auf dem Spielfeld in der
- /// internen Einheit ohne Beachtung der Radien.
+ /// Determine the distance between two item coordinates on the playground in internal unit
+ /// without considering the radii.
///
- /// Koordinate 1.
- /// Koordinate 2.
- /// Die Entfernung.
- internal static int BestimmeEntfernungDerMittelpunkteI(CoreCoordinate k1, CoreCoordinate k2)
+ /// Coordinate 1.
+ /// Coordinate 2.
+ /// Distance in internal unit.
+ internal static int DetermineDistanceToCenter(CoreCoordinate c1, CoreCoordinate c2)
{
- double deltaX = k1.x - k2.x;
- double deltaY = k1.y - k2.y;
+ double deltaX = c1.x - c2.x;
+ double deltaY = c1.y - c2.y;
return (int)Math.Round(Math.Sqrt(deltaX * deltaX + deltaY * deltaY));
}
///
- /// Bestimmt die Richtung von einer Koordinate auf dem Spielfeld zu einer
- /// anderen.
+ /// Determine direction from one item coordinate on the playground to another.
///
- /// Die Start Koordinate.
- /// Die Ziel Koordinate.
- /// Die Richtung.
- internal static int BestimmeRichtung(CoreCoordinate k1, CoreCoordinate k2)
+ /// Source coordinate.
+ /// Target coordinate.
+ /// Direction.
+ internal static int DetermineDirection(CoreCoordinate c1, CoreCoordinate c2)
{
- int richtung = (int)Math.Round(Math.Atan2(k2.Y - k1.Y, k2.X - k1.X) * 180d / Math.PI);
- if (richtung < 0)
+ int direction = (int)Math.Round(Math.Atan2(c2.Y - c1.Y, c2.X - c1.X) * 180d / Math.PI);
+ if (direction < 0)
{
- richtung += 360;
+ direction += 360;
}
- return richtung;
+ return direction;
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Simulation/CoreFood.cs b/SimulationCore/Simulation/CoreFood.cs
index 9b1443f..6feee02 100644
--- a/SimulationCore/Simulation/CoreFood.cs
+++ b/SimulationCore/Simulation/CoreFood.cs
@@ -3,64 +3,64 @@
namespace AntMe.Simulation
{
///
- /// Die abstrakte Basisklasse für Nahrung.
+ /// The abstract base class for food.
///
internal abstract class CoreFood : ICoordinate
{
- // Die Id der nächsten erzeugten Nahrung.
- private static int neueId = 0;
+ // The ID of the next generated food.
+ private static int newId = 0;
///
- /// Die Id die die Nahrung während eines Spiels eindeutig identifiziert.
+ /// The ID that uniquely identifies the food during a match.
///
public readonly int Id;
///
- /// Die Position der Nahrung auf dem Spielfeld.
+ /// The position of the food on the playground.
///
- protected CoreCoordinate koordinate;
+ protected CoreCoordinate coordinate;
///
- /// Die verbleibende Menge an Nahrungspunkten.
+ /// The remaining amount of food points.
///
- protected int menge;
+ protected int amount;
///
- /// Der abstrakte Nahrung-Basiskonstruktor.
+ /// The abstract food base constructor.
///
- /// Die X-Position der Koordinate auf dem Spielfeld.
- /// Die Y-Position der Koordinate auf dem Spielfeld.
- /// Die Anzahl der Nahrungspunkte.
- internal CoreFood(int x, int y, int menge)
+ /// X-coordinate on the playground.
+ /// Y-coordinate on the playground.
+ /// amount of food points.
+ internal CoreFood(int x, int y, int amount)
{
- Id = neueId++;
- koordinate = new CoreCoordinate(x, y);
- Menge = menge;
+ Id = newId++;
+ coordinate = new CoreCoordinate(x, y);
+ Amount = amount;
}
///
- /// Die verbleibende Menge an Nahrungspunkten.
+ /// The remaining amount of food points.
///
- public virtual int Menge
+ public virtual int Amount
{
- get { return menge; }
+ get { return amount; }
internal set
{
- menge = value;
- koordinate.Radius = (int)
- (Math.Round(Math.Sqrt(menge / Math.PI) * SimulationEnvironment.PLAYGROUND_UNIT));
+ amount = value;
+ coordinate.Radius = (int)
+ (Math.Round(Math.Sqrt(amount / Math.PI) * SimulationEnvironment.PLAYGROUND_UNIT));
}
}
- #region IKoordinate Members
+ #region ICoordinate members
///
- /// Die Position der Nahrung auf dem Spielfeld.
+ /// The position of the food on the playground.
///
- public CoreCoordinate CoordinateBase
+ public CoreCoordinate CoordinateCoreInsect
{
- get { return koordinate; }
- internal set { koordinate = value; }
+ get { return coordinate; }
+ internal set { coordinate = value; }
}
#endregion
diff --git a/SimulationCore/Simulation/CoreFruit.cs b/SimulationCore/Simulation/CoreFruit.cs
index f83d28e..da402f1 100644
--- a/SimulationCore/Simulation/CoreFruit.cs
+++ b/SimulationCore/Simulation/CoreFruit.cs
@@ -5,67 +5,66 @@
namespace AntMe.Simulation
{
///
- /// Represents fruit.
+ /// CoreFruit represents a fruit.
///
internal sealed class CoreFruit : CoreFood
{
///
- /// Liste der tragenden Ameisen.
+ /// List of carrying ants.
///
- internal readonly List TragendeInsekten = new List();
+ internal readonly List InsectsCarrying = new List();
///
- /// Erzeugt eine neue Instanz der Obst-Klasse.
+ /// Creates a new instance of the fruit class.
///
- /// Die X-Position des ObststĂŒcks auf dem Spielfeld.
- /// Die Y-Position des ObststĂŒcks auf dem Spielfeld.
- /// Die Anzahl an Nahrungspunkten.
- internal CoreFruit(int x, int y, int menge)
- : base(x, y, menge) { }
+ /// X-position of the fruit on the playground
+ /// Y-position of the fruit on the playground
+ /// amount of nutrition points
+ internal CoreFruit(int x, int y, int amount)
+ : base(x, y, amount) { }
///
- /// Die verbleibende Menge an Nahrungspunkten.
+ /// The remaining amount of nutrition points.
///
- public override int Menge
+ public override int Amount
{
internal set
{
- menge = value;
- koordinate.Radius = (int)(SimulationSettings.Custom.FruitRadiusMultiplier *
- Math.Sqrt(menge / Math.PI) * SimulationEnvironment.PLAYGROUND_UNIT);
+ amount = value;
+ coordinate.Radius = (int)(SimulationSettings.Custom.FruitRadiusMultiplier *
+ Math.Sqrt(amount / Math.PI) * SimulationEnvironment.PLAYGROUND_UNIT);
}
}
///
- /// Bestimmt, ob das StĂŒck Obst fĂŒr das angegebene Volk noch tragende
- /// Insekten benötigt, um die maximale Geschwindigkeit beim Tragen zu
- /// erreichen.
+ /// Determines if the piece of fruit for the specified colony still
+ /// needs carrying insects to reach the maximum speed of carrying.
///
- /// Das Volk.
- internal bool BrauchtNochTrÀger(CoreColony colony)
+ /// colony
+ internal bool NeedSupport(CoreColony colony)
{
- int last = 0;
- foreach (CoreInsect insekt in TragendeInsekten)
+ int load = 0;
+ foreach (CoreInsect insect in InsectsCarrying)
{
- if (insekt.colony == colony)
+ if (insect.Colony == colony)
{
- last += insekt.AktuelleLastBase;
+ load += insect.CurrentLoadCoreInsect;
}
}
- return last * SimulationSettings.Custom.FruitLoadMultiplier < Menge;
+ return load * SimulationSettings.Custom.FruitLoadMultiplier < Amount;
}
///
- /// Erzeugt ein ObstZustand-Objekt mit dem Daten Zustand des ObststĂŒcks.
+ /// Creates a fruit state object with the data from the state of the fruit.
///
- internal FruitState ErzeugeInfo()
+ internal FruitState GenerateInformation()
{
FruitState info = new FruitState((ushort)Id);
- info.PositionX = (ushort)(koordinate.X / SimulationEnvironment.PLAYGROUND_UNIT);
- info.PositionY = (ushort)(koordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT);
- info.Radius = (ushort)(koordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT);
- info.Amount = (ushort)menge;
- info.CarryingAnts = (byte)TragendeInsekten.Count;
+ info.PositionX = (ushort)(coordinate.X / SimulationEnvironment.PLAYGROUND_UNIT);
+ info.PositionY = (ushort)(coordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT);
+ info.Radius = (ushort)(coordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT);
+ info.Amount = (ushort)amount;
+ info.CarryingAnts = (byte)InsectsCarrying.Count;
return info;
}
}
diff --git a/SimulationCore/Simulation/CoreInsect.cs b/SimulationCore/Simulation/CoreInsect.cs
index 8773788..6b3032a 100644
--- a/SimulationCore/Simulation/CoreInsect.cs
+++ b/SimulationCore/Simulation/CoreInsect.cs
@@ -5,522 +5,502 @@
namespace AntMe.Simulation
{
///
- /// Abstrakte Basisklasse für alle Insekten.
+ /// Abstract base class of all insects.
///
/// Wolfgang Gallo (wolfgang@antme.net)
public abstract class CoreInsect : ICoordinate
{
///
- /// Die Id des nächste erzeugten Insekts.
+ /// ID for newly created insect.
///
- private static int neueId = 0;
+ private static int newId = 0;
///
- /// Speichert die Markierungen, die das Insekt schon gesehen hat. Das
- /// verhindert, daß das Insekt zwischen Markierungen im Kreis läuft.
+ /// List of all markers the insect has spotted.
+ /// Prevents insects from running in circles.
///
internal readonly List SmelledMarker = new List();
- private bool reached = false;
+ private bool arrived = false;
private int antCount = 0;
- private int casteCount = 0;
+ private int casteAntsCount = 0;
private int colonyCount = 0;
private int bugCount = 0;
private int teamCount = 0;
- private CoreFruit getragenesObst;
+ private CoreFruit carryingFruit;
+ private int distanceToDestinationI;
+ private int residualAngle = 0;
+ private ICoordinate destination = null;
+ private int numberStepsWalkedI;
///
- /// Die Id die das Insekt während eines Spiels eindeutig indentifiziert.
+ /// ID of the insect. It will identify the insect throughout the game.
///
- internal int id;
+ internal int Id;
///
- /// Die Position des Insekts auf dem Spielfeld.
+ /// Coordinates of the insect on the playground.
///
- internal CoreCoordinate koordinate;
+ internal CoreCoordinate Coordinate;
///
- /// Legt fest, ob das Insekt Befehle entgegen nimmt.
+ /// Defines whether the insect is awaiting commands.
///
- internal bool NimmBefehleEntgegen = false;
-
- private int restStreckeI;
- private int restWinkel = 0;
+ internal bool AwaitingCommands = false;
///
- /// Der Index der Kaste des Insekts in der Kasten-Struktur des Spielers.
+ /// Depending on the players caste structure, index of the caste.
///
- internal int CasteIndexBase;
+ internal int CasteIndexCoreInsect;
///
- /// Das Volk zu dem das Insekts gehört.
+ /// Colony the insect is belonging to.
///
- internal CoreColony colony;
-
- private ICoordinate ziel = null;
- private int zurückgelegteStreckeI;
+ internal CoreColony Colony;
internal CoreInsect() { }
///
- /// Die Kaste des Insekts.
+ /// Caste of the insect.
///
- internal string KasteBase
- {
- get { return colony.Player.Castes[CasteIndexBase].Name; }
- }
+ /// Caste name of the ant as string.
+ internal string CasteCoreInsect => Colony.Player.Castes[CasteIndexCoreInsect].Name;
///
- /// Die Anzahl von Wanzen in Sichtweite des Insekts.
+ /// Number of bugs in view range of the insect.
///
- internal int BugsInViewrange
+ /// Number of bugs in view range.
+ internal int BugsInViewRange
{
- get { return bugCount; }
- set { bugCount = value; }
+ get => bugCount;
+ set => bugCount = value;
}
///
- /// Die Anzahl feindlicher Ameisen in Sichtweite des Insekts.
+ /// Number of enemy ants in view range of the insect.
///
- internal int ForeignAntsInViewrange
+ /// Number of enemy ants in view range.
+ internal int EnemyAntsInViewRange
{
- get { return antCount; }
- set { antCount = value; }
+ get => antCount;
+ set => antCount = value;
}
///
- /// Die Anzahl befreundeter Ameisen in Sichtweite des Insekts.
+ /// Number of friendly ants in view range of the insect.
///
- internal int FriendlyAntsInViewrange
+ /// Number of ants from same colony in view range.
+ internal int ColonyAntsInViewRange
{
- get { return colonyCount; }
- set { colonyCount = value; }
+ get => colonyCount;
+ set => colonyCount = value;
}
///
- /// Die Anzahl befreundeter Ameisen der selben Kaste in Sichtweite des
- /// Insekts.
+ /// Number of ants from the same colony and same caste in view range of the insect.
///
- internal int FriendlyAntsFromSameCasteInViewrange
+ /// Number of friends from same colony and caste in view range.
+ internal int CasteAntsInViewRange
{
- get { return casteCount; }
- set { casteCount = value; }
+ get => casteAntsCount;
+ set => casteAntsCount = value;
}
///
- /// Anzahl Ameisen aus befreundeten Völkern in sichtweite des Insekts.
+ /// Number of team ants in view range.
///
- internal int TeamAntsInViewrange
+ /// Number of team ants in view range.
+ internal int TeamAntsInViewRange
{
- get { return teamCount; }
- set { teamCount = value; }
+ get => teamCount;
+ set => teamCount = value;
}
///
- /// Die Richtung in die das Insekt gedreht ist.
+ /// Direction the insect is turned to.
///
- internal int RichtungBase
+ /// Direction as integer.
+ internal int GetDirectionCoreInsect()
{
- get { return koordinate.Richtung; }
+ return Coordinate.Direction;
}
///
- /// Die Strecke die die Ameise zurückgelegt hat, seit sie das letzte Mal in
- /// einem Ameisenbau war.
+ /// Travelled distance of ant since last stop in anthill in internal unit.
///
- internal int ZurückgelegteStreckeBase
+ /// Travelled distance in internal unit.
+ internal int NumberStepsWalked
{
- get { return zurückgelegteStreckeI / SimulationEnvironment.PLAYGROUND_UNIT; }
+ get => numberStepsWalkedI;
+ set => numberStepsWalkedI = value;
}
///
- /// Die Strecke die die Ameise zurückgelegt hat, seit sie das letzte Mal in
- /// einem Ameisenbau war in der internen Einheit.
+ /// Distance to destination.
+ /// After walking this distance the insect will turn to target or it will be waiting for commands.
///
- internal int ZurückgelegteStreckeI
- {
- get { return zurückgelegteStreckeI; }
- set { zurückgelegteStreckeI = value; }
- }
+ internal int DistanceToDestinationCoreInsect => distanceToDestinationI / SimulationEnvironment.PLAYGROUND_UNIT;
///
- /// Die Strecke die das Insekt geradeaus gehen wird, bevor das nächste Mal
- /// Wartet() aufgerufen wird bzw. das Insekt sich zu seinem Ziel ausrichtet.
+ /// In internal units: distance to destination
+ /// After walking this distance the insect will be turn to target or it will be waiting for commands.
///
- internal int RestStreckeBase
+ internal int DistanceToDestination
{
- get { return restStreckeI / SimulationEnvironment.PLAYGROUND_UNIT; }
+ get => distanceToDestinationI;
+ set => distanceToDestinationI = value;
}
///
- /// Die Strecke die das Insekt geradeaus gehen wird, bevor das nächste
- /// Mal Wartet() aufgerufen wird bzw. das Insekt sich zu seinem Ziel
- /// ausrichtet in der internen Einheit.
+ /// Residual angle to turn before insect can go forward again.
///
- internal int RestStreckeI
+ internal int ResidualAngle
{
- get { return restStreckeI; }
- set { restStreckeI = value; }
- }
-
- ///
- /// Der Winkel um den das Insekt sich noch drehen muß, bevor es wieder
- /// geradeaus gehen kann.
- ///
- internal int RestWinkelBase
- {
- get { return restWinkel; }
+ get => residualAngle;
set
{
// TODO: Modulo?
- restWinkel = value;
- while (restWinkel > 180)
+ residualAngle = value;
+ while (residualAngle > 180)
{
- restWinkel -= 360;
+ residualAngle -= 360;
}
- while (restWinkel < -180)
+ while (residualAngle < -180)
{
- restWinkel += 360;
+ residualAngle += 360;
}
}
}
///
- /// Das Ziel auf das das Insekt zugeht.
+ /// Insects target.
///
- internal ICoordinate ZielBase
+ internal ICoordinate DestinationCoreInsect
{
- get { return ziel; }
+ get => destination;
set
{
- if (ziel != value || value == null)
- {
- ziel = value;
- restWinkel = 0;
- restStreckeI = 0;
- }
+ if (destination == value && value != null) return;
+ destination = value;
+ residualAngle = 0;
+ distanceToDestinationI = 0;
}
}
///
- /// Liefert die Entfernung in Schritten zum nächsten Ameisenbau.
+ /// Distance to ant hill in simulation steps.
///
- internal int EntfernungZuBauBase
+ internal int DistanceToAnthillCoreInsect
{
get
{
- int aktuelleEntfernung;
- int gemerkteEntfernung = int.MaxValue;
- foreach (CoreAnthill bau in colony.AntHills)
+ int currentDistance;
+ int rememberedDistance = int.MaxValue;
+ foreach (CoreAnthill anthill in Colony.AntHills)
{
- aktuelleEntfernung = CoreCoordinate.BestimmeEntfernungI(CoordinateBase, bau.CoordinateBase);
- if (aktuelleEntfernung < gemerkteEntfernung)
+ currentDistance = CoreCoordinate.DetermineDistanceI(CoordinateCoreInsect, anthill.CoordinateCoreInsect);
+ if (currentDistance < rememberedDistance)
{
- gemerkteEntfernung = aktuelleEntfernung;
+ rememberedDistance = currentDistance;
}
}
- return gemerkteEntfernung / SimulationEnvironment.PLAYGROUND_UNIT;
+ return rememberedDistance / SimulationEnvironment.PLAYGROUND_UNIT;
}
}
///
- /// Gibt das Obst zurück, das das Insekt gerade trägt.
+ /// Carried fruit.
///
- internal CoreFruit GetragenesObstBase
+ internal CoreFruit CarryingFruitCoreInsect
{
- get { return getragenesObst; }
- set { getragenesObst = value; }
+ get => carryingFruit;
+ set => carryingFruit = value;
}
///
- /// Gibt zurück on das Insekt bei seinem Ziel angekommen ist.
+ /// Defines whether the insect has reached the destination.
///
- internal bool AngekommenBase
- {
- get { return reached; }
- }
+ internal bool ArrivedCoreInsect => arrived;
- internal Random RandomBase { get; private set; }
+ internal Random RandomCoreInsect { get; private set; }
- #region IKoordinate Members
+ #region ICoordinate
///
- /// Die Position des Insekts auf dem Spielfeld.
+ /// Coordinates of insect on playground.
///
- public CoreCoordinate CoordinateBase
+ public CoreCoordinate CoordinateCoreInsect
{
- get { return koordinate; }
- internal set { koordinate = value; }
+ get => Coordinate;
+ internal set => Coordinate = value;
}
#endregion
///
- /// Der abstrakte Insekt-Basiskonstruktor.
+ /// Abstract insect constructor.
///
- /// Das Volk zu dem das neue Insekt gehört.
- /// Hier unbenutzt!
- internal virtual void Init(CoreColony colony, Random random, Dictionary vorhandeneInsekten)
+ /// New insect will be part of this colony.
+ /// Random.
+ /// In constructor unused!
+ internal virtual void Init(CoreColony colony, Random random, Dictionary insectsInColony)
{
- id = neueId;
- neueId++;
+ Id = newId;
+ newId++;
- this.colony = colony;
- this.RandomBase = random;
+ this.Colony = colony;
+ this.RandomCoreInsect = random;
- koordinate.Richtung = RandomBase.Next(0, 359);
+ Coordinate.Direction = RandomCoreInsect.Next(0, 359);
- // Zufällig auf dem Spielfeldrand platzieren.
- if (colony.AntHills.Count == 0) // Am oberen oder unteren Rand platzieren.
+ // Place randomly on the edge of the playground.
+ if (colony.AntHills.Count == 0) // Place on the upper or lower edge.
{
- if (RandomBase.Next(2) == 0)
+ if (RandomCoreInsect.Next(2) == 0)
{
- koordinate.X = RandomBase.Next(0, colony.Playground.Width);
- koordinate.X *= SimulationEnvironment.PLAYGROUND_UNIT;
- if (RandomBase.Next(2) == 0)
+ Coordinate.X = RandomCoreInsect.Next(0, colony.Playground.Width);
+ Coordinate.X *= SimulationEnvironment.PLAYGROUND_UNIT;
+ if (RandomCoreInsect.Next(2) == 0)
{
- koordinate.Y = 0;
+ Coordinate.Y = 0;
}
else
{
- koordinate.Y = colony.Playground.Height * SimulationEnvironment.PLAYGROUND_UNIT;
+ Coordinate.Y = colony.Playground.Height * SimulationEnvironment.PLAYGROUND_UNIT;
}
}
- // Am linken oder rechten Rand platzieren.
+ // Place on left or right edge.
else
{
- if (RandomBase.Next(2) == 0)
+ if (RandomCoreInsect.Next(2) == 0)
{
- koordinate.X = 0;
+ Coordinate.X = 0;
}
else
{
- koordinate.X = colony.Playground.Width * SimulationEnvironment.PLAYGROUND_UNIT;
+ Coordinate.X = colony.Playground.Width * SimulationEnvironment.PLAYGROUND_UNIT;
}
- koordinate.Y = RandomBase.Next(0, colony.Playground.Height);
- koordinate.Y *= SimulationEnvironment.PLAYGROUND_UNIT;
+ Coordinate.Y = RandomCoreInsect.Next(0, colony.Playground.Height);
+ Coordinate.Y *= SimulationEnvironment.PLAYGROUND_UNIT;
}
}
- // In einem zufälligen Bau platzieren.
+ // Place a random ant hill.
else
{
- int i = RandomBase.Next(colony.AntHills.Count);
- koordinate.X = colony.AntHills[i].CoordinateBase.X +
+ int i = RandomCoreInsect.Next(colony.AntHills.Count);
+ Coordinate.X = colony.AntHills[i].CoordinateCoreInsect.X +
SimulationEnvironment.Cosinus(
- colony.AntHills[i].CoordinateBase.Radius, koordinate.Richtung);
- koordinate.Y = colony.AntHills[i].CoordinateBase.Y +
+ colony.AntHills[i].CoordinateCoreInsect.Radius, Coordinate.Direction);
+ Coordinate.Y = colony.AntHills[i].CoordinateCoreInsect.Y +
SimulationEnvironment.Sinus(
- colony.AntHills[i].CoordinateBase.Radius, koordinate.Richtung);
+ colony.AntHills[i].CoordinateCoreInsect.Radius, Coordinate.Direction);
}
}
///
- /// Gibt an, ob weitere Insekten benötigt werden, um ein Stück Obst zu
- /// tragen.
+ /// Defines whether the insect needs support to carry fruit.
///
- /// Obst
+ /// Fruit
///
- internal bool BrauchtNochTräger(CoreFruit obst)
+ internal bool NeedSupport(CoreFruit fruit)
{
- return obst.BrauchtNochTräger(colony);
+ return fruit.NeedSupport(Colony);
}
///
- /// Dreht das Insekt um den angegebenen Winkel. Die maximale Drehung beträgt
- /// -180 Grad (nach links) bzw. 180 Grad (nach rechts). Größere Werte werden
- /// abgeschnitten.
+ /// The insect rotates for given degrees
+ /// maximum rotation is 180 degree to the right
+ /// this is 180 degrees to the left
+ /// greater values will be cut off.
///
- /// Winkel
- internal void DreheUmWinkelBase(int winkel)
+ /// angle
+ internal void TurnByDegreesCoreInsect(int angle)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- RestWinkelBase = winkel;
+ ResidualAngle = angle;
}
///
- /// Dreht das Insekt in die angegebene Richtung (Grad).
+ /// Insect rotates into a given direction.
///
- /// Richtung
- internal void DreheInRichtungBase(int richtung)
+ /// Direction
+ internal void TurnToDirectionCoreInsect(int direction)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- dreheInRichtung(richtung);
+ TurnIntoDirection(direction);
}
- private void dreheInRichtung(int richtung)
+ private void TurnIntoDirection(int direction)
{
- RestWinkelBase = richtung - koordinate.Richtung;
+ ResidualAngle = direction - Coordinate.Direction;
}
///
- /// Dreht das Insekt in die Richtung des angegebenen Ziels.
+ /// Insect rotates towards a given target.
///
- /// Ziel
- internal void DreheZuZielBase(ICoordinate ziel)
+ /// Target
+ internal void TurnToTargetCoreInsect(ICoordinate target)
{
- DreheInRichtungBase(CoreCoordinate.BestimmeRichtung(this, ziel));
+ TurnToDirectionCoreInsect(CoreCoordinate.DetermineDirection(this, target));
}
///
- /// Dreht das Insekt um 180 Grad.
+ /// The insect turns for 180 degree.
///
- internal void DreheUmBase()
+ internal void TurnAroundCoreInsect()
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- if (restWinkel > 0)
+ if (residualAngle > 0)
{
- restWinkel = 180;
+ residualAngle = 180;
}
else
{
- restWinkel = -180;
+ residualAngle = -180;
}
}
///
- /// Lässt das Insekt unbegrenzt geradeaus gehen.
+ /// Insect will go forward without delimiter.
///
- internal void GeheGeradeausBase()
+ internal void GoForwardCoreInsect()
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- restStreckeI = int.MaxValue;
+ distanceToDestinationI = int.MaxValue;
}
///
- /// Lässt das Insekt die angegebene Entfernung in Schritten geradeaus gehen.
+ /// Insect will go forward for given simulation steps.
///
- /// Die Entfernung.
- internal void GeheGeradeausBase(int entfernung)
+ /// distance in simulation steps
+ internal void GoForwardCoreInsect(int distance)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- restStreckeI = entfernung * SimulationEnvironment.PLAYGROUND_UNIT;
+ distanceToDestinationI = distance * SimulationEnvironment.PLAYGROUND_UNIT;
}
///
- /// Lässt das Insekt auf ein Ziel zugehen. Das Ziel darf sich bewegen.
- /// Wenn das Ziel eine Wanze ist, wird dieser angegriffen.
+ /// Insect goes to target. Target can be moving.
+ /// Target will be attacked if it is a bug.
///
- /// Das Ziel.
- internal void GeheZuZielBase(ICoordinate ziel)
+ /// target
+ internal void GoToTargetCoreInsect(ICoordinate target)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- ZielBase = ziel;
+ DestinationCoreInsect = target;
}
///
- /// Lässt das Insekt ein Ziel angreifen. Das Ziel darf sich bewegen.
- /// In der aktuellen Version kann das Ziel nur eine Wanze sein.
+ /// Attacks a target. Target can be moving.
+ /// Only bugs can be the target for this overload.
///
- /// Ziel
- internal void GreifeAnBase(CoreInsect ziel)
+ /// target
+ internal void AttackCoreInsect(CoreInsect target)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- ZielBase = ziel;
+ DestinationCoreInsect = target;
}
///
- /// Lässt das Insekt von der aktuellen Position aus entgegen der Richtung zu
- /// einer Quelle gehen. Wenn die Quelle ein Insekt eines anderen Volkes ist,
- /// befindet sich das Insekt auf der Flucht.
+ /// Insect goes away from source. Usually this is used
+ /// to flee from another insect
///
- /// Die Quelle.
- internal void GeheWegVonBase(ICoordinate quelle)
+ /// source
+ internal void GoAwayFromCoreInsect(ICoordinate source)
{
- DreheInRichtungBase(CoreCoordinate.BestimmeRichtung(this, quelle) + 180);
- GeheGeradeausBase();
+ TurnToDirectionCoreInsect(CoreCoordinate.DetermineDirection(this, source) + 180);
+ GoForwardCoreInsect();
}
///
- /// Lässt das Insekt von der aktuellen Position aus die angegebene
- /// Entfernung in Schritten entgegen der Richtung zu einer Quelle gehen.
- /// Wenn die Quelle ein Insekt eines anderen Volkes ist, befindet sich das
- /// Insekt auf der Flucht.
+ /// Insect goes away from source for a given distance in simulation steps.
+ /// Usually used to flee from another insect.
///
- /// Die Quelle.
- /// Die Entfernung in Schritten.
- internal void GeheWegVonBase(ICoordinate quelle, int entfernung)
+ /// source
+ /// distance in simulation steps
+ internal void GoAwayFromCoreInsect(ICoordinate source, int distance)
{
- DreheInRichtungBase(CoreCoordinate.BestimmeRichtung(this, quelle) + 180);
- GeheGeradeausBase(entfernung);
+ TurnToDirectionCoreInsect(CoreCoordinate.DetermineDirection(this, source) + 180);
+ GoForwardCoreInsect(distance);
}
///
- /// Lässt das Insekt zum nächsten Bau gehen.
+ /// Insect will go to nearest colony's anthill.
///
- internal void GeheZuBauBase()
+ internal void GoToAnthillCoreInsect()
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- int aktuelleEntfernung;
- int gemerkteEntfernung = int.MaxValue;
- CoreAnthill gemerkterBau = null;
- foreach (CoreAnthill bau in colony.AntHills)
+ int currentDistance;
+ int rememberedDistance = int.MaxValue;
+ CoreAnthill rememberedAnthill = null;
+ foreach (CoreAnthill anthill in Colony.AntHills)
{
- aktuelleEntfernung = CoreCoordinate.BestimmeEntfernungI(CoordinateBase, bau.CoordinateBase);
- if (aktuelleEntfernung < gemerkteEntfernung)
+ currentDistance = CoreCoordinate.DetermineDistanceI(CoordinateCoreInsect, anthill.CoordinateCoreInsect);
+ if (currentDistance < rememberedDistance)
{
- gemerkterBau = bau;
- gemerkteEntfernung = aktuelleEntfernung;
+ rememberedAnthill = anthill;
+ rememberedDistance = currentDistance;
}
}
- GeheZuZielBase(gemerkterBau);
+ GoToTargetCoreInsect(rememberedAnthill);
}
///
- /// Lässt das Insekt anhalten. Dabei geht sein Ziel verloren.
+ /// Insect stops and forgets target or destination.
///
- internal void BleibStehenBase()
+ internal void StopMovementCoreInsect()
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- ZielBase = null;
- restStreckeI = 0;
- restWinkel = 0;
+ DestinationCoreInsect = null;
+ distanceToDestinationI = 0;
+ residualAngle = 0;
}
///
- /// Lässt das Insekt Zucker von einem Zuckerhaufen nehmen.
+ /// Insect takes sugar from sugar pile.
///
- /// Zuckerhaufen
- internal void NimmBase(CoreSugar zucker)
+ /// sugar
+ internal void TakeCoreInsect(CoreSugar sugar)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- int entfernung = CoreCoordinate.BestimmeEntfernungI(CoordinateBase, zucker.CoordinateBase);
- if (entfernung <= SimulationEnvironment.PLAYGROUND_UNIT)
+ int distance = CoreCoordinate.DetermineDistanceI(CoordinateCoreInsect, sugar.CoordinateCoreInsect);
+ if (distance <= SimulationEnvironment.PLAYGROUND_UNIT)
{
- int menge = Math.Min(MaximaleLastBase - aktuelleLast, zucker.Menge);
- AktuelleLastBase += menge;
- zucker.Menge -= menge;
+ int amount = Math.Min(MaximumLoadCoreInsect - currentLoad, sugar.Amount);
+ CurrentLoadCoreInsect += amount;
+ sugar.Amount -= amount;
}
else
{
@@ -529,367 +509,336 @@ internal void NimmBase(CoreSugar zucker)
}
///
- /// Lässt das Insekt ein Obststück nehmen.
+ /// Insect takes fruit.
///
- /// Das Obststück.
- internal void NimmBase(CoreFruit obst)
+ /// fruit
+ internal void TakeCoreInsect(CoreFruit fruit)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- if (GetragenesObstBase == obst)
+ if (CarryingFruitCoreInsect == fruit)
{
return;
}
- if (GetragenesObstBase != null)
+ if (CarryingFruitCoreInsect != null)
{
- LasseNahrungFallenBase();
+ DropFood();
}
- int entfernung = CoreCoordinate.BestimmeEntfernungI(CoordinateBase, obst.CoordinateBase);
- if (entfernung <= SimulationEnvironment.PLAYGROUND_UNIT)
+ int distance = CoreCoordinate.DetermineDistanceI(CoordinateCoreInsect, fruit.CoordinateCoreInsect);
+ if (distance <= SimulationEnvironment.PLAYGROUND_UNIT)
{
- BleibStehenBase();
- GetragenesObstBase = obst;
- obst.TragendeInsekten.Add(this);
- AktuelleLastBase = colony.Last[CasteIndexBase];
+ StopMovementCoreInsect();
+ CarryingFruitCoreInsect = fruit;
+ fruit.InsectsCarrying.Add(this);
+ CurrentLoadCoreInsect = Colony.LoadI[CasteIndexCoreInsect];
}
}
///
- /// Lässt das Insekt die aktuell getragene Nahrung fallen. Das Ziel des
- /// Insekts geht dabei verloren.
+ /// Insect drops food and forgets target.
///
- internal void LasseNahrungFallenBase()
+ internal void DropFood()
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- AktuelleLastBase = 0;
- ZielBase = null;
- if (GetragenesObstBase != null)
+ CurrentLoadCoreInsect = 0;
+ DestinationCoreInsect = null;
+ if (CarryingFruitCoreInsect != null)
{
- GetragenesObstBase.TragendeInsekten.Remove(this);
- GetragenesObstBase = null;
+ CarryingFruitCoreInsect.InsectsCarrying.Remove(this);
+ CarryingFruitCoreInsect = null;
}
}
///
- /// Lässt die Ameise eine Markierung sprühen. Die Markierung enthält die
- /// angegebene Information und breitet sich um die angegebene Anzahl an
- /// Schritten weiter aus. Je weiter sich eine Markierung ausbreitet, desto
- /// kürzer bleibt sie aktiv.
+ /// Insect sets marker with given information and size.
+ /// Bigger marks have shorter lifespan.
///
- /// Die Information.
- /// Die Ausbreitung in Schritten.
- internal void SprüheMarkierungBase(int information, int ausbreitung)
+ /// information
+ /// size in simulation steps
+ internal void MakeMarkerCoreInsects(int information, int size)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- // Check for unsupported markersize
- if (ausbreitung < 0)
+ // Check for unsupported marker size.
+ if (size < 0)
{
- throw new AiException(string.Format("{0}: {1}", colony.Player.Guid,
+ throw new AiException(string.Format("{0}: {1}", Colony.Player.Guid,
Resource.SimulationCoreNegativeMarkerSize));
}
- CoreMarker markierung = new CoreMarker(koordinate, ausbreitung, colony.Id);
- markierung.Information = information;
- colony.NewMarker.Add(markierung);
- SmelledMarker.Add(markierung);
+ CoreMarker marker = new CoreMarker(Coordinate, size, Colony.Id);
+ marker.Information = information;
+ Colony.NewMarker.Add(marker);
+ SmelledMarker.Add(marker);
}
///
- /// Lässt die Ameise eine Markierung sprühen. Die Markierung enthält die
- /// angegebene Information und breitet sich nicht aus. So hat die Markierung
- /// die maximale Lebensdauer.
+ /// Lets the ant spray a mark. The marker contains the information and does not spread.
+ /// Thus, the mark has the maximum life span.
///
- /// Die Information.
- internal void SprüheMarkierungBase(int information)
+ /// The information.
+ internal void MakeMarkerCoreInsects(int information)
{
- if (!NimmBefehleEntgegen)
+ if (!AwaitingCommands)
{
return;
}
- SprüheMarkierungBase(information, 0);
+ MakeMarkerCoreInsects(information, 0);
}
///
- /// Berechnet die Bewegung des Insekts.
+ /// Calculates the movement of the insect.
///
- internal void Bewegen()
+ internal void Move()
{
- reached = false;
+ arrived = false;
- // Insekt dreht sich.
- if (restWinkel != 0)
+ // Insect rotates.
+ if (residualAngle != 0)
{
- // Zielwinkel wird erreicht.
- if (Math.Abs(restWinkel) < colony.Drehgeschwindigkeit[CasteIndexBase])
+ // Target angle is reached.
+ if (Math.Abs(residualAngle) < Colony.RotationSpeedI[CasteIndexCoreInsect])
{
- koordinate.Richtung += restWinkel;
- restWinkel = 0;
+ Coordinate.Direction += residualAngle;
+ residualAngle = 0;
}
- // Insekt dreht sich nach rechts.
- else if (restWinkel >= colony.Drehgeschwindigkeit[CasteIndexBase])
+ // Insect rotates to the right.
+ else if (residualAngle >= Colony.RotationSpeedI[CasteIndexCoreInsect])
{
- koordinate.Richtung += colony.Drehgeschwindigkeit[CasteIndexBase];
- RestWinkelBase -= colony.Drehgeschwindigkeit[CasteIndexBase];
+ Coordinate.Direction += Colony.RotationSpeedI[CasteIndexCoreInsect];
+ ResidualAngle -= Colony.RotationSpeedI[CasteIndexCoreInsect];
}
- // Insekt dreht sich nach links.
- else if (restWinkel <= -colony.Drehgeschwindigkeit[CasteIndexBase])
+ // Insect rotates to the left.
+ else if (residualAngle <= -Colony.RotationSpeedI[CasteIndexCoreInsect])
{
- koordinate.Richtung -= colony.Drehgeschwindigkeit[CasteIndexBase];
- RestWinkelBase += colony.Drehgeschwindigkeit[CasteIndexBase];
+ Coordinate.Direction -= Colony.RotationSpeedI[CasteIndexCoreInsect];
+ ResidualAngle += Colony.RotationSpeedI[CasteIndexCoreInsect];
}
}
- // Insekt geht.
- else if (restStreckeI > 0)
+ // Insect walks.
+ else if (distanceToDestinationI > 0)
{
- if (GetragenesObstBase == null)
+ if (CarryingFruitCoreInsect == null)
{
- int strecke = Math.Min(restStreckeI, aktuelleGeschwindigkeitI);
+ int distance = Math.Min(distanceToDestinationI, currentSpeedICoreInsect);
- restStreckeI -= strecke;
- zurückgelegteStreckeI += strecke;
- koordinate.X += SimulationEnvironment.Cos[strecke, koordinate.Richtung];
- koordinate.Y += SimulationEnvironment.Sin[strecke, koordinate.Richtung];
+ distanceToDestinationI -= distance;
+ numberStepsWalkedI += distance;
+ Coordinate.X += SimulationEnvironment.Cos[distance, Coordinate.Direction];
+ Coordinate.Y += SimulationEnvironment.Sin[distance, Coordinate.Direction];
}
}
- // Insekt geht auf Ziel zu.
- else if (ziel != null)
+ // Insect walks towards target.
+ else if (destination != null)
{
- int entfernungI;
+ int distanceI;
- if (ZielBase is CoreMarker)
+ if (DestinationCoreInsect is CoreMarker)
{
- entfernungI = CoreCoordinate.BestimmeEntfernungDerMittelpunkteI(koordinate, ziel.CoordinateBase);
+ distanceI = CoreCoordinate.DetermineDistanceToCenter(Coordinate, destination.CoordinateCoreInsect);
}
else
{
- entfernungI = CoreCoordinate.BestimmeEntfernungI(koordinate, ziel.CoordinateBase);
+ distanceI = CoreCoordinate.DetermineDistanceI(Coordinate, destination.CoordinateCoreInsect);
}
- reached = entfernungI <= SimulationEnvironment.PLAYGROUND_UNIT;
- if (!reached)
+ arrived = distanceI <= SimulationEnvironment.PLAYGROUND_UNIT;
+ if (!arrived)
{
- int richtung = CoreCoordinate.BestimmeRichtung(koordinate, ziel.CoordinateBase);
+ int direction = CoreCoordinate.DetermineDirection(Coordinate, destination.CoordinateCoreInsect);
- // Ziel ist in Sichtweite oder Insekt trägt Obst.
- if (entfernungI < colony.SichtweiteI[CasteIndexBase] || getragenesObst != null)
+ // Target is in sight or insect is carrying fruit.
+ if (distanceI < Colony.ViewRangeI[CasteIndexCoreInsect] || carryingFruit != null)
{
- restStreckeI = entfernungI;
+ distanceToDestinationI = distanceI;
}
- // Ansonsten Richtung verfälschen.
+ // Otherwise randomize direction.
else
{
- richtung += RandomBase.Next(-18, 18);
- restStreckeI = colony.SichtweiteI[CasteIndexBase];
+ direction += RandomCoreInsect.Next(-18, 18);
+ distanceToDestinationI = Colony.ViewRangeI[CasteIndexCoreInsect];
}
- dreheInRichtung(richtung);
+ TurnIntoDirection(direction);
}
}
- // Koordinaten links begrenzen.
- if (koordinate.X < 0)
+ // Limit coordinates to the left.
+ if (Coordinate.X < 0)
{
- koordinate.X = -koordinate.X;
- if (koordinate.Richtung > 90 && koordinate.Richtung <= 180)
+ Coordinate.X = -Coordinate.X;
+ if (Coordinate.Direction > 90 && Coordinate.Direction <= 180)
{
- koordinate.Richtung = 180 - koordinate.Richtung;
+ Coordinate.Direction = 180 - Coordinate.Direction;
}
- else if (koordinate.Richtung > 180 && koordinate.Richtung < 270)
+ else if (Coordinate.Direction > 180 && Coordinate.Direction < 270)
{
- koordinate.Richtung = 540 - koordinate.Richtung;
+ Coordinate.Direction = 540 - Coordinate.Direction;
}
}
- // Koordinaten rechts begrenzen.
- else if (koordinate.X > colony.BreiteI)
+ // Limit coordinates to the right.
+ else if (Coordinate.X > Colony.WidthI)
{
- koordinate.X = colony.BreiteI2 - koordinate.X;
- if (koordinate.Richtung >= 0 && koordinate.Richtung < 90)
+ Coordinate.X = Colony.WidthI2 - Coordinate.X;
+ if (Coordinate.Direction >= 0 && Coordinate.Direction < 90)
{
- koordinate.Richtung = 180 - koordinate.Richtung;
+ Coordinate.Direction = 180 - Coordinate.Direction;
}
- else if (koordinate.Richtung > 270 && koordinate.Richtung < 360)
+ else if (Coordinate.Direction > 270 && Coordinate.Direction < 360)
{
- koordinate.Richtung = 540 - koordinate.Richtung;
+ Coordinate.Direction = 540 - Coordinate.Direction;
}
}
- // Koordinaten oben begrenzen.
- if (koordinate.Y < 0)
+ // Limit coordinates at the top.
+ if (Coordinate.Y < 0)
{
- koordinate.Y = -koordinate.Y;
- if (koordinate.Richtung > 180 && koordinate.Richtung < 360)
+ Coordinate.Y = -Coordinate.Y;
+ if (Coordinate.Direction > 180 && Coordinate.Direction < 360)
{
- koordinate.Richtung = 360 - koordinate.Richtung;
+ Coordinate.Direction = 360 - Coordinate.Direction;
}
}
- // Koordinaten unten begrenzen.
- else if (koordinate.Y > colony.HöheI)
+ // Limit coordinates below.
+ else if (Coordinate.Y > Colony.HeightI)
{
- koordinate.Y = colony.HöheI2 - koordinate.Y;
- if (koordinate.Richtung > 0 && koordinate.Richtung < 180)
+ Coordinate.Y = Colony.HeightI2 - Coordinate.Y;
+ if (Coordinate.Direction > 0 && Coordinate.Direction < 180)
{
- koordinate.Richtung = 360 - koordinate.Richtung;
+ Coordinate.Direction = 360 - Coordinate.Direction;
}
}
}
- #region Geschwindigkeit
+ #region Speed
///
- /// Die aktuelle Geschwindigkeit des Insekts in der internen Einheit.
+ /// The current speed of the insect in the internal unit.
///
- internal int aktuelleGeschwindigkeitI;
+ internal int currentSpeedICoreInsect;
///
- /// Die aktuelle Geschwindigkeit des Insekts in Schritten. Wenn das Insekt
- /// seine maximale Last trägt, halbiert sich seine Geschwindigkeit.
+ /// The current speed of the insect in steps. When the insect
+ /// carries its maximum load, its speed is halved.
///
- internal int AktuelleGeschwindigkeitBase
- {
- get { return aktuelleGeschwindigkeitI / SimulationEnvironment.PLAYGROUND_UNIT; }
- }
+ internal int CurrentSpeedCoreInsect => currentSpeedICoreInsect / SimulationEnvironment.PLAYGROUND_UNIT;
///
- /// Die maximale Geschwindigkeit des Insekts.
+ /// The insect's maximum speed.
///
- internal int MaximaleGeschwindigkeitBase
- {
- get { return colony.GeschwindigkeitI[CasteIndexBase] / SimulationEnvironment.PLAYGROUND_UNIT; }
- }
+ internal int MaximumSpeedCoreInsect => Colony.SpeedI[CasteIndexCoreInsect] / SimulationEnvironment.PLAYGROUND_UNIT;
#endregion
- #region Drehgeschwindigkeit
+ #region RotationSpeed
///
- /// Die Drehgeschwindigkeit des Insekts in Grad pro Runde.
+ /// The insect's rotation speed in degrees per round.
///
- internal int DrehgeschwindigkeitBase
- {
- get { return colony.Drehgeschwindigkeit[CasteIndexBase]; }
- }
+ internal int RotationSpeedCoreInsect => Colony.RotationSpeedI[CasteIndexCoreInsect];
#endregion
- #region Last
+ #region Load
- private int aktuelleLast = 0;
+ private int currentLoad = 0;
///
- /// Die Last die die Ameise gerade trägt.
+ /// The insect's current load
///
- internal int AktuelleLastBase
+ internal int CurrentLoadCoreInsect
{
- get { return aktuelleLast; }
+ get => currentLoad;
set
{
- aktuelleLast = value >= 0 ? value : 0;
- aktuelleGeschwindigkeitI = colony.GeschwindigkeitI[CasteIndexBase];
- aktuelleGeschwindigkeitI -= aktuelleGeschwindigkeitI * aktuelleLast / colony.Last[CasteIndexBase] / 2;
+ currentLoad = value >= 0 ? value : 0;
+ currentSpeedICoreInsect = Colony.SpeedI[CasteIndexCoreInsect];
+ currentSpeedICoreInsect -= currentSpeedICoreInsect * currentLoad / Colony.LoadI[CasteIndexCoreInsect] / 2;
}
}
///
- /// Die maximale Last die das Insekt tragen kann.
+ /// The insect's maximum load.
///
- internal int MaximaleLastBase
- {
- get { return colony.Last[CasteIndexBase]; }
- }
+ internal int MaximumLoadCoreInsect => Colony.LoadI[CasteIndexCoreInsect];
#endregion
- #region Sichtweite
+ #region ViewRange
///
- /// Die Sichtweite des Insekts in Schritten.
+ /// Insect's view range in simulation steps.
///
- internal int SichtweiteBase
- {
- get { return colony.SichtweiteI[CasteIndexBase] / SimulationEnvironment.PLAYGROUND_UNIT; }
- }
+ internal int ViewRangeCoreInsect => Colony.ViewRangeI[CasteIndexCoreInsect] / SimulationEnvironment.PLAYGROUND_UNIT;
///
- /// Die Sichtweite des Insekts in der internen Einheit.
+ /// The insect's view range in internal unit.
///
- internal int SichtweiteI
- {
- get { return colony.SichtweiteI[CasteIndexBase]; }
- }
+ internal int ViewRangeI => Colony.ViewRangeI[CasteIndexCoreInsect];
#endregion
- #region Reichweite
+ #region Range
///
- /// Die Reichweite des Insekts in Schritten.
+ /// The insect's range in simulation steps.
///
- internal int ReichweiteBase
- {
- get { return colony.ReichweiteI[CasteIndexBase] / SimulationEnvironment.PLAYGROUND_UNIT; }
- }
+ internal int RangeCoreInsect => Colony.RangeI[CasteIndexCoreInsect] / SimulationEnvironment.PLAYGROUND_UNIT;
///
- /// Die Reichweite des Insekts in der internen Einheit.
+ /// The insect's range in internal units.
///
- internal int ReichweiteI
- {
- get { return colony.ReichweiteI[CasteIndexBase]; }
- }
+ internal int RangeI => Colony.RangeI[CasteIndexCoreInsect];
#endregion
- #region Energie
+ #region Energy
- private int aktuelleEnergie;
+ private int currentEnergy;
///
- /// Die verbleibende Energie des Insekts.
+ /// The insect's current energy.
///
- internal int AktuelleEnergieBase
+ internal int CurrentEnergyCoreInsect
{
- get { return aktuelleEnergie; }
- set { aktuelleEnergie = value >= 0 ? value : 0; }
+ get => currentEnergy;
+ set => currentEnergy = value >= 0 ? value : 0;
}
///
- /// Die maximale Energie des Insetks.
+ /// The insect's maximum energy.
///
- internal int MaximaleEnergieBase
- {
- get { return colony.Energie[CasteIndexBase]; }
- }
+ internal int MaximumEnergyCoreInsect => Colony.EnergyI[CasteIndexCoreInsect];
#endregion
- #region Angriff
+ #region Attack
- private int angriff;
+ private int attackStrength;
///
- /// Die Angriffstärke des Insekts. Wenn das Insekt Last trägt ist die
- /// Angriffstärke gleich Null.
+ /// The insect's attack strength.
+ /// Zero, if insect carries load.
///
- internal int AngriffBase
+ internal int AttackStrengthCoreInsect
{
- get { return aktuelleLast == 0 ? angriff : 0; }
- set { angriff = value >= 0 ? value : 0; }
+ get => currentLoad == 0 ? attackStrength : 0;
+ set => attackStrength = value >= 0 ? value : 0;
}
#endregion
@@ -898,7 +847,7 @@ internal int AngriffBase
internal string debugMessage;
- internal void DenkeCore(string message)
+ internal void ThinkCore(string message)
{
debugMessage = message.Length > 100 ? message.Substring(0, 100) : message;
}
diff --git a/SimulationCore/Simulation/CoreKindOfDeath.cs b/SimulationCore/Simulation/CoreKindOfDeath.cs
index 645a1f3..a30f9ef 100644
--- a/SimulationCore/Simulation/CoreKindOfDeath.cs
+++ b/SimulationCore/Simulation/CoreKindOfDeath.cs
@@ -1,23 +1,23 @@
ï»żnamespace AntMe.Simulation
{
///
- /// Beschreibt wie eine Ameise gestorben ist.
+ /// Kind of death.
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal enum CoreKindOfDeath
{
///
- /// Gibt an, dass die Ameise verhungert ist.
+ /// Ant has starved.
///
Starved = 1,
///
- /// Gibt an, dass die Ameise von einer Wanze gefressen wurde.
+ /// Bug has eaten the ant.
///
Eaten = 2,
///
- /// Gibt an, dass die Ameise von einer feindlichen Ameise besiegt wurde.
+ /// Enemy ant has beaten the ant.
///
Beaten = 4
}
diff --git a/SimulationCore/Simulation/CoreMarker.cs b/SimulationCore/Simulation/CoreMarker.cs
index 5714557..6d66c01 100644
--- a/SimulationCore/Simulation/CoreMarker.cs
+++ b/SimulationCore/Simulation/CoreMarker.cs
@@ -4,67 +4,66 @@
namespace AntMe.Simulation
{
///
- /// Eine Duft-Markierung die eine Information enthält.
+ /// Scent marking with information, age and size.
///
/// Wolfgang Gallo (wolfgang@antme.net)
internal sealed class CoreMarker : ICoordinate
{
- // Die Id der nächsten erzeugten Markierung.
- private static int neueId = 0;
+ // ID of the next marker.
+ private static int newId = 0;
///
- /// Die Id die die Markierung während eines Spiels eindeutig identifiziert.
+ /// ID will uniquely identify the marker throughout the simulation.
///
public readonly int Id;
private readonly int colonyId;
- private CoreCoordinate koordinate;
+ private CoreCoordinate coordinate;
private int age = 0;
private int totalAge;
- private int endgröße;
+ private int finalSize;
private int information;
///
- /// Erzeugt eine neue Instanz der Markierung-Klasse.
+ /// Constructor for new instances of marker
///
- /// Die Koordinate der Markierung.
- /// Die Ausbreitung der Markierung in Schritten.
- ///
- /// ID des Volkes
- internal CoreMarker(CoreCoordinate koordinate, int endgröße, int colonyId)
+ /// Coordinate.
+ /// Size of marker in steps.
+ /// ID of colony.
+ internal CoreMarker(CoreCoordinate coordinate, int finalSize, int colonyId)
{
this.colonyId = colonyId;
- Id = neueId++;
- this.koordinate = koordinate;
+ Id = newId++;
+ this.coordinate = coordinate;
- // Volumen der kleinsten Markierung (rł * PI/2) ermitteln (Halbkugel)
+ // Calculation of the smallest possible marker volume (r-square * PI/2) for the semi-sphere.
double baseVolume = Math.Pow(SimulationSettings.Custom.MarkerSizeMinimum, 3) * (Math.PI / 2);
- // Korrektur für größere Markierungen
+ // Correction for bigger markers.
baseVolume *= 10f;
- // Gesamtvolumen über die volle Zeit ermitteln
+ // Total volume for the hole lifespan.
double totalvolume = baseVolume * SimulationSettings.Custom.MarkerMaximumAge;
- // Maximale Markergröße ermitteln
+ // Calculation of maximum size.
int maxSize = (int)Math.Pow(4 * ((totalvolume - baseVolume) / Math.PI), 1f / 3f);
- // Gewünschte Zielgröße limitieren (Min Markersize, Max MaxSize)
- this.endgröße = Math.Max(SimulationSettings.Custom.MarkerSizeMinimum, Math.Min(maxSize, endgröße));
+ // Final size limited by minimum and maximum marker size.
+ this.finalSize = Math.Max(SimulationSettings.Custom.MarkerSizeMinimum, Math.Min(maxSize, finalSize));
- // Volumen für die größte Markierung ermitteln
- int diffRadius = this.endgröße - SimulationSettings.Custom.MarkerSizeMinimum;
+ // Calculation of volume for the maximum marker //// MarkerSizeMinimum?
+ int diffRadius = this.finalSize - SimulationSettings.Custom.MarkerSizeMinimum;
double diffVolume = Math.Pow(diffRadius, 3) * (Math.PI / 4);
- // Lebenszeit bei angestrebter Gesamtgröße ermitteln
+ // Total age of the marker depends on the size.
totalAge = (int)Math.Floor(totalvolume / (baseVolume + diffVolume));
- Aktualisieren();
+ Update();
}
///
- /// Die gespeicherte Information.
+ /// Marker information.
///
public int Information
{
@@ -73,10 +72,10 @@ public int Information
}
///
- /// Bestimmt ob die Markierung ihre maximales Alter noch nicht überschritten
- /// hat.
+ /// False means that the marker is not active any more
+ /// because the age is greater than the total age.
///
- public bool IstAktiv
+ public bool IsActive
{
get { return age <= totalAge; }
}
@@ -84,41 +83,40 @@ public bool IstAktiv
#region IKoordinate Members
///
- /// Die Position der Markierung auf dem Spielfeld.
+ /// The position of the marker on the playground.
///
- public CoreCoordinate CoordinateBase
+ public CoreCoordinate CoordinateCoreInsect
{
- get { return koordinate; }
+ get { return coordinate; }
}
#endregion
///
- /// Erhöht das Alter der Markierung und passt ihren Radius an.
+ /// Update age and radius of the marker.
///
- internal void Aktualisieren()
+ internal void Update()
{
age++;
- if (IstAktiv)
+ if (IsActive)
{
- koordinate.Radius = (int)(
+ coordinate.Radius = (int)(
SimulationSettings.Custom.MarkerSizeMinimum +
- endgröße * ((float)age / totalAge)) * SimulationEnvironment.PLAYGROUND_UNIT;
+ finalSize * ((float)age / totalAge)) * SimulationEnvironment.PLAYGROUND_UNIT;
}
}
///
- /// Erzeugt ein MarkierungZustand-Objekt mit den aktuellen Daten der
- /// Markierung.
+ /// Populate marker state with current information of the marker.
///
- internal MarkerState ErzeugeInfo()
+ internal MarkerState PopulateMarkerState()
{
- MarkerState info = new MarkerState(colonyId, Id);
- info.PositionX = koordinate.X / SimulationEnvironment.PLAYGROUND_UNIT;
- info.PositionY = koordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT;
- info.Radius = koordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT;
- info.Direction = koordinate.Richtung;
- return info;
+ MarkerState markerStateInformation = new MarkerState(colonyId, Id);
+ markerStateInformation.PositionX = coordinate.X / SimulationEnvironment.PLAYGROUND_UNIT;
+ markerStateInformation.PositionY = coordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT;
+ markerStateInformation.Radius = coordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT;
+ markerStateInformation.Direction = coordinate.Direction;
+ return markerStateInformation;
}
}
}
\ No newline at end of file
diff --git a/SimulationCore/Simulation/CorePlayground.cs b/SimulationCore/Simulation/CorePlayground.cs
index ef5d15e..bca0018 100644
--- a/SimulationCore/Simulation/CorePlayground.cs
+++ b/SimulationCore/Simulation/CorePlayground.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Threading;
-// (Debuging) Referenzen HinzufĂŒgen bei Bedarf!!!
+// (Debuging) Referenzen Hinzufuegen bei Bedarf!!!
//using System.Windows.Forms;
//using System.Drawing;
@@ -10,7 +10,7 @@
namespace AntMe.Simulation
{
///
- /// Das Spielfeld.
+ /// Playground
///
/// Patrick Kirsch
internal class CorePlayground
@@ -26,7 +26,7 @@ internal class CorePlayground
private List AntHillPoints;
private Cell[,] CellArray;
- private List CellSpawnList;
+ private List SpawnCellsList;
private float AntHillRandomdisplacement = SimulationSettings.Default.AntHillRandomDisplacement;
private int SpawnCellSize = SimulationSettings.Default.SpawnCellSize;
@@ -35,25 +35,25 @@ internal class CorePlayground
private float DecreasValue = SimulationSettings.Default.DecreaseValue;
private float RegenerationValue = SimulationSettings.Default.RegenerationValue;
- // öffentliche Bestandslisten(werden von AuĂen gelesen)
- public readonly List Fruits;
- public readonly List SugarHills;
- public readonly List AntHills;
+ // public readable lists
+ public readonly List FruitsList;
+ public readonly List SugarHillsList;
+ public readonly List AntHillsList;
///
- /// Erzeugt eine neue Instanz der Spielfeld-Klasse.
+ /// Constructor for instance of playground
///
- /// Die Breite in Schritten.
- /// Die Höhe in Schritten.
- /// Initialwert fĂŒr Zufallsgenerator
- /// /// Anzahl der Spieler
+ /// width in steps
+ /// height in steps
+ /// initial value for the random generator
+ /// number of players
public CorePlayground(int width, int height, Random random, int playercount)
{
Width = width;
Height = height;
mapRandom = random;
- //ĂberprĂŒfen der Settings
+ // checking the simulation settings
if (SimulationSettings.Custom.AntHillRandomDisplacement != 0)
AntHillRandomdisplacement = SimulationSettings.Custom.AntHillRandomDisplacement;
if (SimulationSettings.Custom.SpawnCellSize != 0)
@@ -68,14 +68,14 @@ public CorePlayground(int width, int height, Random random, int playercount)
RegenerationValue = SimulationSettings.Custom.RegenerationValue;
- // Initialisierungen
- Fruits = new List();
- SugarHills = new List();
- AntHills = new List();
+ // Initialization of public readable lists
+ FruitsList = new List();
+ SugarHillsList = new List();
+ AntHillsList = new List();
AntHillPoints = new List(playercount);
CellArray = new Cell[(int)Math.Ceiling((float)width / SpawnCellSize), (int)Math.Ceiling((float)height / SpawnCellSize)];
- CellSpawnList = new List(CellArray.Length);
+ SpawnCellsList = new List(CellArray.Length);
//if (ENABLE_DEBUGINGSCREEN)
//{
@@ -85,10 +85,10 @@ public CorePlayground(int width, int height, Random random, int playercount)
#region AntHills
- // Bestimme zufÀlligen Rotationswinkel des Spawnkreises.
+ // the start angle gives the direction which the first newly spawned ant is heading to
int startAngle = mapRandom.Next(359);
- // FĂŒlle die Liste der möglichen Spawnpositionen.
+ // the list of possible anthill spawning positions is populated
if (playercount == 1)
{
AntHillPoints.Add(new Vector2D(width / 2, height / 2));
@@ -108,7 +108,7 @@ public CorePlayground(int width, int height, Random random, int playercount)
}
}
- // Weise jedem Spieler eine zufÀllige Spawnposition zu.
+ // spawning positions for the players
for (int i = 0; i < playercount; i++)
{
int attempts = 5;
@@ -137,14 +137,14 @@ public CorePlayground(int width, int height, Random random, int playercount)
{
for (int cellY = 0; cellY < CellArray.GetLength(1); cellY++)
{
- // Position der oberen linken Ecke der Zelle
+ // position of the spawn cells upper left corner
Vector2D pos = new Vector2D(cellX * SpawnCellSize, cellY * SpawnCellSize);
- // Ermittlung ob die Zelle kleiner sein muss, da sie an den Rand stöĂt.
+ // spawn cells touching the edge must shrink
int cellWidth = Math.Min(SpawnCellSize, Width - (cellX * SpawnCellSize));
int cellHeight = Math.Min(SpawnCellSize, Height - (cellY * SpawnCellSize));
- // Neue Zelle erstellen.
+ // instantiate a new cell
Cell cell = CellArray[cellX, cellY] = new Cell(pos, cellWidth, cellHeight);
@@ -152,30 +152,31 @@ public CorePlayground(int width, int height, Random random, int playercount)
foreach (Vector2D antHill in AntHillPoints)
{
- // Ermittlung des Zell Mittelpunktes.
+ // determination of the cells center point
int cellMidX = (cellX * SpawnCellSize) + (cellWidth / 2);
int cellMidY = (cellY * SpawnCellSize) + (cellHeight / 2);
- // Berechnung des Abstands Vectors.
+ // calculation of the displacement vector
Vector2D displacmentVector = antHill - cell.Position;
int distance = (int)displacmentVector.GetLenght();
if (distance < RestrictedZoneRadius)
{
- // Zelle liegt im gesperrten Bereich mindestens eines AmeisenhĂŒgels.
+ // spawn cell is within one or several anthills restricted zone
totalDisplacementVector = new Vector2D(0, 0);
break;
}
- // Abstands Vectoren aufaddieren.
+ // adding up displacement vectors
totalDisplacementVector += displacmentVector;
}
- // Durchschnittswert berechnen.
+ //
+ // calculation of the average displacement vector value
totalDisplacementVector /= playercount;
- // Sperrung der Zelle, wenn sie in einem gesperrten Bereich sich befindet, oder sich am Spielfeldrand befindet.
+ // restrict cell if within restricted zone or at the edge of the playground
if (totalDisplacementVector.GetLenght() < RestrictedZoneRadius || totalDisplacementVector.GetLenght() > FarZoneRadius || cellX == 0 || cellY == 0 || cellX == CellArray.GetLength(0) - 1 || cellY == CellArray.GetLength(1) - 1)
{
cell.restricted = true;
@@ -183,11 +184,11 @@ public CorePlayground(int width, int height, Random random, int playercount)
}
}
- // Nicht gesperrte Zellen der Spawnliste hinzufĂŒgen.
+ // unrestricted cells populate the spawn list
foreach (Cell cell in CellArray)
{
if (!cell.restricted)
- CellSpawnList.Add(cell);
+ SpawnCellsList.Add(cell);
}
#endregion
@@ -195,24 +196,24 @@ public CorePlayground(int width, int height, Random random, int playercount)
}
///
- /// WÀhlt eine zufÀllige Zelle mit einem hohen Spawnwert aus.
+ /// find a random cell with high spawn value
///
- /// Gibt die Zielzelle zurĂŒck.
- private Cell findeRohstoffZelle()
+ /// returns the cell for the food to spawn
+ private Cell FindFoodSpawnCell()
{
- RegeneriereZellen();
+ RegenerateCellValues();
- // Sortiere die Spawnliste absteigend nach dem SpawnValue.
- CellSpawnList.Sort((x, y) => y.SpawnValue.CompareTo(x.SpawnValue));
+ // sort cell spawn list descending by spawn value
+ SpawnCellsList.Sort((x, y) => y.SpawnValue.CompareTo(x.SpawnValue));
- // WÀhlt alle Zellen aus, welche dem "höchseten Spawnvalue - 0,1" entsprechen.
- List RandomList = CellSpawnList.FindAll((x) => (x.SpawnValue >= CellSpawnList[0].SpawnValue - 0.1f) && (x.SpawnedFood == null));
+ // RandomList of cells with hightest and those -0.1 below highest spawn value
+ List| RandomList = SpawnCellsList.FindAll((x) => (x.SpawnValue >= SpawnCellsList[0].SpawnValue - 0.1f) && (x.SpawnedFood == null));
- //Sollte es keine Zelle geben, wir auch in schon bespawnten Zellen gesucht
+ // if RandomList is empty and there are no unused spawn cells, the list will be populated with already used spawn cells
if (RandomList.Count == 0)
- RandomList = CellSpawnList.FindAll((x) => (x.SpawnValue >= CellSpawnList[0].SpawnValue - 0.1f));
+ RandomList = SpawnCellsList.FindAll((x) => (x.SpawnValue >= SpawnCellsList[0].SpawnValue - 0.1f));
- // WÀhlt ein zufÀllige Zelle aus dem Bereich aus.
+ // random cell for spawning is chosen
Cell cell = RandomList[mapRandom.Next(RandomList.Count - 1)];
cell.SpawnValue = 0f;
@@ -223,9 +224,9 @@ private Cell findeRohstoffZelle()
}
///
- /// Regeneriert alle Zellen auf dem Spielfeld
+ /// regenerate values of all cells on the playground
///
- private void RegeneriereZellen()
+ private void RegenerateCellValues()
{
foreach (Cell cell in CellArray)
{
@@ -239,9 +240,9 @@ private void RegeneriereZellen()
}
///
- /// Verringert den Spawnwert aller Zellen, auf basis der entfernugn von der AusgangsZelle.
+ /// Reduce the spawn value of all cells depending an the distance from the start cell
///
- /// Die Ausgangszelle.
+ /// start cell
private void DecreaseCells(Cell startCell)
{
foreach (Cell cell in CellArray)
@@ -249,9 +250,9 @@ private void DecreaseCells(Cell startCell)
if (cell == startCell)
continue;
- float abstand = (cell.Position - startCell.Position).GetLenght() / SpawnCellSize;
+ float distance = (cell.Position - startCell.Position).GetLenght() / SpawnCellSize;
- cell.SpawnValue -= DecreasValue / (abstand * abstand);
+ cell.SpawnValue -= DecreasValue / (distance * distance);
if (cell.SpawnValue < 0)
cell.SpawnValue = 0;
@@ -261,72 +262,74 @@ private void DecreaseCells(Cell startCell)
///
- /// Erzeugt einen neuen Zuckerhaufen.
+ /// Create a new sugar hill
///
- public void NeuerZucker()
+ public void NewSugar()
{
- Cell cell = findeRohstoffZelle();
- int wert = mapRandom.Next(SimulationSettings.Custom.SugarAmountMinimum, SimulationSettings.Custom.SugarAmountMaximum);
- Vector2D punkt = cell.Position + new Vector2D(mapRandom.Next(cell.Width), mapRandom.Next(cell.Height));
- CoreSugar zucker = new CoreSugar(punkt.X, punkt.Y, wert);
- SugarHills.Add(zucker);
- cell.SpawnedFood = zucker;
+ Cell cell = FindFoodSpawnCell();
+ int value = mapRandom.Next(SimulationSettings.Default.SugarAmountMinimum, SimulationSettings.Default.SugarAmountMaximum);
+ Vector2D vector2D = cell.Position + new Vector2D(mapRandom.Next(cell.Width), mapRandom.Next(cell.Height));
+ CoreSugar sugar = new CoreSugar(vector2D.X, vector2D.Y, value);
+ SugarHillsList.Add(sugar);
+ cell.SpawnedFood = sugar;
}
///
- /// Entfernt Zucker und gibt die Zelle wieder frei.
+ /// Remove sugar and spawn cell from the corresponding lists
+ /// SugarHillList and SpawnCellsList
///
- /// Den zu entfernenden Zucker
- public void EntferneZucker(CoreSugar sugar)
+ /// sugar to be removed
+ public void RemoveSugar(CoreSugar sugar)
{
- SugarHills.Remove(sugar);
- Cell cell = CellSpawnList.Find((x) => x.SpawnedFood == sugar);
+ SugarHillsList.Remove(sugar);
+ Cell cell = SpawnCellsList.Find((x) => x.SpawnedFood == sugar);
cell.SpawnedFood = null;
}
///
- /// Erzeugt ein neues ObsttĂŒck.
+ /// create a new piece of fruit
///
- public void NeuesObst()
+ public void NewFruit()
{
- Cell cell = findeRohstoffZelle();
- int wert = mapRandom.Next(SimulationSettings.Custom.FruitAmountMinimum, SimulationSettings.Custom.FruitAmountMaximum);
- Vector2D punkt = cell.Position + new Vector2D(mapRandom.Next(cell.Width), mapRandom.Next(cell.Height));
- CoreFruit Fruit = new CoreFruit(punkt.X, punkt.Y, wert);
- Fruits.Add(Fruit);
+ Cell cell = FindFoodSpawnCell();
+ int value = mapRandom.Next(SimulationSettings.Default.FruitAmountMinimum, SimulationSettings.Default.FruitAmountMaximum);
+ Vector2D vector2D = cell.Position + new Vector2D(mapRandom.Next(cell.Width), mapRandom.Next(cell.Height));
+ CoreFruit Fruit = new CoreFruit(vector2D.X, vector2D.Y, value);
+ FruitsList.Add(Fruit);
cell.SpawnedFood = Fruit;
}
///
- /// Entfernt Obst und gibt die Zelle wieder frei.
+ /// Removes the fruits from the corresponding lists
+ /// FruitsList and SpawnCellsList
///
- /// Das zu entfernenden Obst
- public void EntferneObst(CoreFruit fruit)
+ /// fruit to be removed
+ public void RemoveFruit(CoreFruit fruit)
{
- Fruits.Remove(fruit);
- Cell cell = CellSpawnList.Find((x) => x.SpawnedFood == fruit);
+ FruitsList.Remove(fruit);
+ Cell cell = SpawnCellsList.Find((x) => x.SpawnedFood == fruit);
cell.SpawnedFood = null;
}
///
- /// Erzeugt einen neuen Bau.
+ /// create a new anthill
///
- /// ID der Kolonie
- /// Der neue Bau.
- public CoreAnthill NeuerBau(int colony)
+ /// ID of the colony
+ /// new anthill
+ public CoreAnthill NewAnthill(int colony)
{
- Vector2D punkt = AntHillPoints[mapRandom.Next(AntHillPoints.Count - 1)];
- AntHillPoints.Remove(punkt);
- CoreAnthill bau = new CoreAnthill(punkt.X, punkt.Y, SimulationSettings.Custom.AntHillRadius, colony);
- AntHills.Add(bau);
- return bau;
+ Vector2D vector2D = AntHillPoints[mapRandom.Next(AntHillPoints.Count - 1)];
+ AntHillPoints.Remove(vector2D);
+ CoreAnthill anthill = new CoreAnthill(vector2D.X, vector2D.Y, SimulationSettings.Custom.AntHillRadius, colony);
+ AntHillsList.Add(anthill);
+ return anthill;
}
- #region "Vector2D und Cells"
+ #region Vector2D and Cells
///
- /// Vector im 2D Raum
+ /// two-dimensional vector in two-dimensional space
///
internal struct Vector2D
{
@@ -335,10 +338,10 @@ internal struct Vector2D
public int Y;
///
- /// Erzeugt einen neuen 2D Vector.
+ /// Constructor of two-dimensional vector instance
///
- /// X-Koordinate des Vectors
- /// Y-Koordinate des Vectors
+ /// X-Coordinate of vector
+ /// Y-Coordinate of vector
public Vector2D(int x, int y)
{
this.X = x;
@@ -346,9 +349,9 @@ public Vector2D(int x, int y)
}
///
- /// Berechnet die LĂ€nge des Vectors.
+ /// Calculate length of vector
///
- /// Gibt dei LĂ€nge des Vectors als Float zurĂŒck.
+ /// length of vector as float
public float GetLenght()
{
return (float)Math.Sqrt((float)((X * X) + (Y * Y)));
@@ -383,11 +386,11 @@ internal class Cell
public float SpawnValue = 1f;
///
- /// Erstellt eine Neue Zelle.
+ /// Constructor of a cell instance
///
- /// Die Position der oberen linken Ecke der Zelle.
- /// Die Breite der Zelle
- /// Die Höhe der Zelle
+ /// two-dimensional position of the cells upper left corner
+ /// width of the cell
+ /// height of the cell
public Cell(Vector2D position, int width, int height)
{
this.Position = position;
diff --git a/SimulationCore/Simulation/CoreSugar.cs b/SimulationCore/Simulation/CoreSugar.cs
index cff7210..f1d6589 100644
--- a/SimulationCore/Simulation/CoreSugar.cs
+++ b/SimulationCore/Simulation/CoreSugar.cs
@@ -3,7 +3,7 @@
namespace AntMe.Simulation
{
///
- /// Represents a sugar-Hill.
+ /// Represents a sugar pile.
///
internal sealed class CoreSugar : CoreFood
{
@@ -17,16 +17,16 @@ internal CoreSugar(int x, int y, int amount)
: base(x, y, amount) { }
///
- /// Creates a sugar-state of this sugar-hill.
+ /// Creates a sugar state of this sugar hill.
///
- /// current state of that sugar-hill.
+ /// current state of that sugar hill.
internal SugarState CreateState()
{
SugarState state = new SugarState((ushort)Id);
- state.PositionX = (ushort)(koordinate.X / SimulationEnvironment.PLAYGROUND_UNIT);
- state.PositionY = (ushort)(koordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT);
- state.Radius = (ushort)(koordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT);
- state.Amount = (ushort)menge;
+ state.PositionX = (ushort)(coordinate.X / SimulationEnvironment.PLAYGROUND_UNIT);
+ state.PositionY = (ushort)(coordinate.Y / SimulationEnvironment.PLAYGROUND_UNIT);
+ state.Radius = (ushort)(coordinate.Radius / SimulationEnvironment.PLAYGROUND_UNIT);
+ state.Amount = (ushort)amount;
return state;
}
}
diff --git a/SimulationCore/Simulation/CoreTeam.cs b/SimulationCore/Simulation/CoreTeam.cs
index 94b241d..4c66482 100644
--- a/SimulationCore/Simulation/CoreTeam.cs
+++ b/SimulationCore/Simulation/CoreTeam.cs
@@ -23,8 +23,8 @@ public TeamState CreateState()
for (int i = 0; i < Colonies.Length; i++)
{
- Colonies[i].Statistik.CurrentAntCount = Colonies[i].Insects.Count;
- state.ColonyStates.Add(Colonies[i].ErzeugeInfo());
+ Colonies[i].Statistic.CurrentAntCount = Colonies[i].InsectsList.Count;
+ state.ColonyStates.Add(Colonies[i].GenerateColonyStateInfo());
}
return state;
diff --git a/SimulationCore/Simulation/DebugMessage.cs b/SimulationCore/Simulation/DebugMessage.cs
index 6634c9c..49c7421 100644
--- a/SimulationCore/Simulation/DebugMessage.cs
+++ b/SimulationCore/Simulation/DebugMessage.cs
@@ -3,70 +3,70 @@
namespace AntMe.Simulation
{
///
- /// Klasse zur Weiterleitung von Debug-Information mit Kontextinformationen
+ /// Class for forwarding debug information with context information
///
[Serializable]
public sealed class DebugMessage
{
- #region interne Variablen
+ #region internal variables
- private readonly int ameise;
- private readonly string nachricht;
- private readonly int spieler;
- private readonly DateTime zeit;
+ private readonly int ant;
+ private readonly string message;
+ private readonly int player;
+ private readonly DateTime time;
#endregion
- #region Konstruktor und Initialisierung
+ #region Construktor and Initialization
///
- /// Konstruktor einer Debugnachricht
+ /// Constructor of a debug message.
///
- /// ID des spielers
- /// ID der Ameise
- /// Nachricht
- public DebugMessage(int spieler, int ameise, string nachricht)
+ /// ID of player.
+ /// ID of ant.
+ /// Message.
+ public DebugMessage(int player, int ant, string message)
{
- zeit = DateTime.Now;
- this.spieler = spieler;
- this.ameise = ameise;
- this.nachricht = nachricht;
+ time = DateTime.Now;
+ this.player = player;
+ this.ant = ant;
+ this.message = message;
}
#endregion
- #region Eigenschaften
+ #region Attributes
///
- /// Zeitpunkt der Nachricht
+ /// Message time.
///
- public DateTime Zeit
+ public DateTime Time
{
- get { return zeit; }
+ get { return time; }
}
///
- /// Assoziierter Spieler
+ /// Associated player.
///
- public int Spieler
+ public int Player
{
- get { return spieler; }
+ get { return player; }
}
///
- /// ID der betroffenen Ameise
+ /// ID of the affected ant.
///
- public int Ameise
+ public int Ant
{
- get { return ameise; }
+ get { return ant; }
}
///
- /// Die Debugnachricht
+ /// The debug message.
///
- public string Nachricht
+ public string Message
{
- get { return nachricht; }
+ get { return message; }
}
#endregion
diff --git a/SimulationCore/Simulation/Grid.cs b/SimulationCore/Simulation/Grid.cs
index a710c50..5b53729 100644
--- a/SimulationCore/Simulation/Grid.cs
+++ b/SimulationCore/Simulation/Grid.cs
@@ -6,51 +6,49 @@ namespace AntMe.Simulation
{
///
- /// Implementiert ein Zellrasterverfahren zum schnellen Auffinden von
- /// Spielelementen auf dem Spielfeld.
+ /// Implements a cell grid method for quickly finding game elements on the playground.
///
///
- /// Ein Spielelement wird unabhängig von seinem Radius in genau eine Zelle
- /// einsortiert. Spielelemente "zwei Zellen weiter" werden daher auch dann
- /// nicht gefunden, wenn sie (durch ihren Radius) eigentlich nahe genug
- /// am Referenzelement liegen.
+ /// A game element is sorted into exactly one cell regardless of its radius.
+ /// Therefore, game elements "two cells further" will not be found even if
+ /// they are actually close enough to the reference element (due to their radius).
///
- /// Typ der Spielelemente.
+ /// Game element type.
/// Wolfgang Gallo (wolfgang@antme.net)
internal class Grid : ICollection
where T : ICoordinate
{
- #region Statischer Teil, Fabrikmethode
+ #region static part, fabric method
- #region Struktur GridSize
+ #region structur GridSize
///
- /// Speichert die Abmessungen eines Gitters.
+ /// Saves the dimensions of a grid.
///
private struct GridSize
{
///
- /// Die Breite des Gitters.
+ /// The width of the grid.
///
public readonly int Width;
///
- /// Die Höhe des Gitters.
+ /// The height of the grid.
///
public readonly int Height;
///
- /// Die Seitenlänge einer Gitterzelle.
+ /// The side length of a grid cell.
///
public readonly int SideLength;
///
- /// Erzeugt eine neue Instanz der Struktur.
+ /// Creates a new instance of the structure GridSize
///
- /// Die Breite des Gitters.
- /// Die Höhe des Gitters.
- /// Die Seitenlänge einer Gitterzelle.
+ /// The width of the grid.
+ /// The height of the grid.
+ /// The side length of a grid cell.
public GridSize(int width, int height, int sideLength)
{
Width = width;
@@ -61,18 +59,17 @@ public GridSize(int width, int height, int sideLength)
#endregion
- // Liste aller bereits erzeugten Gitter.
+ // List of all already created grids.
private static readonly Dictionary> grids =
new Dictionary>();
///
- /// Erzeugt ein Gitter mit den angegebenen Maßen oder gibt ein vorhandenes
- /// Gitter mit diesem Maßen zurück.
+ /// Creates a grid with the specified dimensions or returns an existing grid with this dimensions.
///
- /// Breite des Gitters.
- /// Höhe des Gitters.
- /// Seitenlänge einer Gitterzelle. Bestimmt die
- /// maximale Entfernung bis zu der ein Spielelement ein anderes sehen kann.
+ /// The width of the grid.
+ /// The height of the grid.
+ /// The side length of a grid cell.
+ /// Determines the Maximum distance up to which a game element can see another one.
public static Grid Create(int width, int height, int sideLength)
{
GridSize size = new GridSize(width, height, sideLength);
@@ -83,20 +80,20 @@ public static Grid Create(int width, int height, int sideLength)
#endregion
- // Die Abmessungen des Gitters.
+ // The dimensions of the grid.
private readonly int columns;
private readonly int rows;
private readonly int sideLength;
- // Die einzelnen Gitterzellen.
+ // The individual grid cells.
private readonly List[,] cells;
- #region Konstruktoren
+ #region constructors
///
- /// Erzeugt eine neue Instanz der Klasse.
+ /// Creates a new instance of the class.
///
- /// Die Maße des Gitters.
+ /// The dimensions of the grid.
private Grid(GridSize size)
{
sideLength = size.SideLength;
@@ -110,12 +107,12 @@ private Grid(GridSize size)
}
///
- /// Erzeugt einen neue Instanz der Klasse.
+ /// Creates a new instance of the class.
///
- /// Breite des Gitters.
- /// Höhe des Gitters.
- /// Seitenlänge einer Gitterzelle. Bestimmt die
- /// maximale Entfernung bis zu der ein Spielelement ein anderes sehen kann.
+ /// The width of the grid.
+ /// The height of the grid.
+ /// The side length of a grid cell.
+ /// Determines the Maximum distance up to which a game element can see another one.
public Grid(int width, int height, int sideLength)
{
this.sideLength = sideLength;
@@ -130,7 +127,7 @@ public Grid(int width, int height, int sideLength)
#endregion
- #region Schnittstelle IEnumerable
+ #region Interface IEnumerable
IEnumerator IEnumerable.GetEnumerator()
{
@@ -147,7 +144,7 @@ public IEnumerator GetEnumerator()
#endregion
- #region Schnittstelle ICollection
+ #region Interface ICollection
private int count = 0;
@@ -166,8 +163,8 @@ public void Clear()
public void Add(T element)
{
- int c = element.CoordinateBase.X / sideLength;
- int r = element.CoordinateBase.Y / sideLength;
+ int c = element.CoordinateCoreInsect.X / sideLength;
+ int r = element.CoordinateCoreInsect.Y / sideLength;
if (c < 0 || c >= columns || r < 0 || r >= rows)
return;
@@ -176,19 +173,19 @@ public void Add(T element)
}
///
- /// Fügt dem Gitter mehrere Spielelemente hinzu.
+ /// Adds multiple game elements to the grid.
///
- /// Eine Liste von Spielelementen.
- public void Add(List elemente)
+ /// List of game elements.
+ public void Add(List elements)
{
- for (int i = 0; i < elemente.Count; i++)
- Add(elemente[i]);
+ for (int i = 0; i < elements.Count; i++)
+ Add(elements[i]);
}
public bool Remove(T element)
{
- int c = element.CoordinateBase.X / sideLength;
- int r = element.CoordinateBase.Y / sideLength;
+ int c = element.CoordinateCoreInsect.X / sideLength;
+ int r = element.CoordinateCoreInsect.Y / sideLength;
if (c < 0 || c >= columns || r < 0 || r >= rows)
return false;
@@ -199,19 +196,19 @@ public bool Remove(T element)
}
///
- /// Entfernt mehrere Elemente aus dem Gitter.
+ /// Removes multiple elements from the grid.
///
- /// Eine Liste von Spielelementen.
- public void Remove(List elemente)
+ /// List of game elements.
+ public void Remove(List elements)
{
- for (int i = 0; i < elemente.Count; i++)
- Remove(elemente[i]);
+ for (int i = 0; i < elements.Count; i++)
+ Remove(elements[i]);
}
public bool Contains(T element)
{
- int c = element.CoordinateBase.X / sideLength;
- int r = element.CoordinateBase.Y / sideLength;
+ int c = element.CoordinateCoreInsect.X / sideLength;
+ int r = element.CoordinateCoreInsect.Y / sideLength;
if (c < 0 || c >= columns || r < 0 || r >= rows)
return false;
return cells[c, r].Contains(element);
@@ -234,9 +231,9 @@ public bool IsReadOnly
#endregion
- #region Finden vom Spielelementen
+ #region Find game element
- #region Klassen Tupel und TupelComparer, Sortieren von Spielelementen nach Entfernung
+ #region Tuple and TupleComparer classes, sorting game elements by distance
private readonly TupelComparer comparer = new TupelComparer();
@@ -263,21 +260,21 @@ public int Compare(T t1, T t2)
#endregion
///
- /// Findet alle Spielelemente innerhalb des gegebenen Sichtkreis des gegebenen Spielelements.
+ /// Finds all game elements within the given visual circle of the given game element.
///
- /// Das Referenzspielelement.
- /// Die maximale Entfernung.
- /// Eine nach Entfernung sortierte Liste von Spielelementen.
+ /// Reference game element.
+ /// The maximum distance.
+ /// A list of game elements sorted by distance.
public List FindSorted(ICoordinate coordinate, int maximumDistance)
{
- // Speichert alle gefundenen Tupel (Spielelement, Entfernung).
+ // Saves all found tuples (game element, distance).
List tupels = new List();
- // Bestimme die Zelle in der das übergebene Spielelement sich befindet.
- int col = coordinate.CoordinateBase.X / sideLength;
- int row = coordinate.CoordinateBase.Y / sideLength;
+ // Determine the cell in which the given game element is located.
+ int col = coordinate.CoordinateCoreInsect.X / sideLength;
+ int row = coordinate.CoordinateCoreInsect.Y / sideLength;
- // Betrachte die Zelle und die acht Zellen daneben.
+ // Consider the cell and the eight cells next to it.
for (int c = -1; c <= 1; c++)
if (col + c >= 0 && col + c < columns)
for (int r = -1; r <= 1; r++)
@@ -289,13 +286,13 @@ public List FindSorted(ICoordinate coordinate, int maximumDistance)
if (cell[i].Equals(coordinate))
continue;
- int distance = CoreCoordinate.BestimmeEntfernungI(coordinate.CoordinateBase, cell[i].CoordinateBase);
+ int distance = CoreCoordinate.DetermineDistanceI(coordinate.CoordinateCoreInsect, cell[i].CoordinateCoreInsect);
if (distance <= maximumDistance)
tupels.Add(new Tupel(cell[i], distance));
}
}
- // Sortiere die Tupel und gib die Spielelemente zurück.
+ // Sort the tuples and return the game elements.
tupels.Sort(comparer);
List elements = new List(tupels.Count);
for (int i = 0; i < tupels.Count; i++)
@@ -304,25 +301,25 @@ public List FindSorted(ICoordinate coordinate, int maximumDistance)
}
///
- /// Findet alle Spielelemente innerhalb des Sichtkreis der gegebenen Wanze.
+ /// Finds all game elements within the given bug's field of view.
///
///
- /// Die Simulation legt ein Gitter mit der maximalen Sichtweite der Wanzen als
- /// Seitenlänge an und benutzt diese Methode auf dieser Instanz zum Finden von
- /// Ameisen. In dieses Gitter werden nur Ameisen einsortiert.
+ /// The simulation creates a grid with the maximum visibility of the bugs
+ /// as side length and uses this method on this instance to find ants.
+ /// Only ants are sorted into this grid.
///
- /// Die Referenzwanze.
- /// Eine Liste von Ameisen.
+ /// Reference bug.
+ /// List of ants.
public List FindAnts(CoreBug bug)
{
- // Speichert alle gefundenen Ameisen.
+ // Saves all found ants.
List ants = new List();
- // Bestimme die Zelle in der die übergebene Wanze sich befindet.
- int col = bug.CoordinateBase.X / sideLength;
- int row = bug.CoordinateBase.Y / sideLength;
+ // Determine the cell in which the given bug is located.
+ int col = bug.CoordinateCoreInsect.X / sideLength;
+ int row = bug.CoordinateCoreInsect.Y / sideLength;
- // Betrachte die Zelle und die acht Zellen daneben.
+ // Consider the cell and the eight cells next to it.
for (int c = -1; c <= 1; c++)
if (col + c >= 0 && col + c < columns)
for (int r = -1; r <= 1; r++)
@@ -331,7 +328,7 @@ public List FindAnts(CoreBug bug)
List cell = cells[col + c, row + r];
for (int i = 0; i < cell.Count; i++)
{
- int distance = CoreCoordinate.BestimmeEntfernungI(bug.CoordinateBase, cell[i].CoordinateBase);
+ int distance = CoreCoordinate.DetermineDistanceI(bug.CoordinateCoreInsect, cell[i].CoordinateCoreInsect);
if (distance <= sideLength)
ants.Add(cell[i]);
}
@@ -341,26 +338,24 @@ public List FindAnts(CoreBug bug)
}
///
- /// Findet die Markierung, die die gegebene Ameise noch nicht gerochen hat
- /// und die der Ameise am nächsten liegt.
+ /// Finds the marker that the given ant has not smelled yet. and which is closest to the ant.
///
///
- /// Die Simulation legt ein Gitter mit dem maximalen Radius einer Markierung als
- /// Seitenlänge an und benutzt diese Methode auf dieser Instanz zum Finden von
- /// Markierungen. In dieses Gitter werden nur Markierungen einsortiert.
+ /// The simulation creates a grid with the maximum radius of a marker as the side length
+ /// and uses this method on this instance to find markers. Only marks are sorted into this grid.
///
- /// Die Referenzameise.
- /// Eine Markierung.
+ /// Reference ant.
+ /// Marker.
public CoreMarker FindMarker(CoreAnt ant)
{
CoreMarker nearestMarker = null;
int nearestMarkerDistance = int.MaxValue;
- // Bestimme die Zelle in der die übergebene Ameise sich befindet.
- int col = ant.CoordinateBase.X / sideLength;
- int row = ant.CoordinateBase.Y / sideLength;
+ // Determine the cell in which the given ant is located.
+ int col = ant.CoordinateCoreInsect.X / sideLength;
+ int row = ant.CoordinateCoreInsect.Y / sideLength;
- // Betrachte die Zelle und die acht Zellen daneben.
+ // Consider the cell and the eight cells next to it.
for (int c = -1; c <= 1; c++)
if (col + c >= 0 && col + c < columns)
for (int r = -1; r <= 1; r++)
@@ -368,18 +363,17 @@ public CoreMarker FindMarker(CoreAnt ant)
{
List cell = cells[col + c, row + r];
- // Betrachte alle Markierungen in der aktuellen Zelle.
+ // Consider all markers in the current cell.
for (int i = 0; i < cell.Count; i++)
{
CoreMarker marker = cell[i] as CoreMarker;
Debug.Assert(marker != null);
- // Bestimme die Entfernung der Mittelpunkte und der Kreise.
- int distance = CoreCoordinate.BestimmeEntfernungDerMittelpunkteI(ant.CoordinateBase, marker.CoordinateBase);
- int circleDistance = distance - ant.CoordinateBase.Radius - marker.CoordinateBase.Radius;
+ // Determine the distance between the centers and the circles.
+ int distance = CoreCoordinate.DetermineDistanceToCenter(ant.CoordinateCoreInsect, marker.CoordinateCoreInsect);
+ int circleDistance = distance - ant.CoordinateCoreInsect.Radius - marker.CoordinateCoreInsect.Radius;
- // Die neue Markierung wurde noch nicht gerochen und
- // liegt näher als die gemerkte.
+ // The new marker has not yet been smelled and is closer than the remembered one.
if (circleDistance <= 0 && distance < nearestMarkerDistance &&
!ant.SmelledMarker.Contains(marker))
{
@@ -393,60 +387,59 @@ public CoreMarker FindMarker(CoreAnt ant)
}
///
- /// Findet die Wanze, die feindliche Ameise und die befreundete Ameise mit der
- /// geringsten Entfernung innerhalb des Sichtkreis der gegebenen Ameise und
- /// zählt die Anzahl an Wanzen, feindlichen und befreundeten Ameisen im Sichtkreis.
+ /// Finds the bug, enemy ant and friendly ant with the smallest distance within the given
+ /// ant's field of view and counts the number of bugs, enemy ants and friendly ants in the
+ /// field of view.
///
///
- /// Wird für Ameisen verwendet. Die Simulation legt für jeden vorkommenden Sichtradius
- /// eine eigenes Gitter an und benutzt diese Methode auf der passenden Instanz zum Finden
- /// von Insekten. Die Seitenlänge dieses Gitters ist also der Sichradius der Ameise.
- /// In diese Gitter werden Wanzen und Ameisen einsortiert.
+ /// Used for ants. The simulation creates a separate grid for each sight radius and uses
+ /// this method on the appropriate instance to find insects. The side length of this grid
+ /// is the radius of view of the ant. Bugs and ants are sorted into these grids.
///
- /// Die Referenzameise.
- /// Eine Wanze.
- /// Die Anzahl an Wanzen.
- /// Eine feindliche Ameise.
- /// Die Anzahl an feindlichen Ameisen.
- /// Eine befreundete Ameise.
- /// Die Anzahl an befreundeten Ameisen.
- /// Die Anzahl an befreundeten Ameisen der selben Kaste.
+ /// reference ant.
+ /// nearest bug.
+ /// bug counter.
+ /// nearest enemy ant.
+ /// enemy ant counter.
+ /// nearest colony ant.
+ /// colony ant counter.
+ /// The number of friendly ants of the same caste.
public void FindAndCountInsects(CoreAnt ant, out CoreBug nearestBug, out int bugCount,
out CoreAnt nearestEnemyAnt, out int enemyAntCount, out CoreAnt nearestColonyAnt,
out int colonyAntCount, out int casteAntCount, out CoreAnt nearestTeamAnt,
out int teamAntCount)
{
- // Die nächstliegenden gefundenen Wanzen und Ameisen.
+ // The nearest found bugs and ants.
nearestBug = null;
nearestEnemyAnt = null;
nearestColonyAnt = null;
nearestTeamAnt = null;
- // Die Entfernungen zu den nächstliegenden gefundenen Wanzen und Ameisen.
+ // The distances to the nearest bugs and ants found.
int nearestBugDistance = int.MaxValue;
int nearestEnemyAntDistance = int.MaxValue;
int nearestColonyAntDistance = int.MaxValue;
int nearestTeamAntDistance = int.MaxValue;
- // Die Anzahlen der gefundenen Wanzen und Ameisen.
+ // The numbers of bugs and ants found.
bugCount = 0;
enemyAntCount = 0;
colonyAntCount = 0;
casteAntCount = 0;
teamAntCount = 0;
- // Bestimme die Zelle in der die übergebene Ameise sich befindet.
- int col = ant.CoordinateBase.X / sideLength;
- int row = ant.CoordinateBase.Y / sideLength;
+ // Determine the cell in which the given ant is located.
+ int col = ant.CoordinateCoreInsect.X / sideLength;
+ int row = ant.CoordinateCoreInsect.Y / sideLength;
- // Betrachte die Zelle und die acht Zellen daneben.
+ // Consider the cell and the eight cells next to it.
for (int c = -1; c <= 1; c++)
if (col + c >= 0 && col + c < columns)
for (int r = -1; r <= 1; r++)
if (row + r >= 0 && row + r < rows)
{
- // Betrachte alle Insekten in der aktuellen Zelle.
+ // Consider all insects in the current cell.
List cell = cells[col + c, row + r];
for (int i = 0; i < cell.Count; i++)
{
@@ -456,20 +449,20 @@ public void FindAndCountInsects(CoreAnt ant, out CoreBug nearestBug, out int bug
if (insect == ant)
continue;
- // Vergleiche die Entfernung zum aktuellen Insekt mit der
- // Sichtweite der Ameise bzw. der Seitenlänge des Gitters.
- int distance = CoreCoordinate.BestimmeEntfernungI(ant.CoordinateBase, insect.CoordinateBase);
+ // Compare the distance to the current insect with the ant's visibility
+ // or the side length of the grid.
+ int distance = CoreCoordinate.DetermineDistanceI(ant.CoordinateCoreInsect, insect.CoordinateCoreInsect);
if (distance > sideLength)
continue;
- // Selbes Volk. Die Abfrage "insect is CoreAnt" ist unnötig.
- if (insect.colony == ant.colony)
+ // Same colony. The query "insect is CoreAnt" is unnecessary.
+ if (insect.Colony == ant.Colony)
{
colonyAntCount++;
- if (insect.CasteIndexBase == ant.CasteIndexBase)
+ if (insect.CasteIndexCoreInsect == ant.CasteIndexCoreInsect)
casteAntCount++;
- // Die neue Ameise liegt näher als die gemerkte.
+ // The new ant is closer than the remembered one.
if (distance < nearestColonyAntDistance)
{
nearestColonyAntDistance = distance;
@@ -477,12 +470,12 @@ public void FindAndCountInsects(CoreAnt ant, out CoreBug nearestBug, out int bug
}
}
- // Selbes Team.
- else if (insect.colony.Team == ant.colony.Team)
+ // Same team.
+ else if (insect.Colony.Team == ant.Colony.Team)
{
teamAntCount++;
- // Die neue Ameise liegt näher als die gemerkte.
+ // The new ant is closer than the remembered one.
if (distance < nearestTeamAntDistance)
{
nearestTeamAntDistance = distance;
@@ -490,12 +483,12 @@ public void FindAndCountInsects(CoreAnt ant, out CoreBug nearestBug, out int bug
}
}
- // Wanze.
+ // Bug.
else if (insect is CoreBug)
{
bugCount++;
- // Die neue Wanze liegt näher als die gemerkte.
+ // The new bug is closer than the remembered one.
if (distance < nearestBugDistance)
{
nearestBugDistance = distance;
@@ -503,12 +496,12 @@ public void FindAndCountInsects(CoreAnt ant, out CoreBug nearestBug, out int bug
}
}
- // Feindliche Ameise.
+ // Enemy ant.
else
{
enemyAntCount++;
- // Die neue Ameise liegt näher als die gemerkte.
+ // The new ant is closer than the remembered one.
if (distance < nearestEnemyAntDistance)
{
nearestEnemyAntDistance = distance;
diff --git a/SimulationCore/Simulation/ICoordinate.cs b/SimulationCore/Simulation/ICoordinate.cs
index 385ef77..43a54fe 100644
--- a/SimulationCore/Simulation/ICoordinate.cs
+++ b/SimulationCore/Simulation/ICoordinate.cs
@@ -1,14 +1,14 @@
ï»żnamespace AntMe.Simulation
{
///
- /// Ermöglicht es, die Koordinate eines Objekts auf dem Spielfeld abzufragen.
+ /// Allows to query the coordinate of an object on the field.
///
/// Wolfgang Gallo (wolfgang@antme.net)
public interface ICoordinate
{
///
- /// Liest die Koordinate eines Objekts auf dem Spielfeld aus.
+ /// Gets the coordinates of an object on the playground.
///
- CoreCoordinate CoordinateBase { get; }
+ CoreCoordinate CoordinateCoreInsect { get; }
}
}
diff --git a/SimulationCore/Simulation/PlayerAnalysis.cs b/SimulationCore/Simulation/PlayerAnalysis.cs
index a95a580..8c04dba 100644
--- a/SimulationCore/Simulation/PlayerAnalysis.cs
+++ b/SimulationCore/Simulation/PlayerAnalysis.cs
@@ -9,58 +9,58 @@
namespace AntMe.Simulation
{
///
- /// Player-Analysis-Class
+ /// Player analysis class
///
internal sealed class PlayerAnalysis
{
- #region local Variables
+ #region Local variables
///
/// Type of baseAnt from core.
///
- private TypeDefinition _coreAnt;
+ private TypeDefinition coreAnt;
///
- /// List of all Ant-BaseClasses in every known language.
+ /// List of all ant base classes in every known language.
///
- private Dictionary _languageBases;
+ private Dictionary languageBases;
#endregion
#region public Methods
///
- /// Sets special simulation-settings.
+ /// Sets special simulation settings.
///
- /// special settings
+ /// Special settings.
public void InitSettings(SimulationSettings settings)
{
SimulationSettings.SetCustomSettings(settings);
}
///
- /// Searches in the given file for possible PlayerInfos and delivers a list of found Players.
+ /// Analyse given binary file for and returns a list of found .
///
- /// Ai-File as binary file-dump.
- /// True, if Analyzer should also check player-rules
- /// List of found players.
+ /// AI file as binary file dump.
+ /// True to check player rules.
+ /// List of found from given binary file.
public List Analyse(byte[] file, bool checkRules)
{
- // load base-class from Simulation-Core.#
+ // Load base-class from simulation core.#
ModuleDefinition simulation = ModuleDefinition.ReadModule(Assembly.GetExecutingAssembly().Modules.First().FullyQualifiedName);
- _coreAnt = simulation.GetType("AntMe.Simulation.CoreAnt");
+ coreAnt = simulation.GetType("AntMe.Simulation.CoreAnt");
//coreAnt = simulation.GetType("AntMe.Simulation.CoreAnt");
- // load all base-classes of different languages
- _languageBases = new Dictionary();
- _languageBases.Add(
+ // Load all base classes of different languages.
+ languageBases = new Dictionary();
+ languageBases.Add(
PlayerLanguages.Deutsch,
simulation.GetType("AntMe.Deutsch.Basisameise"));
- _languageBases.Add(
+ languageBases.Add(
PlayerLanguages.English,
simulation.GetType("AntMe.English.BaseAnt"));
- // open Ai-File
+ // open AI file
using (var filestream = new MemoryStream(file))
{
return analyseAssembly(ModuleDefinition.ReadModule(filestream), checkRules);
@@ -69,13 +69,13 @@ public List Analyse(byte[] file, bool checkRules)
#endregion
- #region Helpermethods
+ #region Helper methods
///
/// Analyzes the given for any kind of valid player-information.
///
- /// given module.
- /// true, if the Analyser should also check player-rules
+ /// Given module.
+ /// True for checking player rules with analyseAssembly
/// List of valid players.
private List analyseAssembly(ModuleDefinition module, bool checkRules)
{
@@ -94,25 +94,25 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
{
case "mscorlib":
// Framework-Core
- byte[] coreschlüssel = new AssemblyName(typeof(object).Assembly.FullName).GetPublicKeyToken();
- byte[] referenzschlüssel = reference.PublicKeyToken;
- if (coreschlüssel[0] != referenzschlüssel[0] ||
- coreschlüssel[1] != referenzschlüssel[1] ||
- coreschlüssel[2] != referenzschlüssel[2] ||
- coreschlüssel[3] != referenzschlüssel[3] ||
- coreschlüssel[4] != referenzschlüssel[4] ||
- coreschlüssel[5] != referenzschlüssel[5] ||
- coreschlüssel[6] != referenzschlüssel[6] ||
- coreschlüssel[7] != referenzschlüssel[7])
+ byte[] coreKey = new AssemblyName(typeof(object).Assembly.FullName).GetPublicKeyToken();
+ byte[] referenceKey = reference.PublicKeyToken;
+ if (coreKey[0] != referenceKey[0] ||
+ coreKey[1] != referenceKey[1] ||
+ coreKey[2] != referenceKey[2] ||
+ coreKey[3] != referenceKey[3] ||
+ coreKey[4] != referenceKey[4] ||
+ coreKey[5] != referenceKey[5] ||
+ coreKey[6] != referenceKey[6] ||
+ coreKey[7] != referenceKey[7])
{
throw new RuleViolationException(Resource.SimulationCoreAnalysisCheatWithFxFake);
}
break;
case "Microsoft.VisualBasic":
- // TODO: Prüfen, wie wir damit umgehen
+ // TODO: figure out how to handle this
break;
case "System":
- // TODO: Prüfen, wie wir damit umgehen
+ // TODO: figure out how to handle this
break;
case "AntMe.Simulation":
if (Assembly.GetCallingAssembly().FullName != reference.FullName)
@@ -157,7 +157,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
//}
break;
default:
- // load unknown refereneces and add to list
+ // Load unknown references and add to list.
try
{
//Assembly.ReflectionOnlyLoad(reference.FullName);
@@ -175,50 +175,50 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- // TODO: Statische Variablen finden
- // TODO: Statische Konstruktoren finden - immernoch ein Problem?
- // TODO: Nested Types!
+ // TODO: find static attributes
+ // TODO: find static constructor, still a problem?
+ // TODO: nested types!
foreach (var typeDefinition in module.Types)
{
- // Suche nach statischen Variablen und bestimme so, ob der Spieler
- // ein globales Gedächtnis für seine Ameisen benutzt.
+ // Search for static attributes for determination
+ // whether the player uses global memory for their ants.
staticVariables |= typeDefinition.Fields.Any(f => f.IsStatic);
staticVariables |= typeDefinition.Properties.Any(p => (p.SetMethod?.IsStatic ?? false) || (p.GetMethod?.IsStatic ?? false));
}
- // Gefundene KIs auf Regeln prüfen
- // Betrachte alle öffentlichen Typen in der Bibliothek.
+ // Check AIs against rule set.
+ // Consider all public types in library.
foreach (var exportedType in module.Types.Where(t => t.IsPublic && !t.IsInterface && !t.IsAbstract))
{
- // Prüfe ob der Typ von der Klasse Ameise erbt.
+ // Check if the type inhert from class ant.
var exportedTypeDefinition = exportedType.Resolve();
- // Ameisenversion 1.6
- if (exportedTypeDefinition.IsSubclassOf(_coreAnt))
+ // AntMe version 1.6
+ if (exportedTypeDefinition.IsSubclassOf(coreAnt))
{
- // Leerer Spieler-Rumpf
+ // Player definition is empty.
int playerDefinitions = 0;
PlayerInfo player = new PlayerInfo();
player.SimulationVersion = PlayerSimulationVersions.Version_1_7;
player.ClassName = exportedType.FullName;
- // Sprache ermitteln
- foreach (PlayerLanguages sprache in _languageBases.Keys)
+ // Determine language.
+ foreach (PlayerLanguages language in languageBases.Keys)
{
- if (exportedTypeDefinition.IsSubclassOf(_languageBases[sprache]))
+ if (exportedTypeDefinition.IsSubclassOf(languageBases[language]))
{
- player.Language = sprache;
+ player.Language = language;
break;
}
}
- // TODO: Vorgehensweise bei unbekannten Sprachen
+ // TODO: handling of unknown languages
- // Attribute auslesen
+ // Read attributes.
foreach (var attribute in exportedTypeDefinition.CustomAttributes)
{
- // Player-Attribut auslesen
+ // Read player attributes.
switch (attribute.AttributeType.FullName)
{
case "AntMe.Deutsch.SpielerAttribute":
@@ -259,13 +259,13 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
break;
}
- // Caste-Attribut auslesen
+ // Read caste attributes.
CasteInfo caste = new CasteInfo();
switch (attribute.AttributeType.FullName)
{
case "AntMe.English.CasteAttribute":
- // englische Kasten
+ // english Castes
foreach (var field in attribute.Fields)
{
switch (field.Name)
@@ -297,7 +297,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- // Bei Individualkasten zur Liste
+ // new castes of the player will be added to list
if (!caste.IsEmpty())
{
player.Castes.Add(caste);
@@ -305,7 +305,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
break;
case "AntMe.Deutsch.KasteAttribute":
- // deutsche Kasten
+ // Deutsche Kasten.
foreach (var field in attribute.Fields)
{
switch (field.Name)
@@ -337,7 +337,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- // Bei Individualkasten zur Liste
+ // New castes of the player will be added to list.
if (!caste.IsEmpty())
{
player.Castes.Add(caste);
@@ -345,9 +345,9 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
break;
}
- // Access-Attributes
+ // Access attributes
bool isAccessAttribute = false;
- // TODO: Request-Infos lokalisieren
+ // TODO: localize request information
switch (attribute.AttributeType.FullName)
{
case "AntMe.Deutsch.DateizugriffAttribute":
@@ -411,7 +411,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- // Prüfe ob die Klasse regelkonform ist
+ // Check class against rule set.
player.Static = staticVariables;
player.RequestReferences = foreignReferences;
if (foreignReferences)
@@ -424,7 +424,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
switch (playerDefinitions)
{
case 0:
- // Kein Spielerattribut gefunden
+ // No player attribute found.
throw new RuleViolationException(
string.Format(
Resource.SimulationCoreAnalysisNoPlayerAttribute,
@@ -444,29 +444,29 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- #region Erkennung älterer KI-Versionen
+ #region handling of old AIs
- // Ältere Versionen
+ // Old AntMe version.
else if (exportedTypeDefinition.BaseType.Name == "AntMe.Ameise")
{
- // Leerer Spieler-Rumpf
+ // No player definiton.
int playerDefinitions = 0;
PlayerInfo player = new PlayerInfo();
player.SimulationVersion = PlayerSimulationVersions.Version_1_1;
player.ClassName = exportedTypeDefinition.FullName;
- // Veraltete Version (1.1 oder 1.5)
- // TODO: Prüfen
+ // Old versions 1.1 to 1.5.
+ // TODO: Check old versions 1.1 to 1.5
if (exportedTypeDefinition.Methods.Any(MethodDefinition => MethodDefinition.Name == "RiechtFreund"))
{
player.SimulationVersion = PlayerSimulationVersions.Version_1_5;
}
- // Attribute auslesen
+ // Read attributes.
foreach (var attribute in exportedTypeDefinition.CustomAttributes)
{
- // Spieler-Attribut auslesen
+ // Read player attribute.
if (attribute.AttributeType.FullName == "AntMe.SpielerAttribute")
{
playerDefinitions++;
@@ -488,7 +488,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
break;
}
- // Typ-Attribut auslesen
+ // Read type attributes.
if (attribute.AttributeType.FullName == "AntMe.TypAttribute")
{
CasteInfo caste = new CasteInfo();
@@ -523,7 +523,7 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- // Bei Individualtypen zur Liste
+ // New castes of the player will be added to list.
if (!caste.IsEmpty())
{
player.Castes.Add(caste);
@@ -532,12 +532,12 @@ private List analyseAssembly(ModuleDefinition module, bool checkRule
}
}
- // Prüfe ob die Klasse regelkonform ist
+ // Check class against rule set.
player.Static = staticVariables;
switch (playerDefinitions)
{
case 0:
- // Kein Spielerattribut gefunden
+ // No player attribute found.
throw new RuleViolationException(
string.Format(
Resource.SimulationCoreAnalysisNoPlayerAttribute,
diff --git a/SimulationCore/Simulation/PlayerCall.cs b/SimulationCore/Simulation/PlayerCall.cs
index 9b0a1be..591cc03 100644
--- a/SimulationCore/Simulation/PlayerCall.cs
+++ b/SimulationCore/Simulation/PlayerCall.cs
@@ -31,21 +31,26 @@ static PlayerCall()
/// ant
public static void Waits(CoreAnt ant)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.Waits));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.WartetBase();
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.Waits));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.WaitingCoreAnt();
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in WaitingBase() method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der Wartet()-Methode", ant.colony.Player.Guid), ex);
- }
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -54,21 +59,26 @@ public static void Waits(CoreAnt ant)
/// ant
public static void BecomesTired(CoreAnt ant)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.BecomesTired));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
- {
- ant.WirdMüdeBase();
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der WirdMüde()-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.BecomesTired));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.IsGettingTiredCoreAnt();
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in IsGettingTiredBase() method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
#endregion
@@ -82,22 +92,26 @@ public static void BecomesTired(CoreAnt ant)
/// sugar
public static void Spots(CoreAnt ant, CoreSugar sugar)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SpotsSugar));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
- {
- ant.SiehtBase(sugar);
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der Sieht(Zucker)-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SpotsSugar));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsCoreAnt(sugar);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsBase(sugar) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -107,22 +121,26 @@ public static void Spots(CoreAnt ant, CoreSugar sugar)
/// fruit
public static void Spots(CoreAnt ant, CoreFruit fruit)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SpotsFruit));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
- {
- ant.SiehtBase(fruit);
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der Sieht(Obst)-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SpotsFruit));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsCoreAnt(fruit);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsBase(fruit) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -132,23 +150,28 @@ public static void Spots(CoreAnt ant, CoreFruit fruit)
/// sugar
public static void TargetReached(CoreAnt ant, CoreSugar sugar)
{
- AreaChanged(
- null,
- new AreaChangeEventArgs(ant.colony.Player, Area.ReachedSugar));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.ZielErreichtBase(sugar);
+ AreaChanged(
+ null,
+ new AreaChangeEventArgs(ant.Colony.Player, Area.ReachedSugar));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.ArrivedAtTargetCoreAnt(sugar);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in ArrivedAtTargetBase(sugar) method", ant.Colony.Player.Guid),
+ ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der ZielErreicht(Zucker)-Methode", ant.colony.Player.Guid), ex);
- }
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -158,22 +181,28 @@ public static void TargetReached(CoreAnt ant, CoreSugar sugar)
/// fruit
public static void TargetReached(CoreAnt ant, CoreFruit fruit)
{
- AreaChanged(
- null,
- new AreaChangeEventArgs(ant.colony.Player, Area.ReachedFruit));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.ZielErreichtBase(fruit);
+ AreaChanged(
+ null,
+ new AreaChangeEventArgs(ant.Colony.Player, Area.ReachedFruit));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.ArrivedAtTargetCoreAnt(fruit);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in ArrivedAtTargetBase(fruit) method", ant.Colony.Player.Guid),
+ ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der ZielErreicht(Obst)-Methode", ant.colony.Player.Guid), ex);
- }
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
#endregion
@@ -187,22 +216,26 @@ public static void TargetReached(CoreAnt ant, CoreFruit fruit)
/// marker
public static void SmellsFriend(CoreAnt ant, CoreMarker marker)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SmellsFriend));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
- {
- ant.RiechtFreundBase(marker);
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der RiechtFreund(Markierung)-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SmellsFriend));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsFriendCoreAnt(marker);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsFriendBase(marker) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -212,22 +245,26 @@ public static void SmellsFriend(CoreAnt ant, CoreMarker marker)
/// friendly ant
public static void SpotsFriend(CoreAnt ant, CoreAnt friend)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SpotsFriend));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.SiehtFreundBase(friend);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SpotsFriend));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsFriendCoreAnt(friend);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsFriend(marker) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der SiehtFreund(Ameise)-Methode", ant.colony.Player.Guid), ex);
- }
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -237,22 +274,26 @@ public static void SpotsFriend(CoreAnt ant, CoreAnt friend)
/// friendly ant
public static void SpotsTeamMember(CoreAnt ant, CoreAnt friend)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SpotsTeamMember));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.SiehtVerbündetenBase(friend);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SpotsTeamMember));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsTeamMemberCoreAnt(friend);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsTeamMember(ant, ant) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der SiehtVerbündeten(Ameise)-Methode", ant.colony.Player.Guid), ex);
- }
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
#endregion
@@ -266,22 +307,26 @@ public static void SpotsTeamMember(CoreAnt ant, CoreAnt friend)
/// bug
public static void SpotsEnemy(CoreAnt ant, CoreBug bug)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SpotsBug));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.SiehtFeindBase(bug);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SpotsBug));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsEnemyCoreAnt(bug);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsEnemy(ant, bug) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der SiehtFeind(Wanze)-Methode", ant.colony.Player.Guid), ex);
- }
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -291,22 +336,26 @@ public static void SpotsEnemy(CoreAnt ant, CoreBug bug)
/// foreign ant
public static void SpotsEnemy(CoreAnt ant, CoreAnt enemy)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.SpotsEnemy));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.SiehtFeindBase(enemy);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.SpotsEnemy));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.SpotsEnemyCoreAnt(enemy);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in SpotsEnemy(ant, ant) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der SiehtFeind(Ameise)-Methode", ant.colony.Player.Guid), ex);
- }
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -316,23 +365,27 @@ public static void SpotsEnemy(CoreAnt ant, CoreAnt enemy)
/// enemy
public static void UnderAttack(CoreAnt ant, CoreAnt enemy)
{
- AreaChanged(
- null,
- new AreaChangeEventArgs(ant.colony.Player, Area.UnderAttackByAnt));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
- {
- ant.WirdAngegriffenBase(enemy);
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der WirdAngegriffen(Ameise)-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null,
+ new AreaChangeEventArgs(ant.Colony.Player, Area.UnderAttackByAnt));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.IsUnderAttackCoreAnt(enemy);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in UnderAttack(ant, ant) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -342,24 +395,28 @@ public static void UnderAttack(CoreAnt ant, CoreAnt enemy)
/// bug
public static void UnderAttack(CoreAnt ant, CoreBug bug)
{
- AreaChanged(
- null,
- new AreaChangeEventArgs(
- ant.colony.Player, Area.UnderAttackByBug));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
- {
- ant.WirdAngegriffenBase(bug);
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der WirdAngegriffen(Wanze)-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null,
+ new AreaChangeEventArgs(
+ ant.Colony.Player, Area.UnderAttackByBug));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.UnderAttackCoreAnt(bug);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in UnderAttack(ant, bug) method", ant.Colony.Player.Guid), ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
#endregion
@@ -373,20 +430,24 @@ public static void UnderAttack(CoreAnt ant, CoreBug bug)
/// kind of death
public static void HasDied(CoreAnt ant, CoreKindOfDeath kindOfDeath)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.HasDied));
- playerRights.PermitOnly();
- try
- {
- ant.IstGestorbenBase(kindOfDeath);
- }
- catch (Exception ex)
+ if (AreaChanged != null)
{
- throw new AiException(string.Format("{0}: KI-Fehler in der IstGestorben()-Methode", ant.colony.Player.Guid), ex);
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.HasDied));
+ playerRights.PermitOnly();
+ try
+ {
+ ant.HasDiedCoreAnt(kindOfDeath);
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(
+ string.Format("{0}: AI error in HadDiedBase(kindOfDeath) method", ant.Colony.Player.Guid), ex);
+ }
+
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
-
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
///
@@ -395,22 +456,26 @@ public static void HasDied(CoreAnt ant, CoreKindOfDeath kindOfDeath)
/// ant
public static void Tick(CoreAnt ant)
{
- AreaChanged(
- null, new AreaChangeEventArgs(ant.colony.Player, Area.Tick));
- playerRights.PermitOnly();
- ant.NimmBefehleEntgegen = true;
- try
+ if (AreaChanged != null)
{
- ant.TickBase();
+ AreaChanged(
+ null, new AreaChangeEventArgs(ant.Colony.Player, Area.Tick));
+ playerRights.PermitOnly();
+ ant.AwaitingCommands = true;
+ try
+ {
+ ant.TickCoreAnt();
+ }
+ catch (Exception ex)
+ {
+ throw new AiException(string.Format("{0}: AI error in TickBase() method", ant.Colony.Player.Guid),
+ ex);
+ }
+
+ ant.AwaitingCommands = false;
+ AreaChanged(
+ null, new AreaChangeEventArgs(null, Area.Unknown));
}
- catch (Exception ex)
- {
- throw new AiException(string.Format("{0}: KI-Fehler in der Tick()-Methode", ant.colony.Player.Guid), ex);
- }
-
- ant.NimmBefehleEntgegen = false;
- AreaChanged(
- null, new AreaChangeEventArgs(null, Area.Unknown));
}
#endregion
diff --git a/SimulationCore/Simulation/PlayerInfo.cs b/SimulationCore/Simulation/PlayerInfo.cs
index 03ca87d..08a437d 100644
--- a/SimulationCore/Simulation/PlayerInfo.cs
+++ b/SimulationCore/Simulation/PlayerInfo.cs
@@ -6,12 +6,12 @@
namespace AntMe.Simulation
{
///
- /// Holds all meta-information about a player.
+ /// Holds all meta information about a player and the AI.
///
[Serializable]
public class PlayerInfo : ICloneable
{
- #region lokale Variablen
+ #region local attributes
///
/// List of all castes.
@@ -19,12 +19,12 @@ public class PlayerInfo : ICloneable
private readonly List castes;
///
- /// Reference to the ai-assembly-file.
+ /// Reference to the assembled AI file.
///
internal Assembly assembly;
///
- /// true, if the Ai gives some debug-information.
+ /// True, if the AI gives some debug information.
///
public bool HasDebugInformation;
@@ -39,22 +39,22 @@ public class PlayerInfo : ICloneable
public string ColonyName;
///
- /// Complete Class-name of colony-class.
+ /// Complete colony class name.
///
public string ClassName;
///
- /// true, if the colony needs access to a database.
+ /// True, if the colony needs access to a database.
///
public bool RequestDatabaseAccess;
///
- /// true, if the colony needs access to files.
+ /// True, if the colony needs access to files.
///
public bool RequestFileAccess;
///
- /// true, if the colony needs access to the network.
+ /// True, if the colony needs access to the network.
///
public bool RequestNetworkAccess;
@@ -64,22 +64,22 @@ public class PlayerInfo : ICloneable
public string RequestInformation;
///
- /// true, if the colony has references to other assemblies.
+ /// True, if the colony has references to other assemblies.
///
public bool RequestReferences;
///
- /// true, if the colony needs access to user-interfaces.
+ /// True, if the colony needs access to user-interfaces.
///
public bool RequestUserInterfaceAccess;
///
- /// Last name of colony-author.
+ /// Last name of colony author.
///
public string LastName;
///
- /// First name of colony-author.
+ /// First name of colony author.
///
public string FirstName;
@@ -89,7 +89,7 @@ public class PlayerInfo : ICloneable
public PlayerLanguages Language;
///
- /// true, if the colony uses any static types.
+ /// True, if the colony uses any static types.
///
public bool Static;
@@ -100,7 +100,7 @@ public class PlayerInfo : ICloneable
#endregion
- #region Constructor and Initializaion
+ #region Constructor and initialization
///
/// Creates a new instance of PlayerInfo.
@@ -127,9 +127,9 @@ public PlayerInfo()
}
///
- /// Creates a new instance of PlayerInfo.
+ /// Creates a new instance of player info.
///
- /// Base-info
+ /// base info
public PlayerInfo(PlayerInfo info)
{
// Daten kopieren
@@ -188,7 +188,7 @@ public PlayerInfo(
bool requestReferences,
string requestInformation)
{
- // Ameisenkasten überprüfen
+ // check caste
if (castes == null)
{
this.castes = new List();
@@ -198,7 +198,7 @@ public PlayerInfo(
this.castes = castes;
}
- // Restliche Daten übertragen
+ // Transfer data
Guid = guid;
ColonyName = colonyName;
FirstName = firstName;
@@ -218,7 +218,7 @@ public PlayerInfo(
#endregion
- #region Hilfsmethoden
+ #region helper methods
///
/// Checks the rules.
@@ -243,7 +243,7 @@ public void RuleCheck()
#endregion
- #region Eigenschaften
+ #region properties
///
/// Delivers the list of castes.
diff --git a/SimulationCore/Simulation/PlayerInfoFiledump.cs b/SimulationCore/Simulation/PlayerInfoFiledump.cs
index 24b6dca..2d31483 100644
--- a/SimulationCore/Simulation/PlayerInfoFiledump.cs
+++ b/SimulationCore/Simulation/PlayerInfoFiledump.cs
@@ -3,30 +3,30 @@
namespace AntMe.Simulation
{
///
- /// SpielerInfo Klasse mit der angabe eines zusätzlichen Dumps einer Spieler-KI
+ /// PlayerInfo class with the specification of an additional dump of a player AI.
///
[Serializable]
public sealed class PlayerInfoFiledump : PlayerInfo
{
- #region interne Variablen
+ #region internal attributes
///
- /// Kopie der KI-Assembly
+ /// Copy of the AI assembly.
///
public byte[] File;
#endregion
- #region Initialisierung und Konstruktor
+ #region Initialization and constructor
///
- /// Creates an instance of PlayerInfoFiledump
+ /// Creates an instance of player info file dump.
///
public PlayerInfoFiledump() { }
///
- /// Konstruktor der SpielerInfo mit Dateikopie
- /// Kopie der Datei in Form eines Byte[]
+ /// Constructor of the PlayerInfo with file copy.
+ /// Copy of the file dump one byte[].
///
public PlayerInfoFiledump(byte[] file)
{
@@ -34,10 +34,10 @@ public PlayerInfoFiledump(byte[] file)
}
///
- /// Konstruktor der SpielerInfo mit Dateikopie
+ /// Constructor of the PlayerInfo with file copy.
///
- /// Basis SpielerInfo
- /// Kopie der Datei in Form eines Byte[]
+ /// Base player info.
+ /// Copy of the file dump one byte[].
public PlayerInfoFiledump(PlayerInfo info, byte[] file)
: base(info)
{
diff --git a/SimulationCore/Simulation/PlayerInfoFilename.cs b/SimulationCore/Simulation/PlayerInfoFilename.cs
index 2bbf8e6..375fbdc 100644
--- a/SimulationCore/Simulation/PlayerInfoFilename.cs
+++ b/SimulationCore/Simulation/PlayerInfoFilename.cs
@@ -3,40 +3,41 @@
namespace AntMe.Simulation
{
///
- /// Spielerinfo mit zusätzlicher Angabe eines Dateinamens
+ /// Player AI file with filename.
///
[Serializable]
public sealed class PlayerInfoFilename : PlayerInfo
{
- #region interne Variablen
+ #region internal attribute
///
- /// Pfad zur KI-Datei
+ /// Player AI file with path.
///
public string File;
#endregion
- #region Initialisierung und Konstruktor
+ #region constructor and initialization
///
- /// Creates an instance of PlayerInfoFilename
+ /// Creates an instance of a player AI info file.
///
public PlayerInfoFilename() { }
///
- /// Konstruktor der SpielerInfo mit Dateinamen
+ /// Creates an instance of a player AI info file with given filename.
///
+ /// Player AI file with path.
public PlayerInfoFilename(string file)
{
File = file;
}
///
- /// Konstruktor der SpielerInfo mit Dateinamen
+ /// Creates an instance of a player AI info file with given filename an AI info.
///
- ///
- ///
+ /// Player AI info.
+ /// Player AI file with path.
public PlayerInfoFilename(PlayerInfo info, string file)
: base(info)
{
@@ -46,10 +47,10 @@ public PlayerInfoFilename(PlayerInfo info, string file)
#endregion
///
- /// Ermittelt, ob die KIs gleich sind
+ /// Determine if this player AI has the same hash code as the given AI.
///
- ///
- ///
+ /// Given player AI.
+ /// True for equal AI.
public override bool Equals(object obj)
{
PlayerInfoFilename other = (PlayerInfoFilename)obj;
@@ -57,9 +58,9 @@ public override bool Equals(object obj)
}
///
- /// Erzeugt einen Hash aus den gegebenen Daten
+ /// Create a hash for file and class name.
///
- /// Hashcode
+ /// hash code
public override int GetHashCode()
{
return File.GetHashCode() ^ ClassName.GetHashCode();
diff --git a/SimulationCore/Simulation/PlayerSimulationVersion.cs b/SimulationCore/Simulation/PlayerSimulationVersion.cs
index 3e4fa94..bf650a3 100644
--- a/SimulationCore/Simulation/PlayerSimulationVersion.cs
+++ b/SimulationCore/Simulation/PlayerSimulationVersion.cs
@@ -10,27 +10,27 @@ public enum PlayerSimulationVersions
{
///
- /// Version 1.1 - Singleplayer-Variante
+ /// Version 1.1 - singleplayer version
///
Version_1_1 = 1,
///
- /// Version 1.5 - war nur als Beta verfĂŒgbar und stellt die erste Multiplayer-Variante dar
+ /// Version 1.5 - first multiplayer version, beta only
///
Version_1_5 = 2,
///
- /// Version 1.6 - die Basis fĂŒr die erste Online-Version
+ /// Version 1.6 - base for firs online version
///
Version_1_6 = 4,
///
- /// fx 4.0 Port of Version 1.6
+ /// fx 4.0 Port of version 1.6
///
Version_1_7 = 8,
///
- /// Version 2.0 - Bisher nicht vorhanden
+ /// Version 2.0 - not available right now
///
Version_2_0 = 16
}
diff --git a/SimulationCore/Simulation/PlayerStatistics.cs b/SimulationCore/Simulation/PlayerStatistics.cs
index c3828a5..739dc56 100644
--- a/SimulationCore/Simulation/PlayerStatistics.cs
+++ b/SimulationCore/Simulation/PlayerStatistics.cs
@@ -3,55 +3,55 @@
namespace AntMe.Simulation
{
///
- /// Speichert die Statistik eines Spielers.
+ /// Saves statistics of player.
///
[Serializable]
public struct PlayerStatistics
{
///
- /// Die aktuelle Anzahl an Ameisen.
+ /// Current ant count.
///
public int CurrentAntCount;
private int LoopCount;
///
- /// Die Anzahl der durch eigene Ameisen besiegten feindlichen Ameisen.
+ /// Number of killed enemy ants defeated by players ants.
///
public int KilledAnts;
///
- /// Die Anzahl der besiegten Wanzen.
+ /// Number of killed bugs defeated by players ants.
///
public int KilledBugs;
///
- /// Die Anzahl der gesammelten Nahrungspunkte.
+ /// Sum of collected food points.
///
public int CollectedFood;
///
- /// Anzahl gesammeltem Obst.
+ /// Number of collected fruits.
///
public int CollectedFruits;
///
- /// Die Anzahl der verhungerten Ameisen.
+ /// Sum of starved ants.
///
public int StarvedAnts;
///
- /// Die Anzahl der von feindlichen Ameisen besiegten eigenen Ameisen.
+ /// Number of beaten ants defeated by the enemy.
///
public int BeatenAnts;
///
- /// Die Anzahl der von Wanzen gefressenen Ameisen.
+ /// Number of ants eaten by bugs.
///
public int EatenAnts;
///
- /// Gibt die Gesamtpunktzahl zurĂŒck.
+ /// Sum of all points.
///
public int Points
{
@@ -70,10 +70,10 @@ public int Points
}
///
- /// ZĂ€hlt zwei Statistiken zusammen.
+ /// Sums up two statistics of the same player.
///
- /// Statistik 1.
- /// Statistik 2.
+ /// statistics 1
+ /// statistics 2
/// Statistik 1 + Statistik 2.
public static PlayerStatistics
operator +(PlayerStatistics s1, PlayerStatistics s2)
diff --git a/SimulationCore/Simulation/RuleViolationException.cs b/SimulationCore/Simulation/RuleViolationException.cs
index 9fb9ef2..1371435 100644
--- a/SimulationCore/Simulation/RuleViolationException.cs
+++ b/SimulationCore/Simulation/RuleViolationException.cs
@@ -5,34 +5,34 @@
namespace AntMe.Simulation
{
///
- /// Wird bei einer Regelverletzung der AntMe-Spielregeln geworfen
+ /// Is thrown for a violation of the AntMe game rules
///
[Serializable]
public sealed class RuleViolationException : AntMeException
{
///
- /// KOnstruktor der Regelverletzung ohne weitere Angaben
+ /// Constructor of the rule violation without further details
///
public RuleViolationException() { }
///
- /// Konsruktor der Regelverletzung mit der Übergabe einer Beschreibung zur Verletzung
+ /// Constructor of the rule violation with the transfer of a description of the violation
///
- /// Beschreibung der Regelverletzung
+ /// description of the violation
public RuleViolationException(string message) : base(message) { }
///
- /// Konstruktor zur Regelverletung mit übergabe einer Nachricht sowie einer verursachenden Exception
+ /// Constructor for rule invalidation with passing of a message and the inner exception
///
- /// Beschreibung zum Problem
- /// Verursachende Exception
+ /// description of the violation
+ /// causing exception
public RuleViolationException(string message, Exception innerException) : base(message, innerException) { }
///
- /// Konstruktor für die Serialisierung dieser Exception
+ /// Constructor for serialization of this exception
///
- ///
- ///
+ /// information
+ /// context
public RuleViolationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
\ No newline at end of file
diff --git a/SimulationCore/Simulation/SimulationCasteSettingsColumn.cs b/SimulationCore/Simulation/SimulationCasteSettingsColumn.cs
index 45019d4..0cc0033 100644
--- a/SimulationCore/Simulation/SimulationCasteSettingsColumn.cs
+++ b/SimulationCore/Simulation/SimulationCasteSettingsColumn.cs
@@ -121,66 +121,66 @@ public void RuleCheck()
if (Attack < ATTACK_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Attack (Aktuell: {0}) muss gröĂer oder gleich {1} sein", Attack, ATTACK_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Attack (Current: {0}) must be greater than or equal to {1}.", Attack, ATTACK_MINIMUM));
}
if (Attack > ATTACK_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Attack (Aktuell: {0}) muss kleiner oder gleich {1} sein", Attack, ATTACK_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Attack (Current: {0}) must be less than or equal to {1}.", Attack, ATTACK_MINIMUM));
}
if (RotationSpeed < ROTATIONSPEED_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei RotationSpeed (Aktuell: {0}) muss gröĂer oder gleich {1} sein", RotationSpeed, ROTATIONSPEED_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for RotationSpeed (Current: {0}) must be greater than or equal to {1}.", RotationSpeed, ROTATIONSPEED_MINIMUM));
}
if (RotationSpeed > ROTATIONSPEED_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei RotationSpeed (Aktuell: {0}) muss kleiner oder gleich {1} sein", RotationSpeed, ROTATIONSPEED_MAXIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for RotationSpeed (Current: {0}) must be less than or equal to {1}.", RotationSpeed, ROTATIONSPEED_MAXIMUM));
}
if (Energy < ENERGY_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Energy (Aktuell: {0}) muss gröĂer oder gleich {1} sein", Energy, ENERGY_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Energy (Current: {0}) must be greater than or equal to {1}.", Energy, ENERGY_MINIMUM));
}
if (Energy > ENERGY_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Energy (Aktuell: {0}) muss kleiner oder gleich {1} sein", Energy, ENERGY_MAXIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Energy (Current: {0}) must be less than or equal to {1}.", Energy, ENERGY_MAXIMUM));
}
if (Speed < SPEED_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Speed (Aktuell: {0}) muss gröĂer oder gleich {1} sein", Speed, SPEED_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Speed (Current: {0}) must be greater than or equal to {1}.", Speed, SPEED_MINIMUM));
}
if (Speed > SPEED_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Speed (Aktuell: {0}) muss kleiner oder gleich {1} sein", Speed, SPEED_MAXIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Speed (Current: {0}) must be less than or equal to {1}.", Speed, SPEED_MAXIMUM));
}
if (Load < LOAD_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Load (Aktuell: {0}) muss gröĂer oder gleich {1} sein", Load, LOAD_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Load (Current: {0}) must be greater than or equal to {1}.", Load, LOAD_MINIMUM));
}
if (Load > LOAD_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Load (Aktuell: {0}) muss kleiner oder gleich {1} sein", Load, LOAD_MAXIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Load (Current: {0}) must be less than or equal to {1}.", Load, LOAD_MAXIMUM));
}
if (Range < RANGE_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Range (Aktuell: {0}) muss gröĂer oder gleich {1} sein", Range, RANGE_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Range (Current: {0}) must be greater than or equal to {1}.", Range, RANGE_MINIMUM));
}
if (Range > RANGE_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei Range (Aktuell: {0}) muss kleiner oder gleich {1} sein", Range, RANGE_MAXIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for Range (Current: {0}) must be less than or equal to {1}.", Range, RANGE_MAXIMUM));
}
if (ViewRange < VIEWRANGE_MINIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei ViewRange (Aktuell: {0}) muss gröĂer oder gleich {1} sein", ViewRange, VIEWRANGE_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for ViewRange (Current: {0}) must be greater than or equal to {1}.", ViewRange, VIEWRANGE_MINIMUM));
}
if (ViewRange > VIEWRANGE_MAXIMUM)
{
- throw new ConfigurationErrorsException(string.Format("Der Wert bei ViewRange (Aktuell: {0}) muss kleiner oder gleich {1} sein", ViewRange, VIEWRANGE_MINIMUM));
+ throw new ConfigurationErrorsException(string.Format("The value for ViewRange (Current: {0}) must be less than or equal to {1}.", ViewRange, VIEWRANGE_MINIMUM));
}
}
}
diff --git a/SimulationCore/Simulation/SimulationEnvironment.cs b/SimulationCore/Simulation/SimulationEnvironment.cs
index 6a40940..6907649 100644
--- a/SimulationCore/Simulation/SimulationEnvironment.cs
+++ b/SimulationCore/Simulation/SimulationEnvironment.cs
@@ -38,7 +38,7 @@ public SimulationEnvironment()
}
///
- /// Weitergabe des Verantwortungswechsels
+ /// Change responsibility player call area
///
///
///
@@ -48,9 +48,9 @@ private void playerCallAreaChanged(object sender, AreaChangeEventArgs e)
}
///
- /// Initialisiert die Simulation um mit Runde 1 zu beginnen
+ /// simulation initialisation and preparation for round one
///
- /// Konfiguration der Simulation
+ /// Configuration of simulation
///
///
///
@@ -100,7 +100,7 @@ public void Init(SimulatorConfiguration configuration)
antLimit = (int)(SimulationSettings.Custom.AntSimultaneousCount *
(1 + (SimulationSettings.Custom.AntCountPlayerMultiplier * playerCount)));
- // Spielfeld erzeugen
+ // create playground
float area = SimulationSettings.Custom.PlayGroundBaseSize;
area *= 1 + (playerCount * SimulationSettings.Custom.PlayGroundSizePlayerMultiplier);
int playgroundWidth = (int)Math.Round(Math.Sqrt(area * 4 / 3));
@@ -114,7 +114,7 @@ public void Init(SimulatorConfiguration configuration)
bugLimit = (int)(SimulationSettings.Custom.BugSimultaneousCount *
(1 + (SimulationSettings.Custom.BugCountPlayerMultiplier * playerCount)));
- // Völker erzeugen
+ // create teams
Teams = new CoreTeam[configuration.Teams.Count];
for (int i = 0; i < configuration.Teams.Count; i++)
{
@@ -122,14 +122,14 @@ public void Init(SimulatorConfiguration configuration)
Teams[i] = new CoreTeam(i, team.Guid, team.Name);
Teams[i].Colonies = new CoreColony[team.Player.Count];
- // Völker erstellen
+ // create colonies
for (int j = 0; j < team.Player.Count; j++)
{
PlayerInfo player = team.Player[j];
CoreColony colony = new CoreColony(Playground, player, Teams[i]);
Teams[i].Colonies[j] = colony;
- colony.AntHills.Add(Playground.NeuerBau(colony.Id));
+ colony.AntHills.Add(Playground.NewAnthill(colony.Id));
colony.insectCountDown = antCountDown;
}
}
@@ -140,9 +140,9 @@ public void Init(SimulatorConfiguration configuration)
#region Public Methods
///
- /// Berechnet einen neuen Spielschritt
+ /// calculations for new step in game
///
- /// Zustandskopie des Simulationsstandes nachdem der Schritt ausgefĂŒhrt wurde
+ /// state of simulation after the step
/// RuleViolationException
/// Exception
public void Step(SimulationState simulationState)
@@ -164,78 +164,77 @@ public void Step(SimulationState simulationState)
{
for (int j = 0; j < Teams[i].Colonies.Length; j++)
{
- Bugs.Grids[0].Add(Teams[i].Colonies[j].Insects);
+ Bugs.Grids[0].Add(Teams[i].Colonies[j].InsectsList);
}
}
- // Lasse die Wanzen von der Spiel Befehle entgegen nehmen.
- //foreach (CoreBug wanze in Bugs.Insects) {
- // wanze.NimmBefehleEntgegen = true;
+ // let bugs beeing controled by the game.
+ //foreach (CoreBug bug in Bugs.Insects) {
+ // bug.NimmBefehleEntgegen = true;
//}
- // Schleife ĂŒber alle Wanzen.
- for (int bugIndex = 0; bugIndex < Bugs.Insects.Count; bugIndex++)
+ // Loop over all the bugs.
+ for (int bugIndex = 0; bugIndex < Bugs.InsectsList.Count; bugIndex++)
{
- CoreBug bug = Bugs.Insects[bugIndex] as CoreBug;
+ CoreBug bug = Bugs.InsectsList[bugIndex] as CoreBug;
Debug.Assert(bug != null);
- bug.NimmBefehleEntgegen = true;
+ bug.AwaitingCommands = true;
- // Finde Ameisen in Angriffsreichweite.
+ // Find ants within attack range.
List ants = Bugs.Grids[0].FindAnts(bug);
- // Bestimme wie der Schaden auf die Ameisen verteilt wird.
+ // Determine how the damage is distributed among the ants.
if (ants.Count >= SimulationSettings.Custom.BugAttack)
{
- // Es sind mehr Ameisen in der SpielUmgebung als die Wanze
- // Schadenpunke verteilen kann. Daher werden den Ameisen am
- // Anfang der Liste jeweils ein Energiepunkt abgezogen.
+ // There are more ants in the game environment than the
+ // bug can distribute damage points. Therefore, ants at
+ // the top of the list will have one energy point deducted.
for (int index = 0; index < SimulationSettings.Custom.BugAttack; index++)
{
- ants[index].AktuelleEnergieBase--;
+ ants[index].CurrentEnergyCoreInsect--;
//((Ameise)ameisen[i]).WirdAngegriffen(wanze);
PlayerCall.UnderAttack((CoreAnt)ants[index], bug);
- if (ants[index].AktuelleEnergieBase <= 0)
+ if (ants[index].CurrentEnergyCoreInsect <= 0)
{
- ants[index].colony.EatenInsects.Add(ants[index]);
+ ants[index].Colony.EatenInsects.Add(ants[index]);
}
}
}
else if (ants.Count > 0)
{
- // Bestimme die Energie die von jeder Ameise abgezogen wird.
- // Hier können natĂŒrlich Rundungsfehler auftreten, die die Wanze
- // abschwÀchen, die ignorieren wir aber.
- int schaden = SimulationSettings.Custom.BugAttack / ants.Count;
+ // Determine the energy that is subtracted from each ant.
+ // Rounding errors that weaken the bug can occur but we ignore them.
+ int damage = SimulationSettings.Custom.BugAttack / ants.Count;
for (int index = 0; index < ants.Count; index++)
{
- ants[index].AktuelleEnergieBase -= schaden;
+ ants[index].CurrentEnergyCoreInsect -= damage;
//((Ameise)ameisen[i]).WirdAngegriffen(wanze);
PlayerCall.UnderAttack((CoreAnt)ants[index], bug);
- if (ants[index].AktuelleEnergieBase <= 0)
+ if (ants[index].CurrentEnergyCoreInsect <= 0)
{
- ants[index].colony.EatenInsects.Add(ants[index]);
+ ants[index].Colony.EatenInsects.Add(ants[index]);
}
}
}
- // WĂ€hrend eines Kampfes kann die Wanze sich nicht bewegen.
+ // The bug cannot move during a fight.
if (ants.Count > 0)
{
continue;
}
- // Bewege die Wanze.
- bug.Bewegen();
- if (bug.RestStreckeBase == 0)
+ // Move the bug.
+ bug.Move();
+ if (bug.DistanceToDestinationCoreInsect == 0)
{
- bug.DreheInRichtungBase(random.Next(360));
- bug.GeheGeradeausBase(random.Next(160, 320));
+ bug.TurnToDirectionCoreInsect(random.Next(360));
+ bug.GoForwardCoreInsect(random.Next(160, 320));
}
- bug.NimmBefehleEntgegen = false;
+ bug.AwaitingCommands = false;
}
- // Verhindere, daĂ ein Spieler einer gesichteten Wanze Befehle gibt.
+ // Prevent a player from giving orders to a sighted bug.
//for(int i = 0; i < Bugs.Insects.Count; i++) {
// CoreBug wanze = Bugs.Insects[i] as CoreBug;
// if(wanze != null) {
@@ -255,188 +254,187 @@ public void Step(SimulationState simulationState)
{
CoreColony colony = Teams[teamIndex].Colonies[colonyIndex];
- // Leere alle Buckets.
- for (int casteIndex = 0; casteIndex < colony.AnzahlKasten; casteIndex++)
+ // Empty all buckets.
+ for (int casteIndex = 0; casteIndex < colony.CasteCount; casteIndex++)
{
colony.Grids[casteIndex].Clear();
}
- // FĂŒlle alle Buckets, aber befĂŒlle keinen Bucket doppelt.
- for (int casteIndex = 0; casteIndex < colony.AnzahlKasten; casteIndex++)
+ // Fill all buckets, but do not fill any bucket twice.
+ for (int casteIndex = 0; casteIndex < colony.CasteCount; casteIndex++)
{
if (colony.Grids[casteIndex].Count == 0)
{
- colony.Grids[casteIndex].Add(Bugs.Insects);
+ colony.Grids[casteIndex].Add(Bugs.InsectsList);
for (int j = 0; j < Teams.Length; j++)
{
for (int i = 0; i < Teams[j].Colonies.Length; i++)
{
CoreColony v = Teams[j].Colonies[i];
- colony.Grids[casteIndex].Add(v.Insects);
+ colony.Grids[casteIndex].Add(v.InsectsList);
}
}
}
}
- // Schleife ĂŒber alle Ameisen.
- for (int antIndex = 0; antIndex < colony.Insects.Count; antIndex++)
+ // Loop over all ants.
+ for (int antIndex = 0; antIndex < colony.InsectsList.Count; antIndex++)
{
- CoreAnt ameise = colony.Insects[antIndex] as CoreAnt;
- Debug.Assert(ameise != null);
+ CoreAnt ant = colony.InsectsList[antIndex] as CoreAnt;
+ Debug.Assert(ant != null);
- // Finde und ZĂ€hle die Insekten im Sichtkreis der Ameise.
- CoreBug wanze;
- CoreAnt feind;
- CoreAnt freund;
+ // Find and count the insects in the ant's field of vision.
+ CoreBug bug;
+ CoreAnt enemy;
+ CoreAnt friend;
CoreAnt teammember;
int bugCount, enemyAntCount, colonyAntCount, casteAntCount, teamAntCount;
- colony.Grids[ameise.CasteIndexBase].FindAndCountInsects(
- ameise,
- out wanze,
+ colony.Grids[ant.CasteIndexCoreInsect].FindAndCountInsects(
+ ant,
+ out bug,
out bugCount,
- out feind,
+ out enemy,
out enemyAntCount,
- out freund,
+ out friend,
out colonyAntCount,
out casteAntCount,
out teammember,
out teamAntCount);
- ameise.BugsInViewrange = bugCount;
- ameise.ForeignAntsInViewrange = enemyAntCount;
- ameise.FriendlyAntsInViewrange = colonyAntCount;
- ameise.FriendlyAntsFromSameCasteInViewrange = casteAntCount;
- ameise.TeamAntsInViewrange = teamAntCount;
+ ant.BugsInViewRange = bugCount;
+ ant.EnemyAntsInViewRange = enemyAntCount;
+ ant.ColonyAntsInViewRange = colonyAntCount;
+ ant.CasteAntsInViewRange = casteAntCount;
+ ant.TeamAntsInViewRange = teamAntCount;
- // Bewege die Ameise.
- ameise.Bewegen();
+ // Move the ant.
+ ant.Move();
- #region Reichweite
+ #region Range
- // Ameise hat ihre Reichweite ĂŒberschritten.
- if (ameise.ZurĂŒckgelegteStreckeI > colony.ReichweiteI[ameise.CasteIndexBase])
+ // Ant has exceeded its range. Ant dies.
+ if (ant.NumberStepsWalked > colony.RangeI[ant.CasteIndexCoreInsect])
{
- ameise.AktuelleEnergieBase = 0;
- colony.VerhungerteInsekten.Add(ameise);
+ ant.CurrentEnergyCoreInsect = 0;
+ colony.StarvedInsects.Add(ant);
continue;
}
- // Ameise hat ein Drittel ihrer Reichweite zurĂŒckgelegt.
- else if (ameise.ZurĂŒckgelegteStreckeI > colony.ReichweiteI[ameise.CasteIndexBase] / 3)
+ // Ant has covered a third of its range.
+ else if (ant.NumberStepsWalked > colony.RangeI[ant.CasteIndexCoreInsect] / 3)
{
- if (ameise.IstMĂŒdeBase == false)
+ if (ant.IsTiredCoreAnt == false)
{
- ameise.IstMĂŒdeBase = true;
- PlayerCall.BecomesTired(ameise);
+ ant.IsTiredCoreAnt = true;
+ PlayerCall.BecomesTired(ant);
}
}
#endregion
- #region Kampf
+ #region Fight
- // Rufe die Ereignisse auf, falls die Ameise nicht schon ein
- // entsprechendes Ziel hat.
- if (wanze != null && !(ameise.ZielBase is CoreBug))
+ // If the ant does not already have a corresponding target, call the events.
+ if (bug != null && !(ant.DestinationCoreInsect is CoreBug))
{
- PlayerCall.SpotsEnemy(ameise, wanze);
+ PlayerCall.SpotsEnemy(ant, bug);
}
- if (feind != null && !(ameise.ZielBase is CoreAnt) ||
- (ameise.ZielBase is CoreAnt && ((CoreAnt)ameise.ZielBase).colony == colony))
+ if (enemy != null && !(ant.DestinationCoreInsect is CoreAnt) ||
+ (ant.DestinationCoreInsect is CoreAnt && ((CoreAnt)ant.DestinationCoreInsect).Colony == colony))
{
- PlayerCall.SpotsEnemy(ameise, feind);
+ PlayerCall.SpotsEnemy(ant, enemy);
}
- if (freund != null && !(ameise.ZielBase is CoreAnt) ||
- (ameise.ZielBase is CoreAnt && ((CoreAnt)ameise.ZielBase).colony != colony))
+ if (friend != null && !(ant.DestinationCoreInsect is CoreAnt) ||
+ (ant.DestinationCoreInsect is CoreAnt && ((CoreAnt)ant.DestinationCoreInsect).Colony != colony))
{
- PlayerCall.SpotsFriend(ameise, freund);
+ PlayerCall.SpotsFriend(ant, friend);
}
- if (teammember != null && !(ameise.ZielBase is CoreAnt) ||
- (ameise.ZielBase is CoreAnt && ((CoreAnt)ameise.ZielBase).colony != colony))
+ if (teammember != null && !(ant.DestinationCoreInsect is CoreAnt) ||
+ (ant.DestinationCoreInsect is CoreAnt && ((CoreAnt)ant.DestinationCoreInsect).Colony != colony))
{
- PlayerCall.SpotsTeamMember(ameise, teammember);
+ PlayerCall.SpotsTeamMember(ant, teammember);
}
- // Kampf mit Wanze.
- if (ameise.ZielBase is CoreBug)
+ // Fight with a bug.
+ if (ant.DestinationCoreInsect is CoreBug)
{
- CoreBug k = (CoreBug)ameise.ZielBase;
- if (k.AktuelleEnergieBase > 0)
+ CoreBug k = (CoreBug)ant.DestinationCoreInsect;
+ if (k.CurrentEnergyCoreInsect > 0)
{
- int entfernung =
- CoreCoordinate.BestimmeEntfernungI(ameise.CoordinateBase, ameise.ZielBase.CoordinateBase);
- if (entfernung < SimulationSettings.Custom.BattleRange * PLAYGROUND_UNIT)
+ int distance =
+ CoreCoordinate.DetermineDistanceI(ant.CoordinateCoreInsect, ant.DestinationCoreInsect.CoordinateCoreInsect);
+ if (distance < SimulationSettings.Custom.BattleRange * PLAYGROUND_UNIT)
{
- k.AktuelleEnergieBase -= ameise.AngriffBase;
- if (k.AktuelleEnergieBase <= 0)
+ k.CurrentEnergyCoreInsect -= ant.AttackStrengthCoreInsect;
+ if (k.CurrentEnergyCoreInsect <= 0)
{
Bugs.EatenInsects.Add(k);
- colony.Statistik.KilledBugs++;
- ameise.BleibStehenBase();
+ colony.Statistic.KilledBugs++;
+ ant.StopMovementCoreInsect();
}
}
}
else
{
- ameise.ZielBase = null;
+ ant.DestinationCoreInsect = null;
}
}
- // Kampf mit feindlicher Ameise.
- else if (ameise.ZielBase is CoreAnt)
+ // Fight with an enemy ant.
+ else if (ant.DestinationCoreInsect is CoreAnt)
{
- CoreAnt a = (CoreAnt)ameise.ZielBase;
- if (a.colony != colony && a.AktuelleEnergieBase > 0)
+ CoreAnt a = (CoreAnt)ant.DestinationCoreInsect;
+ if (a.Colony != colony && a.CurrentEnergyCoreInsect > 0)
{
- int entfernung =
- CoreCoordinate.BestimmeEntfernungI(ameise.CoordinateBase, ameise.ZielBase.CoordinateBase);
- if (entfernung < SimulationSettings.Custom.BattleRange * PLAYGROUND_UNIT)
+ int distance =
+ CoreCoordinate.DetermineDistanceI(ant.CoordinateCoreInsect, ant.DestinationCoreInsect.CoordinateCoreInsect);
+ if (distance < SimulationSettings.Custom.BattleRange * PLAYGROUND_UNIT)
{
- PlayerCall.UnderAttack(a, ameise);
- a.AktuelleEnergieBase -= ameise.AngriffBase;
- if (a.AktuelleEnergieBase <= 0)
+ PlayerCall.UnderAttack(a, ant);
+ a.CurrentEnergyCoreInsect -= ant.AttackStrengthCoreInsect;
+ if (a.CurrentEnergyCoreInsect <= 0)
{
- a.colony.BeatenInsects.Add(a);
- colony.Statistik.KilledAnts++;
- ameise.BleibStehenBase();
+ a.Colony.BeatenInsects.Add(a);
+ colony.Statistic.KilledAnts++;
+ ant.StopMovementCoreInsect();
}
}
}
else
{
- ameise.ZielBase = null;
+ ant.DestinationCoreInsect = null;
}
}
#endregion
- // PrĂŒfe ob die Ameise an ihrem Ziel angekommen ist.
- if (ameise.AngekommenBase)
+ // Check if the ant has reached its destination.
+ if (ant.ArrivedCoreInsect)
{
- ameiseUndZiel(ameise);
+ antAndTarget(ant);
}
- // PrĂŒfe ob die Ameise einen Zuckerhaufen oder ein ObststĂŒck sieht.
- ameiseUndZucker(ameise);
- if (ameise.GetragenesObstBase == null)
+ // Check if the ant sees a pile of sugar or a fruit.
+ antAndSugar(ant);
+ if (ant.CarryingFruitCoreInsect == null)
{
- ameiseUndObst(ameise);
+ antAndFruit(ant);
}
- // PrĂŒfe ob die Ameise eine Markierung bemerkt.
- ameiseUndMarkierungen(ameise);
+ // Check whether the ant notices a mark.
+ antAndMarkers(ant);
- if (ameise.ZielBase == null && ameise.RestStreckeBase == 0)
+ if (ant.DestinationCoreInsect == null && ant.DistanceToDestinationCoreInsect == 0)
{
- PlayerCall.Waits(ameise);
+ PlayerCall.Waits(ant);
}
- PlayerCall.Tick(ameise);
+ PlayerCall.Tick(ant);
}
removeAnt(colony);
spawnAnt(colony);
- aktualisiereMarkierungen(colony);
+ updateMarkers(colony);
removeFruit(colony);
}
}
@@ -451,9 +449,9 @@ public void Step(SimulationState simulationState)
#endregion
- bewegeObstUndInsekten();
+ MoveFruitsAndInsects();
- erzeugeZustand(simulationState);
+ GenerateState(simulationState);
}
#endregion
@@ -461,33 +459,33 @@ public void Step(SimulationState simulationState)
#region Helpermethods
///
- /// Erzeugt einen Zustand aus dem aktuellen Spielumstand
+ /// Creates a state from the current game state
///
- /// aktueller Spielstand
- private void erzeugeZustand(SimulationState zustand)
+ /// current game state
+ private void GenerateState(SimulationState simulationState)
{
- zustand.PlaygroundWidth = Playground.Width;
- zustand.PlaygroundHeight = Playground.Height;
- zustand.CurrentRound = currentRound;
+ simulationState.PlaygroundWidth = Playground.Width;
+ simulationState.PlaygroundHeight = Playground.Height;
+ simulationState.CurrentRound = currentRound;
for (int i = 0; i < Teams.Length; i++)
{
- zustand.TeamStates.Add(Teams[i].CreateState());
+ simulationState.TeamStates.Add(Teams[i].CreateState());
}
- for (int i = 0; i < Bugs.Insects.Count; i++)
+ for (int i = 0; i < Bugs.InsectsList.Count; i++)
{
- zustand.BugStates.Add(((CoreBug)Bugs.Insects[i]).ErzeugeInfo());
+ simulationState.BugStates.Add(((CoreBug)Bugs.InsectsList[i]).GenerateInformation());
}
- for (int i = 0; i < Playground.SugarHills.Count; i++)
+ for (int i = 0; i < Playground.SugarHillsList.Count; i++)
{
- zustand.SugarStates.Add(Playground.SugarHills[i].CreateState());
+ simulationState.SugarStates.Add(Playground.SugarHillsList[i].CreateState());
}
- for (int i = 0; i < Playground.Fruits.Count; i++)
+ for (int i = 0; i < Playground.FruitsList.Count; i++)
{
- zustand.FruitStates.Add(Playground.Fruits[i].ErzeugeInfo());
+ simulationState.FruitStates.Add(Playground.FruitsList[i].GenerateInformation());
}
}
diff --git a/SimulationCore/Simulation/SimulationEnvironmentHelper.cs b/SimulationCore/Simulation/SimulationEnvironmentHelper.cs
index babdb77..0de2f95 100644
--- a/SimulationCore/Simulation/SimulationEnvironmentHelper.cs
+++ b/SimulationCore/Simulation/SimulationEnvironmentHelper.cs
@@ -42,66 +42,66 @@ private static void precalculateAngles()
Cos = new int[max + 1, 360];
Sin = new int[max + 1, 360];
- // Cosinus und Sinus Werte vorberechnen.
+ // precalculation of cosinus and sinus
for (int amplitude = 0; amplitude <= max; amplitude++)
{
- for (int winkel = 0; winkel < 360; winkel++)
+ for (int angle = 0; angle < 360; angle++)
{
- Cos[amplitude, winkel] =
- (int)Math.Round(amplitude * Math.Cos(winkel * Math.PI / 180d));
- Sin[amplitude, winkel] =
- (int)Math.Round(amplitude * Math.Sin(winkel * Math.PI / 180d));
+ Cos[amplitude, angle] =
+ (int)Math.Round(amplitude * Math.Cos(angle * Math.PI / 180d));
+ Sin[amplitude, angle] =
+ (int)Math.Round(amplitude * Math.Sin(angle * Math.PI / 180d));
}
}
}
- public static int Cosinus(int amplitude, int winkel)
+ public static int Cosinus(int amplitude, int angle)
{
- return (int)Math.Round(amplitude * Math.Cos(winkel * Math.PI / 180d));
+ return (int)Math.Round(amplitude * Math.Cos(angle * Math.PI / 180d));
}
- public static int Sinus(int amplitude, int winkel)
+ public static int Sinus(int amplitude, int angle)
{
- return (int)Math.Round(amplitude * Math.Sin(winkel * Math.PI / 180d));
+ return (int)Math.Round(amplitude * Math.Sin(angle * Math.PI / 180d));
}
#endregion
- #region sugar-handling
+ #region sugar handling
///
- /// Delay-counter for sugar-respawn.
+ /// sugar respawn delay counter
///
private int sugarDelay;
///
- /// Counts down the total number of allowed sugar-hills.
+ /// Countdown number of total allowed sugar hills
///
private int sugarCountDown;
///
- /// Gets the count of simultaneous existing sugar-hills.
+ /// number of simultaneous existing sugar hills.
///
private int sugarLimit;
///
- /// Removes all empty sugar-hills from list.
+ /// Removes all empty sugar hills from list.
///
private void removeSugar()
{
// TODO: speedup
//List gemerkterZucker = new List();
- for (int i = 0; i < Playground.SugarHills.Count; i++)
+ for (int i = 0; i < Playground.SugarHillsList.Count; i++)
{
- CoreSugar zucker = Playground.SugarHills[i];
- if (zucker != null)
+ CoreSugar sugar = Playground.SugarHillsList[i];
+ if (sugar != null)
{
- if (zucker.Menge == 0)
+ if (sugar.Amount == 0)
{
//gemerkterZucker.Add(zucker);
- //Löschen
- Playground.EntferneZucker(zucker);
+ // Remove Sugar.
+ Playground.RemoveSugar(sugar);
i--;
}
}
@@ -120,13 +120,13 @@ private void removeSugar()
///
private void spawnSugar()
{
- if (Playground.SugarHills.Count < sugarLimit &&
+ if (Playground.SugarHillsList.Count < sugarLimit &&
sugarDelay <= 0 &&
sugarCountDown > 0)
{
sugarDelay = SimulationSettings.Custom.SugarRespawnDelay;
sugarCountDown--;
- Playground.NeuerZucker();
+ Playground.NewSugar();
}
sugarDelay--;
}
@@ -147,7 +147,7 @@ private void spawnSugar()
private int fruitCountDown;
///
- /// Gets the count of simultaneous existing fruits.
+ /// Gets the number of simultaneous existing fruits.
///
private int fruitLimit;
@@ -156,13 +156,13 @@ private void spawnSugar()
///
private void spawnFruit()
{
- if (Playground.Fruits.Count < fruitLimit &&
+ if (Playground.FruitsList.Count < fruitLimit &&
fruitDelay <= 0 &&
fruitCountDown > 0)
{
fruitDelay = SimulationSettings.Custom.FruitRespawnDelay;
fruitCountDown--;
- Playground.NeuesObst();
+ Playground.NewFruit();
}
fruitDelay--;
}
@@ -174,37 +174,37 @@ private void spawnFruit()
private void removeFruit(CoreColony colony)
{
//List gemerktesObst = new List();
- for (int j = 0; j < Playground.Fruits.Count; j++)
+ for (int j = 0; j < Playground.FruitsList.Count; j++)
{
- CoreFruit obst = Playground.Fruits[j];
+ CoreFruit fruit = Playground.FruitsList[j];
for (int i = 0; i < colony.AntHills.Count; i++)
{
- CoreAnthill bau = colony.AntHills[i];
- if (bau != null)
+ CoreAnthill anthill = colony.AntHills[i];
+ if (anthill != null)
{
- int entfernung = CoreCoordinate.BestimmeEntfernungI(obst.CoordinateBase, bau.CoordinateBase);
- if (entfernung <= PLAYGROUND_UNIT)
+ int distanceI = CoreCoordinate.DetermineDistanceI(fruit.CoordinateCoreInsect, anthill.CoordinateCoreInsect);
+ if (distanceI <= PLAYGROUND_UNIT)
{
//gemerktesObst.Add(obst);
- // Löschen
- colony.Statistik.CollectedFood += obst.Menge;
- colony.Statistik.CollectedFruits++;
- obst.Menge = 0;
- for (int z = 0; z < obst.TragendeInsekten.Count; z++)
+ // Delete
+ colony.Statistic.CollectedFood += fruit.Amount;
+ colony.Statistic.CollectedFruits++;
+ fruit.Amount = 0;
+ for (int z = 0; z < fruit.InsectsCarrying.Count; z++)
{
- CoreInsect insect = obst.TragendeInsekten[z];
+ CoreInsect insect = fruit.InsectsCarrying[z];
if (insect != null)
{
- insect.GetragenesObstBase = null;
- insect.AktuelleLastBase = 0;
- insect.RestStreckeI = 0;
- insect.RestWinkelBase = 0;
- insect.GeheZuBauBase();
+ insect.CarryingFruitCoreInsect = null;
+ insect.CurrentLoadCoreInsect = 0;
+ insect.DistanceToDestination = 0;
+ insect.ResidualAngle = 0;
+ insect.GoToAnthillCoreInsect();
}
}
- obst.TragendeInsekten.Clear();
- Playground.EntferneObst(obst);
+ fruit.InsectsCarrying.Clear();
+ Playground.RemoveFruit(fruit);
j--;
}
}
@@ -223,69 +223,69 @@ private void removeFruit(CoreColony colony)
private int antLimit;
///
- /// Prüft ob eine Ameise an ihrem Ziel angekommen ist.
+ /// Checks whether an ant has arrived at its destination.
///
- /// betroffene Ameise
- private static void ameiseUndZiel(CoreAnt ant)
+ /// ant
+ private static void antAndTarget(CoreAnt ant)
{
- // Ameisenbau.
- if (ant.ZielBase is CoreAnthill)
+ // Ant hill.
+ if (ant.DestinationCoreInsect is CoreAnthill)
{
- if (ant.GetragenesObstBase == null)
+ if (ant.CarryingFruitCoreInsect == null)
{
- ant.ZurückgelegteStreckeI = 0;
- ant.ZielBase = null;
+ ant.NumberStepsWalked = 0;
+ ant.DestinationCoreInsect = null;
ant.SmelledMarker.Clear();
- ant.colony.Statistik.CollectedFood += ant.AktuelleLastBase;
- ant.AktuelleLastBase = 0;
- ant.AktuelleEnergieBase = ant.MaximaleEnergieBase;
- ant.IstMüdeBase = false;
+ ant.Colony.Statistic.CollectedFood += ant.CurrentLoadCoreInsect;
+ ant.CurrentLoadCoreInsect = 0;
+ ant.CurrentEnergyCoreInsect = ant.MaximumEnergyCoreInsect;
+ ant.IsTiredCoreAnt = false;
}
}
- // Zuckerhaufen.
- else if (ant.ZielBase is CoreSugar)
+ // Sugar hill.
+ else if (ant.DestinationCoreInsect is CoreSugar)
{
- CoreSugar zucker = (CoreSugar)ant.ZielBase;
- ant.ZielBase = null;
- if (zucker.Menge > 0)
+ CoreSugar sugar = (CoreSugar)ant.DestinationCoreInsect;
+ ant.DestinationCoreInsect = null;
+ if (sugar.Amount > 0)
{
- PlayerCall.TargetReached(ant, zucker);
+ PlayerCall.TargetReached(ant, sugar);
}
}
- // Obststück.
- else if (ant.ZielBase is CoreFruit)
+ // Fruit.
+ else if (ant.DestinationCoreInsect is CoreFruit)
{
- CoreFruit obst = (CoreFruit)ant.ZielBase;
- ant.ZielBase = null;
- if (obst.Menge > 0)
+ CoreFruit fruit = (CoreFruit)ant.DestinationCoreInsect;
+ ant.DestinationCoreInsect = null;
+ if (fruit.Amount > 0)
{
- PlayerCall.TargetReached(ant, obst);
+ PlayerCall.TargetReached(ant, fruit);
}
}
- // Insekt.
- else if (ant.ZielBase is CoreInsect) { }
+ // Insect.
+ else if (ant.DestinationCoreInsect is CoreInsect) { }
- // Anderes Ziel.
+ // Other target.
else
{
- ant.ZielBase = null;
+ ant.DestinationCoreInsect = null;
}
}
///
- /// Prüft ob eine Ameise einen Zuckerhaufen sieht.
+ /// Check whether an ant sees a sugar pile.
///
- /// betroffene Ameise
- private void ameiseUndZucker(CoreAnt ant)
+ /// ant
+ private void antAndSugar(CoreAnt ant)
{
- for (int i = 0; i < Playground.SugarHills.Count; i++)
+ for (int i = 0; i < Playground.SugarHillsList.Count; i++)
{
- CoreSugar sugar = Playground.SugarHills[i];
- int entfernung = CoreCoordinate.BestimmeEntfernungI(ant.CoordinateBase, sugar.CoordinateBase);
- if (ant.ZielBase != sugar && entfernung <= ant.SichtweiteI)
+ CoreSugar sugar = Playground.SugarHillsList[i];
+ int distanceI = CoreCoordinate.DetermineDistanceI(ant.CoordinateCoreInsect, sugar.CoordinateCoreInsect);
+ if (ant.DestinationCoreInsect != sugar && distanceI <= ant.ViewRangeI)
{
PlayerCall.Spots(ant, sugar);
}
@@ -293,51 +293,51 @@ private void ameiseUndZucker(CoreAnt ant)
}
///
- /// Prüft ob eine Ameise ein Obsstück sieht.
+ /// Checks if an ant sees a fruit.
///
- /// betroffene Ameise
- private void ameiseUndObst(CoreAnt ameise)
+ /// ant
+ private void antAndFruit(CoreAnt ant)
{
- for (int i = 0; i < Playground.Fruits.Count; i++)
+ for (int i = 0; i < Playground.FruitsList.Count; i++)
{
- CoreFruit obst = Playground.Fruits[i];
- int entfernung = CoreCoordinate.BestimmeEntfernungI(ameise.CoordinateBase, obst.CoordinateBase);
- if (ameise.ZielBase != obst && entfernung <= ameise.SichtweiteI)
+ CoreFruit fruit = Playground.FruitsList[i];
+ int distanceI = CoreCoordinate.DetermineDistanceI(ant.CoordinateCoreInsect, fruit.CoordinateCoreInsect);
+ if (ant.DestinationCoreInsect != fruit && distanceI <= ant.ViewRangeI)
{
- PlayerCall.Spots(ameise, obst);
+ PlayerCall.Spots(ant, fruit);
}
}
}
///
- /// Prüft ob die Ameise eine Markierung bemerkt.
+ /// Check whether the ant notices a mark.
///
- /// betroffene Ameise
- private static void ameiseUndMarkierungen(CoreAnt ameise)
+ /// ant
+ private static void antAndMarkers(CoreAnt ant)
{
- CoreMarker marker = ameise.colony.Marker.FindMarker(ameise);
+ CoreMarker marker = ant.Colony.Marker.FindMarker(ant);
if (marker != null)
{
- PlayerCall.SmellsFriend(ameise, marker);
- ameise.SmelledMarker.Add(marker);
+ PlayerCall.SmellsFriend(ant, marker);
+ ant.SmelledMarker.Add(marker);
}
}
///
- /// Erntfernt Ameisen die keine Energie mehr haben.
+ /// Removes ants that have no more energy.
///
- /// betroffenes Volk
+ /// colony
private void removeAnt(CoreColony colony)
{
- List liste = new List();
+ List listAnts = new List();
- for (int i = 0; i < colony.VerhungerteInsekten.Count; i++)
+ for (int i = 0; i < colony.StarvedInsects.Count; i++)
{
- CoreAnt ant = colony.VerhungerteInsekten[i] as CoreAnt;
- if (ant != null && !liste.Contains(ant))
+ CoreAnt ant = colony.StarvedInsects[i] as CoreAnt;
+ if (ant != null && !listAnts.Contains(ant))
{
- liste.Add(ant);
- colony.Statistik.StarvedAnts++;
+ listAnts.Add(ant);
+ colony.Statistic.StarvedAnts++;
PlayerCall.HasDied(ant, CoreKindOfDeath.Starved);
}
}
@@ -345,10 +345,10 @@ private void removeAnt(CoreColony colony)
for (int i = 0; i < colony.EatenInsects.Count; i++)
{
CoreAnt ant = colony.EatenInsects[i] as CoreAnt;
- if (ant != null && !liste.Contains(ant))
+ if (ant != null && !listAnts.Contains(ant))
{
- liste.Add(ant);
- colony.Statistik.EatenAnts++;
+ listAnts.Add(ant);
+ colony.Statistic.EatenAnts++;
PlayerCall.HasDied(ant, CoreKindOfDeath.Eaten);
}
}
@@ -358,80 +358,80 @@ private void removeAnt(CoreColony colony)
CoreAnt ant = colony.BeatenInsects[i] as CoreAnt;
if (ant != null)
{
- if (!liste.Contains(ant))
+ if (!listAnts.Contains(ant))
{
- liste.Add(ant);
- colony.Statistik.BeatenAnts++;
+ listAnts.Add(ant);
+ colony.Statistic.BeatenAnts++;
PlayerCall.HasDied(ant, CoreKindOfDeath.Beaten);
}
}
}
- for (int i = 0; i < liste.Count; i++)
+ for (int i = 0; i < listAnts.Count; i++)
{
- CoreAnt ant = liste[i];
+ CoreAnt ant = listAnts[i];
if (ant != null)
{
- colony.EntferneInsekt(ant);
+ colony.RemoveInsect(ant);
- for (int j = 0; j < Playground.Fruits.Count; j++)
+ for (int j = 0; j < Playground.FruitsList.Count; j++)
{
- CoreFruit fruit = Playground.Fruits[j];
- fruit.TragendeInsekten.Remove(ant);
+ CoreFruit fruit = Playground.FruitsList[j];
+ fruit.InsectsCarrying.Remove(ant);
}
}
}
- colony.VerhungerteInsekten.Clear();
+ colony.StarvedInsects.Clear();
colony.EatenInsects.Clear();
colony.BeatenInsects.Clear();
}
///
- /// Erzeugt neue Ameisen.
+ /// Spawn new ant.
///
- /// betroffenes Volk
+ /// colony
private void spawnAnt(CoreColony colony)
{
- if (colony.Insects.Count < antLimit &&
+ if (colony.InsectsList.Count < antLimit &&
colony.insectDelay < 0 &&
colony.insectCountDown > 0)
{
- colony.NeuesInsekt(random);
+ colony.NewInsect(random);
colony.insectDelay = SimulationSettings.Custom.AntRespawnDelay;
colony.insectCountDown--;
}
colony.insectDelay--;
}
- // Bewegt Obsstücke und alle Insekten die das Obsstück tragen.
- private void bewegeObstUndInsekten()
+ // Moves fruit and all insects that carry the fruit.
+ private void MoveFruitsAndInsects()
{
- Playground.Fruits.ForEach(delegate (CoreFruit fruit)
+ Playground.FruitsList.ForEach(delegate (CoreFruit fruit)
{
- if (fruit.TragendeInsekten.Count > 0)
+ if (fruit.InsectsCarrying.Count > 0)
{
int dx = 0;
int dy = 0;
int last = 0;
- fruit.TragendeInsekten.ForEach(delegate (CoreInsect insect)
+ fruit.InsectsCarrying.ForEach(delegate (CoreInsect insect)
{
- if (insect.ZielBase != fruit && insect.RestWinkelBase == 0)
+ if (insect.DestinationCoreInsect != fruit && insect.ResidualAngle == 0)
{
- dx += Cos[insect.aktuelleGeschwindigkeitI, insect.RichtungBase];
- dy += Sin[insect.aktuelleGeschwindigkeitI, insect.RichtungBase];
- last += insect.AktuelleLastBase;
+ dx += Cos[insect.currentSpeedICoreInsect, insect.GetDirectionCoreInsect()];
+ dy += Sin[insect.currentSpeedICoreInsect, insect.GetDirectionCoreInsect()];
+ last += insect.CurrentLoadCoreInsect;
}
});
- last = Math.Min((int)(last * SimulationSettings.Custom.FruitLoadMultiplier), fruit.Menge);
- dx = dx * last / fruit.Menge / fruit.TragendeInsekten.Count;
- dy = dy * last / fruit.Menge / fruit.TragendeInsekten.Count;
+ last = Math.Min((int)(last * SimulationSettings.Custom.FruitLoadMultiplier), fruit.Amount);
+ dx = dx * last / fruit.Amount / fruit.InsectsCarrying.Count;
+ dy = dy * last / fruit.Amount / fruit.InsectsCarrying.Count;
- fruit.CoordinateBase = new CoreCoordinate(fruit.CoordinateBase, dx, dy);
- fruit.TragendeInsekten.ForEach(
- delegate (CoreInsect insect) { insect.CoordinateBase = new CoreCoordinate(insect.CoordinateBase, dx, dy); });
+ fruit.CoordinateCoreInsect = new CoreCoordinate(fruit.CoordinateCoreInsect, dx, dy);
+ fruit.InsectsCarrying.ForEach(
+ delegate (CoreInsect insect) { insect.CoordinateCoreInsect = new CoreCoordinate(insect.CoordinateCoreInsect, dx, dy); });
}
});
//foreach(CoreFruit obst in Playground.Fruits) {
@@ -467,29 +467,29 @@ private void bewegeObstUndInsekten()
#region marker-handling
///
- /// Entfernt abgelaufene Markierungen und erzeugt neue Markierungen.
+ /// Removes expired markers and creates new markers.
///
- /// betroffenes Volk
- private static void aktualisiereMarkierungen(CoreColony colony)
+ /// colony
+ private static void updateMarkers(CoreColony colony)
{
- // TODO: Settings berücksichtigen
- // Markierungen aktualisieren und inaktive Markierungen löschen.
- List gemerkteMarkierungen = new List();
+ // TODO: Settings beruecksichtigen
+ // Update markers and delete inactive markers.
+ List rememberedMarkers = new List();
- foreach (CoreMarker markierung in colony.Marker)
+ foreach (CoreMarker marker in colony.Marker)
{
- if (markierung.IstAktiv)
+ if (marker.IsActive)
{
- markierung.Aktualisieren();
+ marker.Update();
}
else
{
- gemerkteMarkierungen.Add(markierung);
+ rememberedMarkers.Add(marker);
}
}
- gemerkteMarkierungen.ForEach(delegate (CoreMarker marker)
+ rememberedMarkers.ForEach(delegate (CoreMarker marker)
{
- colony.Insects.ForEach(delegate (CoreInsect insect)
+ colony.InsectsList.ForEach(delegate (CoreInsect insect)
{
CoreAnt ant = insect as CoreAnt;
if (ant != null)
@@ -498,25 +498,25 @@ private static void aktualisiereMarkierungen(CoreColony colony)
}
});
});
- colony.Marker.Remove(gemerkteMarkierungen);
+ colony.Marker.Remove(rememberedMarkers);
- // Neue Markierungen überprüfen und hinzufügen.
- gemerkteMarkierungen.Clear();
+ // Check and add new markers.
+ rememberedMarkers.Clear();
colony.NewMarker.ForEach(delegate (CoreMarker newMarker)
{
- bool zuNah = false;
- foreach (CoreMarker markierung in colony.Marker)
+ bool tooNear = false;
+ foreach (CoreMarker marker in colony.Marker)
{
- int entfernung =
- CoreCoordinate.BestimmeEntfernungDerMittelpunkteI
- (markierung.CoordinateBase, newMarker.CoordinateBase);
- if (entfernung < SimulationSettings.Custom.MarkerDistance * PLAYGROUND_UNIT)
+ int distance =
+ CoreCoordinate.DetermineDistanceToCenter
+ (marker.CoordinateCoreInsect, newMarker.CoordinateCoreInsect);
+ if (distance < SimulationSettings.Custom.MarkerDistance * PLAYGROUND_UNIT)
{
- zuNah = true;
+ tooNear = true;
break;
}
}
- if (!zuNah)
+ if (!tooNear)
{
colony.Marker.Add(newMarker);
}
@@ -530,7 +530,7 @@ private static void aktualisiereMarkierungen(CoreColony colony)
#region bug-handling
///
- /// Gets the count of simultaneous existing bugs.
+ /// Gets the number of simultaneous existing bugs.
///
private int bugLimit;
@@ -544,7 +544,7 @@ private void removeBugs()
CoreBug bug = Bugs.EatenInsects[i] as CoreBug;
if (bug != null)
{
- Bugs.Insects.Remove(bug);
+ Bugs.InsectsList.Remove(bug);
}
}
Bugs.EatenInsects.Clear();
@@ -557,14 +557,14 @@ private void healBugs()
{
if (currentRound % SimulationSettings.Custom.BugRegenerationDelay == 0)
{
- for (int i = 0; i < Bugs.Insects.Count; i++)
+ for (int i = 0; i < Bugs.InsectsList.Count; i++)
{
- CoreBug bug = Bugs.Insects[i] as CoreBug;
+ CoreBug bug = Bugs.InsectsList[i] as CoreBug;
if (bug != null)
{
- if (bug.AktuelleEnergieBase < bug.MaximaleEnergieBase)
+ if (bug.CurrentEnergyCoreInsect < bug.MaximumEnergyCoreInsect)
{
- bug.AktuelleEnergieBase += SimulationSettings.Custom.BugRegenerationValue;
+ bug.CurrentEnergyCoreInsect += SimulationSettings.Custom.BugRegenerationValue;
}
}
}
@@ -576,11 +576,11 @@ private void healBugs()
///
private void spawnBug()
{
- if (Bugs.Insects.Count < bugLimit &&
+ if (Bugs.InsectsList.Count < bugLimit &&
Bugs.insectDelay < 0 &&
Bugs.insectCountDown > 0)
{
- Bugs.NeuesInsekt(random);
+ Bugs.NewInsect(random);
Bugs.insectDelay = SimulationSettings.Custom.BugRespawnDelay;
Bugs.insectCountDown--;
}
diff --git a/SimulationCore/Simulation/SimulationSettings.cs b/SimulationCore/Simulation/SimulationSettings.cs
index f7b0533..efb918f 100644
--- a/SimulationCore/Simulation/SimulationSettings.cs
+++ b/SimulationCore/Simulation/SimulationSettings.cs
@@ -1,12 +1,14 @@
-ï»żusing System;
+ï»żusing AntMe.English;
+using System;
using System.Configuration;
using System.IO;
+using System.Numerics;
using System.Xml.Serialization;
namespace AntMe.Simulation
{
///
- /// Simulation-Settings from application-configuration.
+ /// Simulation settings by application configuration.
///
[Serializable]
public struct SimulationSettings
@@ -14,64 +16,64 @@ public struct SimulationSettings
#region internal Varialbes
///
- /// Sets or gets the name of this settings-set.
+ /// Name of this settings.
///
public string SettingsName;
///
- /// Gets or sets Guid of that settings-set.
+ /// Guid of that settings.
///
public Guid Guid;
#region Playground
///
- /// Gets the size of the playground in SquareAntSteps.
+ /// Size of the playground in SquareAntSteps.
///
public int PlayGroundBaseSize;
///
- /// Gets the multiplier of additional playground-size per player.
+ /// Multiplier of additional playground size per player.
///
public float PlayGroundSizePlayerMultiplier;
///
- /// Gets the radius of anthills.
+ /// Radius of anthills.
///
public int AntHillRadius;
///
- /// Minimum Battle-Distance in steps between two insects.
+ /// Minimum battle distance between two insects in steps.
///
public int BattleRange;
///
- /// Displacement of the anthill form the circle point.
+ /// Random displacement circle point of anthill.
///
public float AntHillRandomDisplacement;
///
- /// Size of the spwancells.
+ /// Size of the spwancell.
///
public int SpawnCellSize;
///
- /// Radius of the restrictedzone around the anthill.
+ /// Restricted zone radius around anthill.
///
public int RestrictedZoneRadius;
///
- /// Max. distance from the farthest anthill.
+ /// Maximum distance for the farthest anthill.
///
public int FarZoneRadius;
///
- /// Decrease value for the neighbor cells if food spawns.
+ /// Decrease value for the neighbor cells if food spawning cells.
///
public float DecreaseValue;
///
- /// Value to regenerate all cells at a food spawn.
+ /// Value to regenerate all food spawning cells.
///
public float RegenerationValue;
@@ -80,102 +82,102 @@ public struct SimulationSettings
#region Livetime and Respawn
///
- /// Gets the maximum count of ants simultaneous on playground.
+ /// Maximum count of ants simultaneous on playground.
///
public int AntSimultaneousCount;
///
- /// Gets the maximum count of bugs simultaneous on playground.
+ /// Maximum count of bugs simultaneous on playground.
///
public int BugSimultaneousCount;
///
- /// Gets the maximum count of sugar simultaneous on playground.
+ /// Maximum count of sugar simultaneous on playground.
///
public int SugarSimultaneousCount;
///
- /// Gets the maximum count of fruit simultaneous on playground.
+ /// Maximum count of fruit simultaneous on playground.
///
public int FruitSimultaneousCount;
///
- /// Gets the multiplier for maximum count of bugs simultaneous on playground per player.
+ /// Multiplier for maximum count of bugs simultaneous on playground per player.
///
public float BugCountPlayerMultiplier;
///
- /// Gets the multiplier for maximum count of sugar simultaneous on playground per player.
+ /// Multiplier for maximum count of sugar simultaneous on playground per player.
///
public float SugarCountPlayerMultiplier;
///
- /// Gets the multiplier for maximum count of fruit simultaneous on playground per player.
+ /// Multiplier for maximum count of fruits simultaneous on playground per player.
///
public float FruitCountPlayerMultiplier;
///
- /// Gets the multiplier for maximum count of ants simultaneous on playground per player.
+ /// Multiplier for maximum count of ants simultaneous on playground per player.
///
public float AntCountPlayerMultiplier;
///
- /// Gets the maximum count of ants in the whole simulation.
+ /// Maximum count of ants in the whole simulation.
///
public int AntTotalCount;
///
- /// Gets the maximum count of bugs in the whole simulation.
+ /// Maximum count of bugs in the whole simulation.
///
public int BugTotalCount;
///
- /// Gets the maximum count of sugar in the whole simulation.
+ /// Maximum count of sugar in the whole simulation.
///
public int SugarTotalCount;
///
- /// Gets the maximum count of fruit in the whole simulation.
+ /// Maximum count of fruita in the whole simulation.
///
public int FruitTotalCount;
///
- /// Gets the multiplier for maximum count of ants per player in the whole simulation.
+ /// Multiplier for maximum count of ants per player in the whole simulation.
///
public float AntTotalCountPlayerMultiplier;
///
- /// Gets the multiplier for maximum count of bugs per player in the whole simulation.
+ /// Multiplier for maximum count of bugs per player in the whole simulation.
///
public float BugTotalCountPlayerMultiplier;
///
- /// Gets the multiplier for maximum count of sugar per player in the whole simulation.
+ /// Multiplier for maximum count of sugar per player in the whole simulation.
///
public float SugarTotalCountPlayerMultiplier;
///
- /// Gets the multiplier for maximum count of fruit per player in the whole simulation.
+ /// Multiplier for maximum count of fruit per player in the whole simulation.
///
public float FruitTotalCountPlayerMultiplier;
///
- /// Gets the delay for ant before next respawn in rounds.
+ /// Delay for ant before next respawn in rounds.
///
public int AntRespawnDelay;
///
- /// Gets the delay for bugs before next respawn in rounds.
+ /// Delay for bugs before next respawn in rounds.
///
public int BugRespawnDelay;
///
- /// Gets the delay for sugar before next respawn in rounds.
+ /// Delay for sugar before next respawn in rounds.
///
public int SugarRespawnDelay;
///
- /// Gets the delay for fruits before next respawn in rounds.
+ /// Delay for fruits before next respawn in rounds.
///
public int FruitRespawnDelay;
@@ -184,37 +186,37 @@ public struct SimulationSettings
#region Bugsettings
///
- /// Gets the attack-value of bugs.
+ /// Bugs attack value.
///
public int BugAttack;
///
- /// Gets the rotation speed of bugs.
+ /// Rotation speed of bugs.
///
public int BugRotationSpeed;
///
- /// Gets the energy of bugs.
+ /// Energy of bugs.
///
public int BugEnergy;
///
- /// Gets the speed of bugs.
+ /// Speed of bugs.
///
public int BugSpeed;
///
- /// Gets the attack-range of bugs.
+ /// Bug attack range.
///
public int BugRadius;
///
- /// Gets the regeneration-value of bugs.
+ /// Bug regeneration value.
///
public int BugRegenerationValue;
///
- /// Gets the delay in rounds between the regeneration-steps of bugs.
+ /// Delay in rounds between the bug regeneration steps.
///
public int BugRegenerationDelay;
@@ -223,32 +225,32 @@ public struct SimulationSettings
#region Foodstuff
///
- /// Gets the minimal amount of food in sugar-hills.
+ /// Minimal amount of food in sugar-hills.
///
public int SugarAmountMinimum;
///
- /// Gets the maximum amount of food in sugar-hills.
+ /// Maximum amount of food in sugar hills.
///
public int SugarAmountMaximum;
///
- /// Gets the minimal amount of food in fruits.
+ /// Minimal amount of food in fruits.
///
public int FruitAmountMinimum;
///
- /// Gets the maximum amount of food in fruits.
+ /// Maximum amount of food in fruits.
///
public int FruitAmountMaximum;
///
- /// Gets the multiplier for fruits between load and amount of food.
+ /// Multiplier for fruits between load and amount of food.
///
public float FruitLoadMultiplier;
///
- /// Gets the multiplier for fruits between radius and amount of food.
+ /// Multiplier for fruits between radius and amount of food.
///
public float FruitRadiusMultiplier;
@@ -257,17 +259,17 @@ public struct SimulationSettings
#region Marker
///
- /// Gets the minimal size of a marker.
+ /// Minimal size of a marker.
///
public int MarkerSizeMinimum;
///
- /// Gets the minimal allowed distance between two marker.
+ /// Minimal allowed distance between two marker.
///
public int MarkerDistance;
///
- /// Gets the maximum age in rounds of a marker.
+ /// Maximum age in rounds of a marker.
///
public int MarkerMaximumAge;
@@ -281,32 +283,32 @@ public struct SimulationSettings
public float PointsForFoodMultiplier;
///
- /// Gets the amount of points for collected fruits.
+ /// Amount of points for collected fruits.
///
public int PointsForFruits;
///
- /// Gets the amount of points for killed bugs.
+ /// Amount of points for killed bugs.
///
public int PointsForBug;
///
- /// Gets the amount of points for killed foreign ants.
+ /// Amount of points for killed foreign ants.
///
public int PointsForForeignAnt;
///
- /// Gets the amount of points for own dead ants killed by bugs.
+ /// Amount of points for own dead ants killed by bugs.
///
public int PointsForEatenAnts;
///
- /// Gets the amount of points for own dead ants killed by foreign ants.
+ /// Amount of points for own dead ants killed by foreign ants.
///
public int PointsForBeatenAnts;
///
- /// Gets the amount of points for own dead starved ants.
+ /// Amount of points for own dead starved ants.
///
public int PointsForStarvedAnts;
@@ -333,7 +335,7 @@ public struct SimulationSettings
///
- /// Gets the default settings.
+ /// Default settings.
///
public static SimulationSettings Default
{
@@ -497,7 +499,7 @@ public void SetDefaults()
}
///
- /// Checks the value-ranges of all properties.
+ /// Checks all properties against valid ranges of values
///
public void RuleCheck()
{
@@ -507,246 +509,245 @@ public void RuleCheck()
// Playground
if (PlayGroundBaseSize < 100000)
{
- throw new ConfigurationErrorsException("GrundgröĂe des Spielfeldes muss gröĂer 100.000 sein");
+ throw new ConfigurationErrorsException("Playground size must be greater than 100.000");
}
if (PlayGroundSizePlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Playground Playermultiplikator darf nicht kleiner 0 sein");
+ throw new ConfigurationErrorsException("Multiplication factor for Playground may not be smaller than 0");
}
if (AntHillRadius < 0)
{
- throw new ConfigurationErrorsException("Ameisenbau braucht einen Radius >= 0");
+ throw new ConfigurationErrorsException("Radius of anthill must be >= 0");
}
if (BattleRange < 0)
{
- throw new ConfigurationErrorsException("Angriffsradius der Wanze darf nicht kleiner 0 sein");
+ throw new ConfigurationErrorsException("Battle range for bugs may not be smaller than 0");
}
if (AntHillRandomDisplacement < 0f || AntHillRandomDisplacement > 1f)
{
- throw new ConfigurationErrorsException("Der Wert der ZufÀlligen verschiebung vom Kreispunkt muss zwischen 0.0 (0%) und 1.0 (100%) liegen.");
+ throw new ConfigurationErrorsException("The random displacement factor for the anthill must be between 0.0 (0%) and 1.0 (100%).");
}
if (SpawnCellSize < 1 && SpawnCellSize != 0)
{
- throw new ConfigurationErrorsException("Die GröĂe der Spawnzelle darf nicht kleiner 1 sein.");
+ throw new ConfigurationErrorsException("The spawn cell size may not be smaller than 1.");
}
- //ĂŒberprĂŒfen ob genug Spawnzellen da sind
+ //Check quantity of spawn cells
int cellsX = (int)Math.Ceiling((PlayGroundBaseSize * (4f / 3f)) / SpawnCellSize) - 2;
int cellsY = (int)Math.Ceiling((PlayGroundBaseSize * (3f / 4f)) / SpawnCellSize) - 2;
if (cellsX * cellsY < SugarSimultaneousCount + FruitSimultaneousCount)
{
- throw new ConfigurationErrorsException("Die GröĂe der Spawnzellen ist zu groĂ, so das es nicht gewĂ€hrleistet ist, dass genug Spawnzellen fĂŒr alle Nahrung vorhanden sind.");
+ throw new ConfigurationErrorsException("The spawn cells are to large. There might not be enough spawn cells for all the food.");
}
if (RestrictedZoneRadius < 0)
{
- throw new ConfigurationErrorsException("Der Radius der gesperrten Zone um den Ameisenbau darf nicht kleiner 0 sein.");
+ throw new ConfigurationErrorsException("The restricted zone radius around the anthills may not be samller than 0.");
}
if (FarZoneRadius < 0)
{
- throw new ConfigurationErrorsException("Der Radius der zu weit entfernten Zone darf nicht kleiner 0 sein.");
+ throw new ConfigurationErrorsException("The far zone radius may not be smaller than 0.");
}
if (DecreaseValue < 0)
{
- throw new ConfigurationErrorsException("Der verringerungs Wert fĂŒr Nachbarzellen darf nicht kleiner 0 sein");
+ throw new ConfigurationErrorsException("The decreased value for neighboring cells may not be smaller than 0.");
}
if (RegenerationValue < 0)
{
- throw new ConfigurationErrorsException("Der regenerirungs Wert aller Zellen darf nicht kleiner 0 sein");
+ throw new ConfigurationErrorsException("The regeneration value of the cells may not be smaller than 0.");
}
// Livetime and Respawn
if (AntSimultaneousCount < 0)
{
- throw new ConfigurationErrorsException("Weniger als 0 simultane Ameisen sind nicht möglich");
+ throw new ConfigurationErrorsException("It is not feasible to have less than 0 simultaneous ants.");
}
if (BugSimultaneousCount < 0)
{
- throw new ConfigurationErrorsException("Weniger als 0 simultane Wanzen sind nicht möglich");
+ throw new ConfigurationErrorsException("It is not feasible to have less than 0 simultaneous bugs.");
}
if (SugarSimultaneousCount < 0)
{
- throw new ConfigurationErrorsException("Weniger als 0 simultane Zuckerberge sind nicht möglich");
+ throw new ConfigurationErrorsException("It is not feasible to have less than 0 simultaneous sugarpiles.");
}
if (FruitSimultaneousCount < 0)
{
- throw new ConfigurationErrorsException("Weniger als 0 simultanes Obst sind nicht möglich");
+ throw new ConfigurationErrorsException("It is not feasible to have less than 0 simultaneous fruits.");
}
if (BugCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Wanzen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative bug count player multipliers.");
}
if (SugarCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Zucker ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative sugar count player multipliers.");
}
if (FruitCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative fruit count player multipliers.");
}
if (AntCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Ameisen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative ant count player multipliers.");
}
if (AntTotalCount < 0)
{
- throw new ConfigurationErrorsException("Negative Gesamtmenge bei Ameisen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative ant total count.");
}
if (BugTotalCount < 0)
{
- throw new ConfigurationErrorsException("Negative Gesamtmenge bei Wanzen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative bug total count.");
}
if (SugarTotalCount < 0)
{
- throw new ConfigurationErrorsException("Negative Gesamtmenge bei Zucker ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative sugar total count.");
}
if (FruitTotalCount < 0)
{
- throw new ConfigurationErrorsException("Negative Gesamtmenge bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative fruit total count.");
}
if (AntTotalCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Ameisen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative ant total count player multipliers.");
}
if (BugTotalCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Wanzen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative bug total count player multipliers.");
}
if (SugarTotalCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Zucker ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative sugar total count player multipliers.");
}
if (FruitTotalCountPlayerMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negative Spielermuliplikatoren bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have negative fruit total count player multipliers.");
}
-
if (AntRespawnDelay < 0)
{
- throw new ConfigurationErrorsException("Negative Respawnzeit bei Ameisen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative ant respawn delay.");
}
if (BugRespawnDelay < 0)
{
- throw new ConfigurationErrorsException("Negative Respawnzeit bei Wanzen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug respawn delay.");
}
if (SugarRespawnDelay < 0)
{
- throw new ConfigurationErrorsException("Negative Respawnzeit bei Zucker ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative sugar respawn delay.");
}
if (FruitRespawnDelay < 0)
{
- throw new ConfigurationErrorsException("Negative Respawnzeit bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative fruit respawn delay.");
}
// Bugsettings
if (BugAttack < 0)
{
- throw new ConfigurationErrorsException("Negativer Angriffswert fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug attack factor.");
}
if (BugRotationSpeed < 0)
{
- throw new ConfigurationErrorsException("Negative Rotationsgeschwindigkeit fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug rotation speed.");
}
if (BugEnergy < 0)
{
- throw new ConfigurationErrorsException("Negativer Energiewert fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug energy amount.");
}
if (BugSpeed < 0)
{
- throw new ConfigurationErrorsException("Negativer Geschwindigkeitswert fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug speed.");
}
if (BugRadius < 0)
{
- throw new ConfigurationErrorsException("Negativer Radius fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug radius.");
}
if (BugRegenerationValue < 0)
{
- throw new ConfigurationErrorsException("Negativer Regenerationswert fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug regeneration value.");
}
if (BugRegenerationDelay < 0)
{
- throw new ConfigurationErrorsException("Negativer Regenerationsdelay fĂŒr Wanzen ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative bug regeneration delay.");
}
// Foodstuff
if (SugarAmountMinimum < 0)
{
- throw new ConfigurationErrorsException("Negativer Nahrungswert bei Zucker ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative minimum sugar amount value.");
}
if (SugarAmountMaximum < 0)
{
- throw new ConfigurationErrorsException("Negativer Nahrungswert bei Zucker ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative maximum sugar amount value.");
}
if (FruitAmountMinimum < 0)
{
- throw new ConfigurationErrorsException("Negativer Nahrungswert bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative minimum fruit amount value.");
}
if (FruitAmountMaximum < 0)
{
- throw new ConfigurationErrorsException("Negativer Nahrungswert bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative maximum fruit amount value.");
}
if (FruitLoadMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negativer Loadmultiplikator bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative fruit load multiplier value.");
}
if (FruitRadiusMultiplier < 0)
{
- throw new ConfigurationErrorsException("Negativer Radiusmultiplikator bei Obst ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative fruit radius multiplier value.");
}
// Marker
if (MarkerSizeMinimum < 0)
{
- throw new ConfigurationErrorsException("Negative MinimalgröĂe bei Markierung ist nicht zulĂ€ssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative minimum marker size.");
}
if (MarkerDistance < 0)
{
- throw new ConfigurationErrorsException("Negative Mindestdistanz bei Markierung ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative marker distance value.");
}
if (MarkerMaximumAge < 0)
{
- throw new ConfigurationErrorsException("Negative maximallebensdauer bei Markierungen ist nicht zulÀssig");
+ throw new ConfigurationErrorsException("It is not feasible to have a negative maximum marker age value.");
}
// Castes
@@ -758,7 +759,7 @@ public void RuleCheck()
#region Properties
///
- /// Gets the maximal Speed of an insect.
+ /// Maximal Speed of an insect.
///
public int MaximumSpeed
{
@@ -774,15 +775,15 @@ public int MaximumSpeed
}
///
- /// Gets the maximum size of a Marker.
+ /// Maximum size of a Marker.
///
public int MaximumMarkerSize
{
get
{
- // MaximalgröĂe fĂŒr Marker ermitteln
+ // find maximum for marker size
double baseMarkerVolume = Math.Pow(SimulationSettings.Custom.MarkerSizeMinimum, 3) * (Math.PI / 2);
- baseMarkerVolume *= 10f; // GröĂenkorrektur, weil die Basisparameter zu kleine maximalgröĂe Liefern
+ baseMarkerVolume *= 10f; // correction of size, because basic parameters delivers to small maximum size
double totalMarkerVolume = baseMarkerVolume * SimulationSettings.Custom.MarkerMaximumAge;
return (int)Math.Pow(4 * ((totalMarkerVolume - baseMarkerVolume) / Math.PI), 1f / 3f);
diff --git a/SimulationCore/Simulation/Simulator.cs b/SimulationCore/Simulation/Simulator.cs
index 568c2b5..ec141ea 100644
--- a/SimulationCore/Simulation/Simulator.cs
+++ b/SimulationCore/Simulation/Simulator.cs
@@ -5,7 +5,7 @@
namespace AntMe.Simulation
{
///
- /// Represents a complete encapsulated simulation-core.
+ /// Represents a complete encapsulated simulation core.
///
/// Tom Wendel (tom@antme.net)
public sealed class Simulator : IDisposable
@@ -37,7 +37,7 @@ public sealed class Simulator : IDisposable
/// configuration
public Simulator(SimulatorConfiguration configuration)
{
- // Leere Konfiguration prüfen
+ // check configuration null
if (configuration == null)
{
throw new ArgumentNullException("configuration", Resource.SimulationCoreFactoryConfigIsNull);
@@ -78,7 +78,7 @@ public Simulator(SimulatorConfiguration configuration)
}
}
- // Regelprüfung der Konfig anwerfen
+ // check configuration against rule set
configuration.Rulecheck();
@@ -218,7 +218,7 @@ public void Unload()
#region Properties
///
- /// Gets the current simulator-state.
+ /// Gets the current simulator state.
///
public SimulatorState State
{
@@ -248,7 +248,7 @@ public long RoundTime
{
get
{
- // TODO: Deliver a bether timeformat.
+ // TODO: Deliver a better timeformat.
return roundTime;
}
}
@@ -286,7 +286,7 @@ public Dictionary PlayerRoundTimes
///
public Dictionary PlayerLoopTimes
{
- // TODO: Deliver a bether format.
+ // TODO: Deliver a better format.
get { return totalPlayerTime; }
}
diff --git a/SimulationCore/Simulation/SimulatorConfiguration.cs b/SimulationCore/Simulation/SimulatorConfiguration.cs
index 6571246..a293ff4 100644
--- a/SimulationCore/Simulation/SimulatorConfiguration.cs
+++ b/SimulationCore/Simulation/SimulatorConfiguration.cs
@@ -5,14 +5,15 @@
namespace AntMe.Simulation
{
///
- /// Klasse zur Haltung aller relevanten Konfigurationsdaten einer Simulation.
+ /// Simulator configuration class.
+ /// Holds all relevant configuration data of the simulation.
///
[Serializable]
public sealed class SimulatorConfiguration : ICloneable
{
///
- /// Maximum count of players per Simulation.
+ /// Maximum count of players per simulation.
///
public const int PLAYERLIMIT = 8;
@@ -46,15 +47,15 @@ public sealed class SimulatorConfiguration : ICloneable
///
public const int LOOPTIMEOUTMIN = 1;
- #region lokale Variablen
+ #region private attributes
- // Runden- und Spielereinstellungen
+ // Loop, round and player configuration.
private int loopCount;
private int roundCount;
private bool allowDebuginformation;
private int loopTimeout;
- // Zusätzliche Rechte anforderbar
+ // Attributes to allow access to database, filesystem, reference, user interface and network.
private bool allowDatabaseAccess;
private bool allowFileAccess;
private bool allowReferences;
@@ -62,23 +63,23 @@ public sealed class SimulatorConfiguration : ICloneable
private bool allowNetworkAccess;
///
- /// Timeout-Handling
+ /// Timeouts can be ignored.
///
private bool ignoreTimeouts;
-
private int roundTimeout;
+
private List teams;
- // Sonstiges
+ // Other settings.
private int mapInitialValue;
private SimulationSettings settings;
#endregion
- #region Initialisierung und Konstruktoren
+ #region constructors and initialization
///
- /// Initialisiert eine leere Spielerliste
+ /// Initialization with an empty list of players
///
public SimulatorConfiguration()
{
@@ -103,11 +104,11 @@ public SimulatorConfiguration()
}
///
- /// Initialsiert mit den übergebenen Werten
+ /// Initialization with given values (loops, rounds, lists with teams).
///
- /// Anzahl Durchläufe
- /// Anzahl Runden
- /// Teamliste
+ /// Number of loops.
+ /// Number of rounds.
+ /// List of teams.
public SimulatorConfiguration(int loops, int rounds, List teams)
: this()
{
@@ -122,15 +123,15 @@ public SimulatorConfiguration(int loops, int rounds, List teams)
#endregion
- #region öffentliche Methoden
+ #region public methods
///
- /// Ermittelt, ob die Angaben der Konfiguration simulationsfähig sind
+ /// Check the configuration against simulation rules.
///
- /// Regelkonformer Konfigurationsinhalt
+ /// Valid configuration.
public void Rulecheck()
{
- // Rundenanzahl prüfen
+ // Number of rounds.
if (roundCount < ROUNDSMIN)
{
throw new ConfigurationErrorsException(Resource.SimulationCoreConfigurationRoundCountTooSmall);
@@ -141,7 +142,7 @@ public void Rulecheck()
string.Format(Resource.SimulationCoreConfigurationRoundCountTooBig, ROUNDSMAX));
}
- // Durchlaufmenge prüfen
+ // Number of loops.
if (loopCount < LOOPSMIN)
{
throw new ConfigurationErrorsException(Resource.SimulationCoreConfigurationLoopCountTooSmall);
@@ -152,7 +153,7 @@ public void Rulecheck()
string.Format(Resource.SimulationCoreConfigurationLoopCountTooBig, LOOPSMAX));
}
- // Timeoutwerte
+ // Timeout values.
if (!ignoreTimeouts)
{
if (loopTimeout < LOOPTIMEOUTMIN)
@@ -167,14 +168,14 @@ public void Rulecheck()
}
}
- // Teams checken
+ // Check teams.
if (teams == null || teams.Count < 0)
{
throw new ConfigurationErrorsException(
Resource.SimulationCoreConfigurationNoTeams);
}
- // Regelcheck der Teams
+ // Check teams against rule base.
int playerCount = 0;
foreach (TeamInfo team in teams)
{
@@ -188,16 +189,16 @@ public void Rulecheck()
throw new ConfigurationErrorsException("Too many players");
}
- // Regeln für die kern-Einstellungen
+ // Checks all properties against valid ranges of values.
Settings.RuleCheck();
}
#endregion
- #region Eigenschaften
+ #region properties
///
- /// Gibt die Anzahl der Runden insgesamt an, die in der Simulation durchlaufen werden sollen oder legt diese fest.
+ /// Number of rounds for the hole simulation.
///
public int RoundCount
{
@@ -206,7 +207,7 @@ public int RoundCount
}
///
- /// Gibt die Anzahl Durchläufe insgesamt an, die in der Simulation durchlaufen werden sollen oder legt diese fest.
+ /// Number of loops for the hole simulation.
///
public int LoopCount
{
@@ -215,7 +216,7 @@ public int LoopCount
}
///
- /// Legt fest, ob die Simulation zu debugzwecken Timeouts ignorieren soll.
+ /// Timeout can be ignored (for debugging purpose).
///
public bool IgnoreTimeouts
{
@@ -224,7 +225,7 @@ public bool IgnoreTimeouts
}
///
- /// Legt die Timeout-Zeit von Runden in ms fest
+ /// Timeout for rounds in ms.
///
public int RoundTimeout
{
@@ -233,7 +234,7 @@ public int RoundTimeout
}
///
- /// Legt die Timeout-Zeit von Durchläufen in ms fest
+ /// Timeout for loops in ms.
///
public int LoopTimeout
{
@@ -242,7 +243,7 @@ public int LoopTimeout
}
///
- /// Liefert die Liste der Mitspieler in dieser Simulation.
+ /// List of players in the team in the simulation.
///
public List Teams
{
@@ -250,7 +251,7 @@ public List Teams
}
///
- /// Legt fest, ob es den Spielern erlaubt ist auf das Userinterface zuzugreifen
+ /// Grant players access to the user interface.
///
public bool AllowUserinterfaceAccess
{
@@ -259,7 +260,7 @@ public bool AllowUserinterfaceAccess
}
///
- /// Legt fest, ob es den Spielern erlaubt ist auf das Dateisystem zuzugreifen
+ /// Grant players access to the file system.
///
public bool AllowFileAccess
{
@@ -268,7 +269,7 @@ public bool AllowFileAccess
}
///
- /// Legt fest, ob es den Spielern erlaubt ist auf fremde Bibliotheken zuzugreifen
+ /// Grant players access to foreign libraries.
///
public bool AllowReferences
{
@@ -277,7 +278,7 @@ public bool AllowReferences
}
///
- /// Legt fest, ob es den Spielern erlaubt ist Datenbankverbindungen zu öffnen
+ /// Grant players access to databases.
///
public bool AllowDatabaseAccess
{
@@ -286,7 +287,7 @@ public bool AllowDatabaseAccess
}
///
- /// Legt fest, ob es den Spielern erlaubt ist eine Netzwerkverbindung zu öffnen
+ /// Grant players access to network connections.
///
public bool AllowNetworkAccess
{
@@ -295,7 +296,7 @@ public bool AllowNetworkAccess
}
///
- /// Gibt an, ob die Simulation Debuginformationen ausgeben soll
+ /// Simulation will print out debug information.
///
public bool AllowDebuginformation
{
@@ -304,8 +305,8 @@ public bool AllowDebuginformation
}
///
- /// Gibt einen Startwert für die Initialisierung des Zufallsgenerators an. Durch einen gleichen
- /// Startwert werden gleiche Startbedingungen garantiert.
+ /// A map initial value will be generated for the initialization of the random number generator.
+ /// Equal map initial values will result in identical start conditions for the simulation.
///
public int MapInitialValue
{
@@ -314,7 +315,7 @@ public int MapInitialValue
}
///
- /// Gets or sets the simulation-settings for this simulation.
+ /// Simulation settings for this simulation.
///
public SimulationSettings Settings
{
@@ -327,12 +328,12 @@ public SimulationSettings Settings
#region ICloneable Member
///
- /// Erstellt eine Kopie der Konfiguration
+ /// Clones the configuration.
///
- /// Kopie der aktuellen Konfiguration
+ /// Clone of the simulation configuration.
public object Clone()
{
- // Kopie erstellen und Spielerliste kopieren
+ // Clone configuration memberwise and copy the teams of players.
SimulatorConfiguration output = (SimulatorConfiguration)MemberwiseClone();
output.teams = new List(teams.Count);
foreach (TeamInfo team in teams)
diff --git a/SimulationCore/Simulation/SimulatorHost.cs b/SimulationCore/Simulation/SimulatorHost.cs
index 09cc95b..464b7d6 100644
--- a/SimulationCore/Simulation/SimulatorHost.cs
+++ b/SimulationCore/Simulation/SimulatorHost.cs
@@ -8,7 +8,7 @@
namespace AntMe.Simulation
{
///
- /// Class, to host an simulation-Environment inside an .
+ /// Class to host an simulation environment inside an .
///
internal sealed class SimulatorHost : MarshalByRefObject
{
@@ -28,10 +28,10 @@ internal sealed class SimulatorHost : MarshalByRefObject
#endregion
- #region Constructor and Init
+ #region Constructor and Initialization
///
- /// Initialize the simulation-environment.
+ /// Initialize the simulation environment.
///
/// configuration
public bool Init(SimulatorConfiguration config)
@@ -49,14 +49,14 @@ public bool Init(SimulatorConfiguration config)
// Load Playerfiles
foreach (TeamInfo team in configuration.Teams)
{
- foreach (PlayerInfo spieler in team.Player)
+ foreach (PlayerInfo player in team.Player)
{
- if (spieler is PlayerInfoFiledump)
+ if (player is PlayerInfoFiledump)
{
// Try, to load filedump
try
{
- spieler.assembly = Assembly.Load(((PlayerInfoFiledump)spieler).File);
+ player.assembly = Assembly.Load(((PlayerInfoFiledump)player).File);
}
catch (Exception ex)
{
@@ -64,12 +64,12 @@ public bool Init(SimulatorConfiguration config)
return false;
}
}
- else if (spieler is PlayerInfoFilename)
+ else if (player is PlayerInfoFilename)
{
// Try, to load filename
try
{
- spieler.assembly = Assembly.LoadFile(((PlayerInfoFilename)spieler).File);
+ player.assembly = Assembly.LoadFile(((PlayerInfoFilename)player).File);
}
catch (Exception ex)
{
@@ -95,7 +95,7 @@ public bool Init(SimulatorConfiguration config)
try
{
environment = new SimulationEnvironment();
- environment.AreaChange += umgebung_Verantwortungswechsel;
+ environment.AreaChange += switchEnvironmentResponsibility;
environment.Init(configuration);
}
catch (Exception ex)
@@ -126,8 +126,8 @@ public SimulatorHostState Step(ref SimulationState simulationState)
// Reset of times
stepWatch.Reset();
foreach (TeamInfo team in configuration.Teams)
- foreach (PlayerInfo spieler in team.Player)
- playerTimes[spieler.Guid] = 0;
+ foreach (PlayerInfo player in team.Player)
+ playerTimes[player.Guid] = 0;
// Init Step-Thread
exception = null;
@@ -150,7 +150,7 @@ public SimulatorHostState Step(ref SimulationState simulationState)
}
stepWatch.Stop();
- // Bei Exceptions null zurück liefern, um Fehler zu signalisieren
+ // returns null for exception to signal an error
if (exception != null)
{
return null;
@@ -209,9 +209,9 @@ private void step()
#region Eventhandler
- private void umgebung_Verantwortungswechsel(object sender, AreaChangeEventArgs e)
+ private void switchEnvironmentResponsibility(object sender, AreaChangeEventArgs e)
{
- // Aktuellen Timer stoppen
+ // stop current timer
if (currentPlayer != e.Player && currentPlayer != null)
{
playerWatch.Stop();
@@ -223,7 +223,7 @@ private void umgebung_Verantwortungswechsel(object sender, AreaChangeEventArgs e
currentArea = Area.Unknown;
}
- // Neuen Timer starten
+ // start new timer
if (e.Player != null)
{
currentPlayer = e.Player;
diff --git a/SimulationCore/Simulation/SimulatorHostState.cs b/SimulationCore/Simulation/SimulatorHostState.cs
index a6a8be0..56153d6 100644
--- a/SimulationCore/Simulation/SimulatorHostState.cs
+++ b/SimulationCore/Simulation/SimulatorHostState.cs
@@ -4,24 +4,24 @@
namespace AntMe.Simulation
{
///
- /// Statusklasse zur Weitergabe des aktuellen Spielstandes aus dem Host zurück zum Simulator
+ /// class to transfer the simulation state from the host back to the simulator
///
/// Tom Wendel (tom@antme.net)
[Serializable]
internal sealed class SimulatorHostState
{
///
- /// Auflistung der Debug Messages
+ /// List of debug messages
///
public List DebugMessages = new List();
///
- /// Gesamtzeit für die Runde
+ /// total time elapsed in the round
///
public long ElapsedRoundTime;
///
- /// Vergangene Zeiten für einzelne Spieler
+ /// total time elapsed per player
///
public Dictionary ElapsedPlayerTimes = new Dictionary();
}
diff --git a/SimulationCore/Simulation/SimulatorProxy.cs b/SimulationCore/Simulation/SimulatorProxy.cs
index 9700435..a20bfe3 100644
--- a/SimulationCore/Simulation/SimulatorProxy.cs
+++ b/SimulationCore/Simulation/SimulatorProxy.cs
@@ -8,7 +8,7 @@
namespace AntMe.Simulation
{
///
- /// Proxy-Class to host an AppDomain für the encapsulated simulation.
+ /// Proxy class to host an AppDomain for the encapsulated simulation.
///
/// Tom Wendel (tom@antme.net)
internal sealed class SimulatorProxy
@@ -30,9 +30,9 @@ internal sealed class SimulatorProxy
#region public Methods
///
- /// Initialisierung der Simulation
+ /// Initialization of the simulation
///
- /// Simulationskonfiguration
+ /// configuration of the simulation
public void Init(SimulatorConfiguration configuration)
{
// unload possible appdomains.
@@ -44,7 +44,7 @@ public void Init(SimulatorConfiguration configuration)
for (int i = 0; i < configuration.Teams[team].Player.Count; i++)
{
- // externe Guid-Info speichern
+ // save external Guid information
Guid guid = configuration.Teams[team].Player[i].Guid;
if (configuration.Teams[team].Player[i] is PlayerInfoFiledump)
@@ -70,7 +70,7 @@ public void Init(SimulatorConfiguration configuration)
Resource.SimulationCoreProxyWrongPlayerInfo);
}
- // Rückspeicherung der externen Guid
+ // save back external Guid
configuration.Teams[team].Player[i].Guid = guid;
}
}
@@ -87,24 +87,24 @@ public void Init(SimulatorConfiguration configuration)
setup.ShadowCopyFiles = "false";
setup.PrivateBinPath = "";
- // setup some access-rights für appdomain
- PermissionSet rechte = new PermissionSet(PermissionState.None);
- rechte.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
- rechte.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
+ // setup access-rights for appdomain
+ PermissionSet permissions = new PermissionSet(PermissionState.None);
+ permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
+ permissions.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
bool IoAccess = false;
bool UiAccess = false;
bool DbAccess = false;
bool NetAccess = false;
- // allow access to the needed ai-files
+ // grant access to the needed ai-files
foreach (TeamInfo team in configuration.Teams)
{
foreach (PlayerInfo info in team.Player)
{
if (info is PlayerInfoFilename)
{
- rechte.AddPermission(
+ permissions.AddPermission(
new FileIOPermission(
FileIOPermissionAccess.Read |
FileIOPermissionAccess.PathDiscovery,
@@ -117,12 +117,12 @@ public void Init(SimulatorConfiguration configuration)
}
}
- // Grand special rights
+ // grant special rights
if (IoAccess)
{
if (configuration.AllowFileAccess)
{
- rechte.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
+ permissions.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
}
else
{
@@ -134,7 +134,7 @@ public void Init(SimulatorConfiguration configuration)
{
if (configuration.AllowUserinterfaceAccess)
{
- rechte.AddPermission(new UIPermission(PermissionState.Unrestricted));
+ permissions.AddPermission(new UIPermission(PermissionState.Unrestricted));
}
else
{
@@ -146,7 +146,7 @@ public void Init(SimulatorConfiguration configuration)
{
if (configuration.AllowDatabaseAccess)
{
- // TODO: Grand rights
+ // TODO: grant rights
}
else
{
@@ -158,9 +158,9 @@ public void Init(SimulatorConfiguration configuration)
{
if (configuration.AllowNetworkAccess)
{
- rechte.AddPermission(new System.Net.WebPermission(PermissionState.Unrestricted));
- rechte.AddPermission(new System.Net.SocketPermission(PermissionState.Unrestricted));
- rechte.AddPermission(new System.Net.DnsPermission(PermissionState.Unrestricted));
+ permissions.AddPermission(new System.Net.WebPermission(PermissionState.Unrestricted));
+ permissions.AddPermission(new System.Net.SocketPermission(PermissionState.Unrestricted));
+ permissions.AddPermission(new System.Net.DnsPermission(PermissionState.Unrestricted));
}
else
{
@@ -169,7 +169,7 @@ public void Init(SimulatorConfiguration configuration)
}
// create appdomain and load simulation-host
- appDomain = AppDomain.CreateDomain("Simulation", AppDomain.CurrentDomain.Evidence, setup, rechte);
+ appDomain = AppDomain.CreateDomain("Simulation", AppDomain.CurrentDomain.Evidence, setup, permissions);
host =
(SimulatorHost)
@@ -187,9 +187,9 @@ public void Init(SimulatorConfiguration configuration)
}
///
- /// Executes one single step in simulation and returns hostState.
+ /// Executes one single step in simulation and returns summary of the executed simulation step
///
- /// The prefilled simulationState to put the currrent simulation-Snapshot in.
+ /// simulation state
/// Summery of the executed simulationStep.
public SimulatorHostState Step(ref SimulationState simulationState)
{
diff --git a/SimulationCore/Simulation/SimulatorState.cs b/SimulationCore/Simulation/SimulatorState.cs
index a0d7063..0aceefc 100644
--- a/SimulationCore/Simulation/SimulatorState.cs
+++ b/SimulationCore/Simulation/SimulatorState.cs
@@ -1,22 +1,22 @@
namespace AntMe.Simulation
{
///
- /// Liste der möglichen Stati eines Simulators
+ /// all possibilities of states the simulation can be
///
public enum SimulatorState
{
///
- /// Der Simulator ist initialisiert, aber noch nicht gestartet worden
+ /// ready, initialized, but not started yet
///
Ready,
///
- /// Der Simulator simuliert gerade
+ /// running simulation
///
Simulating,
///
- /// Die Simulation wurde beendet
+ /// finished simulation
///
Finished
}
diff --git a/SimulationCore/Simulation/TeamInfo.cs b/SimulationCore/Simulation/TeamInfo.cs
index 50476bf..f8a5fb7 100644
--- a/SimulationCore/Simulation/TeamInfo.cs
+++ b/SimulationCore/Simulation/TeamInfo.cs
@@ -4,31 +4,31 @@
namespace AntMe.Simulation
{
///
- /// ReprÀsentiert ein Team innerhalb der Simulationskonfiguration
+ /// Team of colonies.
///
[Serializable]
public sealed class TeamInfo : ICloneable
{
///
- /// Guid des Teams
+ /// Guid of Teams.
///
public Guid Guid;
///
- /// Name des Teams
+ /// Name of Teams.
///
public string Name;
///
- /// Liste der enthaltenen Spieler
+ /// List of team member players.
///
private List player;
- #region Initialisierung und Konstruktor
+ #region Constructor and Initialization
///
- /// Konstruktor des Teams
+ /// Team Constructor.
///
public TeamInfo()
{
@@ -37,9 +37,9 @@ public TeamInfo()
}
///
- /// Konstruktor des Teams
+ /// Team Constructor.
///
- /// Liste der Spieler
+ /// List of players.
public TeamInfo(List player)
: this()
{
@@ -47,10 +47,10 @@ public TeamInfo(List player)
}
///
- /// Konstruktor des Teams
+ /// Team Constructor.
///
- /// Guid des Teams
- /// Liste der Spieler
+ /// Guid.
+ /// List of players.
public TeamInfo(Guid guid, List player)
: this(player)
{
@@ -58,10 +58,10 @@ public TeamInfo(Guid guid, List player)
}
///
- /// Konstruktor des Teams
+ /// Team Constructor.
///
- /// Name des Teams
- /// Liste der Spieler
+ /// Name of team.
+ /// List of players.
public TeamInfo(string name, List player)
: this(player)
{
@@ -69,11 +69,11 @@ public TeamInfo(string name, List player)
}
///
- /// Konstruktor des Teams
+ /// Team Constructor.
///
- /// Guid des Teams
- /// Name des Teams
- /// Liste der Spieler
+ /// Guid of team.
+ /// Name of team.
+ /// List of players.
public TeamInfo(Guid guid, string name, List player)
: this(player)
{
@@ -83,10 +83,10 @@ public TeamInfo(Guid guid, string name, List player)
#endregion
- #region Eigenschaften
+ #region properties
///
- /// Liste der spieler dieses Teams
+ /// List of team members.
///
public List Player
{
@@ -95,21 +95,21 @@ public List Player
#endregion
- #region öffentliche Methoden
+ #region public methods
///
- /// PrĂŒft, ob das Team regelkonform aufgebaut ist
+ /// Check team against rule set.
///
public void Rulecheck()
{
- // Menge der Spieler prĂŒfen
+ // Number of players in team.
if (player == null || player.Count < 1)
{
- // TODO: Name der Resource ist Mist
+ // TODO: resource needs better name
throw new InvalidOperationException(Resource.SimulationCoreTeamInfoNoName);
}
- // Regelcheck bei den enthaltenen Spielern
+ // Check team members against rule set.
foreach (PlayerInfo info in player)
{
info.RuleCheck();
@@ -121,9 +121,9 @@ public void Rulecheck()
#region ICloneable Member
///
- /// Erstellt eine Kopie des Teams
+ /// Clones team.
///
- /// Kopie des Teams
+ /// Copy of the team.
public object Clone()
{
TeamInfo output = (TeamInfo)MemberwiseClone();
diff --git a/SimulationPlugin/StatisticControl.Designer.cs b/SimulationPlugin/StatisticControl.Designer.cs
index dc37792..a3adafd 100644
--- a/SimulationPlugin/StatisticControl.Designer.cs
+++ b/SimulationPlugin/StatisticControl.Designer.cs
@@ -3,14 +3,14 @@
partial class StatisticControl
{
///
- /// Erforderliche Designervariable.
+ /// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
- /// Verwendete Ressourcen bereinigen.
+ /// Clean up used resources.
///
- /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
+ /// True if managed resources are to be deleted; otherwise False.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@@ -23,8 +23,8 @@ protected override void Dispose(bool disposing)
#region Vom Komponenten-Designer generierter Code
///
- /// Erforderliche Methode fĂŒr die DesignerunterstĂŒtzung.
- /// Der Inhalt der Methode darf nicht mit dem Code-Editor geÀndert werden.
+ /// Required method for designer support.
+ /// The content of the method must not be changed with the code editor.
///
private void InitializeComponent()
{
diff --git a/VideoPlugin/VideoRecorderControl.cs b/VideoPlugin/VideoRecorderControl.cs
index 9762085..4d69f8f 100644
--- a/VideoPlugin/VideoRecorderControl.cs
+++ b/VideoPlugin/VideoRecorderControl.cs
@@ -40,7 +40,7 @@ private void saveButton_Click(object sender, EventArgs e)
{
try
{
- // TODO: Ăber AntMe! Reader/Writer lösen fĂŒr Anonymisierung
+ // TODO: Solve with AntMe! reader/writer for anonymization
using (var output = File.Open(saveFileDialog.FileName, FileMode.CreateNew))
{
byte[] buffer = new byte[1024];
| | | | | |