using System.Collections.Generic;
public string Seed { get; set; }
public string CharSpace { get; set; }
private const int depth = 4;
private int cyclesHorz = 1;
private int cyclesVert = 1;
public RNG(string seed, string charSpace)
csLength = CharSpace.Length;
cyclesHorz = Spit(sLength);
cyclesVert = Spit(csLength);
public int Spit(int range)
int denominator = (int)(Math.Pow(csLength, depth));
for(int xFloop = 0; xFloop < depth; xFloop++)
for(int yFloop = 0; yFloop < csLength; yFloop++)
if(Seed[xFloop].Equals(CharSpace[yFloop]))
numerator = numerator + (yFloop*((int)(Math.Pow(csLength, xFloop))));
int answer = ((range*numerator)/denominator);
public void HorizontalShift(int shift)
string front = Seed.Substring(0, shift);
string back = Seed.Substring(shift, Seed.Length - shift);
public void HorizontalShift() { HorizontalShift(1); }
public void VerticalShift(int shift)
for(int xFloop = 0; xFloop < sLength; xFloop++)
for(int yFloop = 0; yFloop < csLength; yFloop++)
if(Seed[xFloop].Equals(CharSpace[yFloop]))
temp = temp + CharSpace[(yFloop + shift) % csLength];
public void VerticalShift() { VerticalShift(1); }
for(int floop = 0; floop < csLength; floop++)
if(Seed[0].Equals(CharSpace[floop]))
for(int xFloop = 1; xFloop <= sLength; xFloop++)
for(int yFloop = 0; yFloop < csLength; yFloop++)
if(Seed[xFloop % sLength].Equals(CharSpace[yFloop]))
temp = temp + CharSpace[(beginIndex + yFloop) % csLength];
public void Difference(int cycles)
for(int floop = 0; floop < cycles; floop++)
HorizontalShift(cyclesHorz);
VerticalShift(cyclesVert);
if(cyclesHorz == sLength)
if(cyclesVert == csLength)
public void Swish(int cycles)
for(int floop = 0; floop < cycles; floop++)
public Dungeon(RNG r, int x, int y, int nr)
for(int yFloop = 0; yFloop < ySize; yFloop++)
for(int xFloop = 0; xFloop < xSize; xFloop++)
space[yFloop,xFloop] = '.';
for(int floop = 0; floop < numRooms; floop++)
AddRoom(Convert.ToChar(65 + floop));
for(int yFloop = 0; yFloop < ySize; yFloop++)
for(int xFloop = 0; xFloop < xSize; xFloop++)
Console.Write(space[yFloop,xFloop]);
private void AddRoom(char label)
public static void Main()
RNG rng = new RNG("OCARINA OF TIME", "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Dungeon dungeon = new Dungeon(rng,32,16,10);
List<char> path = new List<char>();
for(int floop = 0; floop < 25; floop++)
Console.Write(Convert.ToChar(65 + rng.Spit(12)));