Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 2.95 KB

README.md

File metadata and controls

73 lines (52 loc) · 2.95 KB

AI Coding Coach

An interactive C# programming teaching tool with AI assistant.

image

The AI Coding Coach has been built as a submission for The Microsoft .NET 8 Global Hack.

About

The AI Coding Coach integrates a syntax color text editor, a C# compiler, a drawing canvas, and an interface to GPT-4 API designed to help people learn to code.

Watch the video

Code Example

The compiler automatically compiles C# code as it is entered into the editor. If a class has a Draw metod which accepts a single parameter of type DrawingContext.

For example:

using System.Windows;
using System.Windows.Media;

public class GradientExample
{
 
    public void Draw(DrawingContext context)
    {
        var gradientBrush = new LinearGradientBrush();
        gradientBrush.StartPoint = new Point(0, 0); 
        gradientBrush.EndPoint = new Point(1, 1);   
        gradientBrush.GradientStops.Add(new GradientStop(Colors.Blue, 0.0)); 
        gradientBrush.GradientStops.Add(new GradientStop(Colors.Red, 1.0));  
        context.DrawRectangle(gradientBrush, null, new Rect(50, 50, 300, 200));
    }
}

Prompts

The GPT Chat API is provided with a system prompt to guide it to produce code that can be executed by the compiler.

If you right click in the prompt window, the context menu provides a list of predefined prompts you can choose from.

If you highlight text in the code editor, you can right click and choose from the context menu an option to ask Chat GPT to explain the code for you.

Building the Code

Compiling the source code for AICodingCoach as-is requires that you first clone the Ara3D repository so that both repositories share the same parent folder. If you clone the Ara3D repository into a different location you will have to update the AICodingCoach project manually so that it can find the project references.

Inspiration and References