Skip to content

Instantly share code, notes, and snippets.

View andrewstellman's full-sized avatar

Andrew Stellman andrewstellman

View GitHub Profile

COBOL Terminal Cursor Control Demo

This is a small experimental COBOL project I built to learn a little bit about COBOL. The goal was simple: see if COBOL could support basic interactive console behavior—specifically, moving an asterisk around the screen using the W/A/S/D keys.

It uses raw ANSI escape sequences for cursor control and a small C helper to handle non-blocking keyboard input (so the user doesn't have to press Enter). The original version got stuck in a classic AI rehash loop—ChatGPT kept giving plausible but ineffective tweaks. I revisited it later using the five Sens-AI habits (Context, Research, Problem Framing, Refining, and Critical Thinking), and that broke the loop and got everything working.


🔧 How to Build and Run

@andrewstellman
andrewstellman / Pinwheel.cs
Created March 20, 2025 18:45
Elliptical Pinwheel Animation for C# Console
Console.CursorVisible = false;
Console.Clear();
// Get console dimensions
int width = Console.WindowWidth;
int height = Console.WindowHeight;
// Center point of the pinwheel
int centerX = width / 2;
int centerY = height / 2;
@andrewstellman
andrewstellman / Program.cs
Created March 13, 2025 17:49
Breathing Particles: C# console visualization
List<Particle> particles = new List<Particle>();
int width = Math.Max(20, Console.WindowWidth - 1);
int height = Math.Max(10, Console.WindowHeight - 1);
Console.CursorVisible = false;
for (int i = 0; i < 40; i++)
particles.Add(new Particle(Random.Shared.Next(width), Random.Shared.Next(height)));
while (!Console.KeyAvailable)
{
@andrewstellman
andrewstellman / gist:0879e8a58a2dc2dbe712b8b8c46100d1
Created March 13, 2025 17:39
Particle simulation oscillating pattern in a C# console app
List<Particle> particles = new List<Particle>();
int width = Math.Max(20, Console.WindowWidth - 1);
int height = Math.Max(10, Console.WindowHeight - 1);
Console.CursorVisible = false;
for (int i = 0; i < 40; i++) // More particles for better visibility
particles.Add(new Particle(Random.Shared.Next(width), Random.Shared.Next(height)));
while (!Console.KeyAvailable)
{
@andrewstellman
andrewstellman / Program.cs
Created March 6, 2025 14:34
Conway's Game of Life in C#
// Parse command line arguments for width, height, density, and delay
var width = args?.Length > 0 && int.TryParse(args[0], out int w) && w > 0 ? w : 70;
var height = args?.Length > 1 && int.TryParse(args[1], out int h) && h > 0 ? h : 30;
var density = args?.Length > 2 && double.TryParse(args[2], out double d) && d > 0 && d <= 1 ? d : 0.3;
var delay = args?.Length > 3 && int.TryParse(args[3], out int ms) && ms >= 0 ? ms : 100;
// Initialize the grid with random cells
var grid = new bool[height, width];
// Fill cells randomly based on density parameter
@andrewstellman
andrewstellman / Life.cs
Created March 6, 2025 14:27
Conway's Game of Life in C#
// Parse command line arguments for width, height, density, and frames
var width = args?.Length > 0 && int.TryParse(args[0], out int w) && w > 0 ? w : 70;
var height = args?.Length > 1 && int.TryParse(args[1], out int h) && h > 0 ? h : 30;
var density = args?.Length > 2 && double.TryParse(args[2], out double d) && d > 0 && d <= 1 ? d : 0.3;
var frames = args?.Length > 3 && int.TryParse(args[3], out int f) && f > 0 ? f : 500;
// Initialize the grid with random cells
var grid = new bool[height, width];
var random = new Random();
// Parse command line arguments for width, height, density, and frames
var width = args?.Length > 0 && int.TryParse(args[0], out int w) && w > 0 ? w : 70;
var height = args?.Length > 1 && int.TryParse(args[1], out int h) && h > 0 ? h : 30;
var density = args?.Length > 2 && double.TryParse(args[2], out double d) && d > 0 && d <= 1 ? d : 0.3;
var frames = args?.Length > 3 && int.TryParse(args[3], out int f) && f > 0 ? f : 500;
// Initialize the grid with random cells
var grid = new bool[height, width];
var random = new Random();
// Parse command line arguments for width, height, density, and frames
int width = args?.Length > 0 && int.TryParse(args[0], out int w) && w > 0 ? w : 70;
int height = args?.Length > 1 && int.TryParse(args[1], out int h) && h > 0 ? h : 30;
double density = args?.Length > 2 && double.TryParse(args[2], out double d) && d > 0 && d <= 1 ? d : 0.3;
int frames = args?.Length > 3 && int.TryParse(args[3], out int f) && f > 0 ? f : 500;
// Initialize the grid with random cells
bool[,] grid = new bool[height, width];
Random random = new Random();
@andrewstellman
andrewstellman / gist:758c08d082008297f30857c7481a68dd
Created February 26, 2025 19:10
Animated console Mandelbrot in C#
// Parse command line arguments for width, height, frames, and maxIterations
int width = 80; // Default width
int height = 40; // Default height
int frames = 100; // Default number of frames
int maxIterations = 100; // Default max iterations
// Check if args is not null
if (args != null)
{
// Parse width if provided
@andrewstellman
andrewstellman / gist:b66f8df263e339879f783e5569294c6c
Created February 26, 2025 16:21
Generate a console Mandelbrot in C#
int width = 80; // Default width
if (args != null && args.Length > 0)
{
if (int.TryParse(args[0], out int parsedWidth) && parsedWidth > 0)
{
width = parsedWidth;
}
}
int height = width / 2;
double xMin = -2.0;