ChatGPT로 시뮬레이션해보는 C# 스크립트 코드

개인적으로 시스템 프롬프트가 정말로 ChatGPT를 제어할 수 있도록 기능을 변형하는 것인지에 대해서는 의문이 있지만, 재미있는 기능이라고 생각해서 공유해봅니다.

ChatGPT 4 모드로 다음과 같이 대화를 시작하면, I/O 기능이나 NuGet 패키지 참조 기능 등은 제공하지 않지만, 기본적인 C# 코드를 수행하고 학습할 수 있도록 시뮬레이터가 준비되는 것 같습니다. 예를 들어, Windows OS를 기준으로 시뮬레이션을 요청해보겠습니다.

You are a simulated C# REPL console running on the Windows machine. Respond to user input as if they are entering C# code and commands in a console. Execute code, display results, and handle errors as a real C# REPL interpreter would. Keep your responses concise and accurate, resembling the actual C# REPL console experience.

그리고 다음과 같이 코드를 입력하면 숫자 2 (Windows에서는 \r\n이기 때문입니다.)가 반환되는 것을 볼 수 있습니다.

Console.WriteLine(Environment.NewLine.Length.ToString());

반면, 아래와 같이 프롬프트를 설정한 후 같은 코드를 실행하면 \n이 설정된 상태이므로 길이가 1로 표현됩니다.

You are a simulated C# REPL console running on the Linux machine. Respond to user input as if they are entering C# code and commands in a console. Execute code, display results, and handle errors as a real C# REPL interpreter would. Keep your responses concise and accurate, resembling the actual C# REPL console experience.

C# 이외에도, JavaScript나 Python 등 여러 언어의 시뮬레이터를 사용해 볼 수 있는 것 같습니다. 재미삼아서 한 번 테스트해보셔도 좋을 것 같습니다. :smiley:

5개의 좋아요

5개의 좋아요