MAINT: Apply pre-commit

Remove byte-order-marker pre-commit check as there would be
many adjustments necessary
This commit is contained in:
Martin Thoma
2022-03-05 09:29:23 +01:00
parent f5e33ae38f
commit e64fb6795c
536 changed files with 6267 additions and 5556 deletions

View File

@@ -47,12 +47,12 @@ void PrintHeader()
Console.Write(new string(' ', spaceCount));
Console.WriteLine(text);
}
PrintCentered("LIFE");
PrintCentered("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY");
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
}
Simulation InitializeSimulation(Pattern pattern, Matrix matrixToInitialize) {
@@ -65,7 +65,7 @@ Simulation InitializeSimulation(Pattern pattern, Matrix matrixToInitialize) {
{
if (pattern.Content[x][y] == ' ')
continue;
matrixToInitialize[minX + x, minY + y] = CellState.Stable;
newSimulation.IncreasePopulation();
}
@@ -77,7 +77,7 @@ Simulation InitializeSimulation(Pattern pattern, Matrix matrixToInitialize) {
TimeSpan GetPauseBetweenIterations()
{
if (args.Length != 2) return TimeSpan.Zero;
var parameter = args[0].ToLower();
if (parameter.Contains("wait"))
{
@@ -93,17 +93,17 @@ void ProcessSimulation()
{
var pauseBetweenIterations = GetPauseBetweenIterations();
var isInvalid = false;
while (true)
{
var invalidText = isInvalid ? "INVALID!" : "";
Console.WriteLine($"GENERATION: {simulation.Generation}\tPOPULATION: {simulation.Population} {invalidText}");
simulation.StartNewGeneration();
var nextMinX = maxHeight - 1;
var nextMinX = maxHeight - 1;
var nextMinY = maxWidth - 1;
var nextMaxX = 0;
var nextMaxX = 0;
var nextMaxY = 0;
var matrixOutput = new StringBuilder();
@@ -114,7 +114,7 @@ void ProcessSimulation()
matrixOutput.AppendLine();
}
// refreshes the matrix and updates search area
// refreshes the matrix and updates search area
for (var x = minX; x <= maxX; x++)
{
var printedLine = Enumerable.Repeat(' ', maxWidth).ToList();
@@ -161,13 +161,13 @@ void ProcessSimulation()
const int limitX = 21;
const int limitY = 67;
if (minX < 2)
{
minX = 2;
isInvalid = true;
}
if (maxX > limitX)
{
maxX = limitX;
@@ -227,12 +227,12 @@ void ProcessSimulation()
}
}
// expands search area to accommodate new cells
// expands search area to accommodate new cells
minX--;
minY--;
maxX++;
maxY++;
if (pauseBetweenIterations > TimeSpan.Zero)
Thread.Sleep(pauseBetweenIterations);
}
@@ -305,7 +305,7 @@ class Matrix
get => _matrix[x, y];
set => _matrix[x, y] = value;
}
public override string ToString()
{
var stringBuilder = new StringBuilder();
@@ -321,4 +321,4 @@ class Matrix
}
return stringBuilder.ToString();
}
}
}

View File

@@ -10,7 +10,7 @@ This program requires you to install [.NET 6 SDK](https://dotnet.microsoft.com/e
## Know more about Conway's Game of Life
You can find more about Conway's Game of Life on this page of the [Cornell Math Explorers' Club](http://pi.math.cornell.edu/~lipa/mec/lesson6.html), alongside many examples of patterns you can try.
You can find more about Conway's Game of Life on this page of the [Cornell Math Explorers' Club](http://pi.math.cornell.edu/~lipa/mec/lesson6.html), alongside many examples of patterns you can try.
### Optional parameters

View File

@@ -16,4 +16,4 @@ However, the Java code does not have much in common with the original.
**Differences in behaviour:**
* Input supports the ```.``` character, but it's optional.
* Evaluation of ```DONE``` input string is case insensitive.
* Run with the ```-s``` command line argument to halt the program after each generation, and continue when ```ENTER``` is pressed.
* Run with the ```-s``` command line argument to halt the program after each generation, and continue when ```ENTER``` is pressed.

View File

@@ -12,10 +12,10 @@ function input()
{
var input_element;
var input_str;
return new Promise(function (resolve) {
input_element = document.createElement("INPUT");
print("? ");
input_element.setAttribute("type", "text");
input_element.setAttribute("length", "50");

View File

@@ -91,5 +91,3 @@ for ($X=$X1-1; $X<=$X2+1; $X++) {
$X1=$X1-1; $Y1=$Y1-1; $X2=$X2+1; $Y2=$Y2+1;
goto Line210;
exit;