Adventures in AI coding
I have spent about a day or so working on writing code with DeepSeek-V3-0324 (I am running the model locally. For information on how I setup this model, check out my post HERE).
This is actually my first time experimenting with AI generated code, and the results were, in a word, spectacular.
With very minimal prompting, the AI was able to output quite complex and complete code, with very few issues or bugs.
I used the AI to generate a C# Forms application to display the Mandlebrot set, display a rotating 3D cube on the screen (A Tesseract), display a demo of Conway’s “Game Of Life” and it’s “Brians Brain” modification, as well as write a Base64-to-image converter.
All of these programs worked very well, and where issues occurred, I was able to quickly resolve them using plain english.
This is an example of the output for the first program, to display the Mandlebrot set. The query was:
“I would like you to write me a program in C# that displays the mandlebrot fractal set. The program should be as concise as possible, and should ideally use no external libraries, however it should display the fractal in colour on a gui.”
Output:
“I understand the requirements – a concise Mandelbrot fractal generator in C# using only built-in libraries while still producing a colored GUI output. This is an interesting challenge given the constraints.”
“Here’s a solution using Windows Forms (System.Drawing) which comes bundled with .NET, requiring no external dependencies:”
using System;
using System.Drawing;
using System.Windows.Forms;
class Mandelbrot : Form
{
const int MaxIterations = 1000;
const double Zoom = 300;
public Mandelbrot()
{
Text = "Mandelbrot Set";
ClientSize = new Size(800, 600);
DoubleBuffered = true;
Paint += (sender, e) =>
{
for (int y = 0; y < Height; y++)
{
for (int x = 0; x < Width; x++)
{
double zx = 0, zy = 0;
double cx = (x - Width/2) / Zoom;
double cy = (y - Height/2) / Zoom;
int iter = MaxIterations;
while (zx*zx + zy*zy < 4 && iter > 0)
{
double tmp = zx*zx - zy*zy + cx;
zy = 2*zx*zy + cy;
zx = tmp;
iter--;
}
Color c = iter == 0 ? Color.Black : Color.FromArgb(
iter % 8 * 32,
iter % 16 * 16,
iter % 32 * 8);
e.Graphics.FillRectangle(new SolidBrush(c), x, y, 1, 1);
}
}
};
}
static void Main()
{
Application.Run(new Mandelbrot());
}
}
“This implementation:
- Uses Windows Forms for the GUI
- Implements the Mandelbrot algorithm directly
- Colors points based on iteration count
- Is completely self-contained (no NuGet packages needed)
- Compiles to ~100KB executable
- The zoom factor can be adjusted for different views”
“Would you like me to explain any particular part in more detail? Or perhaps suggest optimizations or modifications?”
I then asked the AI for detailed instructions for how to run the code:
“Excellent, thank you. How can I run this code, do I just create a new blank project in visual studio?”
And the response that I get was equally intelligent:
“Yes! You have the right idea. Here’s a precise step-by-step guide:”
- Open Visual Studio
- Create new project →
“Windows Forms App (.NET Framework)”
(Important: not .NET Core for this example) - Replace ALL code in
Form1.cs
with the Mandelbrot code I provided - Click the Start/Run button (or press F5)
“Key technical notes:
- The code uses .NET Framework’s System.Drawing which isn’t available in .NET Core by default
- The project template must be Windows Forms, not Console or WPF
- No NuGet packages need to be installed
- Compilation happens automatically when you run”
“Would you like me to modify it for .NET Core if that’s your preference? Though we’d need to add a NuGet package for System.Drawing in that case. Or perhaps you’d enjoy seeing a real-time zoomable version?”
I needed to make some changes to the code in order to get it to run properly, and when I posted my finished, working, version of the code back to the AI, it was even able to suggest improvements:
“I see what you’ve done! You’ve:
- Created a proper Windows Forms project structure
- Wrapped my Mandelbrot class inside the Form1 container
- Commented out InitializeComponent() since we don’t need designer-generated code
- Initiated the Mandelbrot form directly from Form1’s constructor”
“Your changes are quite logical. Though may I suggest two slight optimizations to your version?”
// Instead of Application.Run inside Form1's constructor,
// modify Program.cs like this:
static class Program
{
static void Main()
{
Application.Run(new Mandelbrot()); // Run Mandelbrot directly
}
}
// And make Form1 empty or remove it entirely
“This would:
- Eliminate the unnecessary Form1 middleman
- Follow Windows Forms conventions more closely
- Prevent potential double-form issues
- Make the project structure cleaner”
“By the way, I notice you kept all the default using directives – would you like me to strip those down to just what we actually need? We could reduce it to just System, System.Drawing and System.Windows.Forms for better clarity. Three simple namespaces would suffice!”
This is very useful feedback, and the AI even successfully caught the unneeded “Using” directives, I have a having it leaving those in while debugging, having the AI suggest removing them is exactly what a human programmer would do!
The AI also suggested changes to the programs, such as the “Brians Brain” variant of Conway’s Game of Life, which I hadn’t even heard of! It then either modified the program with those changes in mind.
In one case, the changes became so numerous that the AI offered to completely rewrite the program to avoid confusion, which it duly did!
I am confident that I could have written the above programs myself, just relying on internet research and my own knowledge to help me, however, it would certainly have taken far longer. Working with the AI was a substantial time saver, it really was like having another person there to assist me with questions, even complex techical questions.
I am currently experimenting with using the AI to write a much more complex program, (I want to take the system audio and display an aesthetically pleasing visualisation of it on the screen) and this is going well, but it is a lot slower. I feel that with the more complex program the advantages of using AI to code are not as strong, I find that I can probably fix mistakes faster than waiting on the AI.
I think that this is a very important point to make regarding the use of generative AI in the workplace, and in society. Simple tasks (such as simple programs) can be easily offloaded to the AI, however when it comes to more complex tasks, much more human interaction is needed.
So, in the future, as AI becomes normalised in society, we could simply use AI for the menial tasks, freeing up valuable Human Resources for creative and complex tasks. The idea would be that instead of AI “replacing” humans, it is instead enabling humans to do what they do best: Create, Understand, and Produce, while the AI simple handles the simple boring time-wasting tasks.
I have uploaded some of the examples of the AI-Generated scripts to my github. To access the scripts, click on the links below. The Scripts are written in C# (.net).
Displaying the Mandlebrot Set.
Displaying a rotating Tesseract.
Displaying Conways “Game of Life” (With speed controls and randomisation).
Displaying the “Brian’s Brain” variant of Game of Life (With speed controls and randomisation).
Displaying an image encoded into a Base64 string to the screen.


