-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17 add: Change Resolution feature, UniformRandom [SeedWriter], Pixel…
…-Perfect
- Loading branch information
1 parent
af7a2a7
commit eb3c5fa
Showing
37 changed files
with
495 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Application/ASD.CellUniverse.Infrastructure/DataProviders/UniformRandomDataProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Security.Cryptography; | ||
|
||
namespace ASD.CellUniverse.Infrastructure.DataProviders { | ||
|
||
internal sealed class UniformRandomDataProvider : IDisposable { | ||
|
||
private RNGCryptoServiceProvider crypto; | ||
|
||
public UniformRandomDataProvider() => crypto = new RNGCryptoServiceProvider(); | ||
|
||
public byte NextByte() { | ||
var next = new byte[1]; | ||
crypto.GetBytes(next); | ||
return next[0]; | ||
} | ||
|
||
public void Dispose() => crypto?.Dispose(); | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
Application/ASD.CellUniverse.Infrastructure/Extensions/Extensions.cs
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
Application/ASD.CellUniverse.Infrastructure/Interfaces/IApplicationFacade.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.ComponentModel; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
|
||
namespace ASD.CellUniverse.Infrastructure.Interfaces { | ||
|
||
public interface IApplicationFacade : INotifyPropertyChanged { | ||
|
||
byte[,] Matrix { get; } | ||
|
||
int GenerationWidth { get; set; } | ||
int GenerationHeight { get; set; } | ||
bool MatrixReadyToChange { get; } | ||
bool MatrixReadyToMutate { get; } | ||
|
||
ISeedGenerator SeedWriter { get; set; } | ||
ICommand WriteSeed { get; } | ||
IMutationAlgorithm Algorithm { get; set; } | ||
|
||
DoubleCollection FPSCollection { get; } | ||
double MinFPS { get; } | ||
double MaxFPS { get; } | ||
double FPS { get; set; } | ||
|
||
State State { get; } | ||
ICommand Start { get; } | ||
ICommand Stop { get; } | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Application/ASD.CellUniverse.Infrastructure/Interfaces/IFPSGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Windows.Media; | ||
|
||
namespace ASD.CellUniverse.Infrastructure.Interfaces { | ||
|
||
internal interface IFPSGenerator { | ||
|
||
DoubleCollection FPSCollection { get; } | ||
|
||
double FPS { get; set; } | ||
|
||
event Action NextFrameTime; | ||
void Start(); | ||
void Stop(); | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
Application/ASD.CellUniverse.Infrastructure/Interfaces/IFrameSequenceGenerator.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
Application/ASD.CellUniverse.Infrastructure/Interfaces/IMatrix.cs
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...frastructure/Interfaces/IMatrixMutator.cs → ...tructure/Interfaces/IMutationAlgorithm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Application/ASD.CellUniverse.Infrastructure/Interfaces/ISeedGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace ASD.CellUniverse.Infrastructure.Interfaces { | ||
|
||
public interface ISeedGenerator { | ||
|
||
string Name { get; } | ||
|
||
byte[,] GenerateNew(int width, int height, object parameter = null); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Application/ASD.CellUniverse.Infrastructure/Properties/Settings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Application/ASD.CellUniverse.Infrastructure/SeedGenerators/UniformRandom.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace ASD.CellUniverse.Infrastructure.SeedGenerators { | ||
|
||
using DataProviders; | ||
using Interfaces; | ||
|
||
public class UniformRandom : ISeedGenerator { | ||
|
||
public string Name => "Uniform Random"; | ||
public override string ToString() => Name; | ||
|
||
public byte[,] GenerateNew(int width, int height, object parameter = null) { | ||
var result = new byte[width, height]; | ||
|
||
using (var random = new UniformRandomDataProvider()) { | ||
for (var x = 0; x < width; ++x) { | ||
for (var y = 0; y < height; ++y) { | ||
result[x, y] = (byte)(random.NextByte() % 2 == 0 ? 0 : 255); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
} |
Oops, something went wrong.