Python-AI

I want to use ChatGPT to generate Python. I think I can get it to output a parser text adventure as a single .py file. I could begin by describing the world model and also discussing the data model in ChatGPT and then asking the AI to build it. I imagine I would write most of the content myself, but I could eventually ask the AI to generate more content based on specifications and previously written examples. The result would be a fusion of human creativity and machine learning.

The conversation with ChatGPT would be a sort of source code of the source code.

So, I’m looking at extent text adventures in Python –

Interesting. I hadn’t known about Wastes or Space Diner.

1 Like

I’d be most interested to learn how far you get. I’ve tried making AI generate code and it’s not been very successful. Small simple things, yes, otherwise it has fallen short for me.

Perhaps you have access to a newer GPT. Maybe this will work better.

2 Likes

Huh, there really aren’t many Python IFs listed on IFDB. My gut reaction is that a full-fledged text adventure might have too much going on at once for you to get anything good out of ChatGPT for it, but who knows. Depends on how complicated you want the systems to be, I think. You could go for inventory and save states and stuff, which would put in a lot of complexity I’m not sure ChatGPT could help with. On the other hand, if you just wanted basic data structures for rooms and exits coupled with commands that move you around and let you look at stuff…

This is somewhat relevant to me since I’ve actually tried to make a parser game/library in Python before. I submitted the old code for that to Parsercomp this year, so it’s not public yet (you’d have to wait until June 30th…). But it ended up taking a lot more time than I expected and the end product was just a worse version of Inform, so I never did anything else with it.

I feel like you’d end up doing a lot of Python programming yourself, either way. In my experience ChatGPT has the memory of a goldfish, and while I’ve used it for answering coding questions, I’m not sure how good it is at designing systems…

2 Likes

If you want AI-assisted coding, use GitHub Copilot (which is backed by some relative of ChatGPT) instead. It’s faster because it integrates with your development environment, and picks up context from the code around it (and I think to some extent from other files in your project, at least if you’re working in VSCode).

But don’t expect to get anything like a full system to come out of it. AI coding assistants can work on the small scale, but they’re incapable of designing systems or working out software architecture.

2 Likes

Well, I’ve just been using GPT 4o for reworking a solution for transforming JSON files into a specific export format. GPT made a Python script that I execute in the terminal.

I’m doing this for a class I’m taking. We’re archiving and hypertextualizing exported conversations from ChatGPT in HTML (using TiddlyWiki). My professor did it first for zip archives exported from ChatGPT and again for those exported from the ‘Superpower ChatGPT’ Chrome extension.

You have to be really specific in your instructions to GPT. Maybe it amounts to a kind of natural language parsing that generates the Python code. But LLMs basically removes any kind of learning curve, just not necessarily the effort needed to describe and understand the context, as well as to test and implement the AI’s solutions.

This is somewhat relevant to me since I’ve actually tried to make a parser game/library in Python before.

You know, I think we could have adopted Python a long time ago. It makes sense as a sort of universal interpreter. Anyways, it seems to be gaining more and more market share these days, even though many CS nerds and hardcore webdev full-stackers hate it because it has too much overhead or because it doesn’t fit with their idea of a pure code environment.

I don’t know Python, but I feel like knowing a programming language is even more ambiguous now than it was before LLMs–and it was already a bit ambiguous then. We can use programming languages without mastering them, without being able to produce in a pure coding environment. AI can roll with your attempt to use something for a specific context.

I’m really curious whether ChatGPT would analyze your Python library, if you asked it to during a conversation where you also provided the context of parser-based interactive fiction, and then would be able to generate actual game material based on your library in the same conversation.

@rileypb

If you want AI-assisted coding, use GitHub Copilot (which is backed by some relative of ChatGPT) instead. It’s faster because it integrates with your development environment, and picks up context from the code around it (and I think to some extent from other files in your project, at least if you’re working in VSCode).

That’s a responsible professional workflow for using AI. It makes sense that it would only do so much for someone who is already a pro developer.

But I don’t have a development environment. I’m telling GPT 4o to generate Python scripts, and then copying and pasting them into a .py file, and then running that file manually using my zsh terminal. And it generates way more specific and useful code than I would have guessed before trying it.

Also, getting organized into anything resembling a development environment is something I have always struggled immensely with. If AI tools could help me get organized and focus on my own creativity and analysis without interjecting its own solutions, that would be great! I don’t even know if I can be organized enough to use AI in an organized enough fashion to have it help me get organized. And I need to do my laundry.