ChatGPT

I think i’m in love … With chatGPT :rofl:

Popups went from this:

image

To this

image

In a few hours :open_mouth:

5 Likes

Feel like sharing the fun? :wink:

https://chat.openai.com/chat

Haha I meant the hangman UI, but have had plenty of fun with chatGPT as well. It’s very handy for UI development, I’ve used some to troubleshoot xml/wpf.

Ah! Doh!
Bit of a mess atm as I’m still working on it the hangman game but:

image

NAME code (at work we have firstname.lastname as our log in so this works well).

import getpass
import clr
from System import Environment

sys_name = Environment.UserName

first_name = sys_name.split(".")[0]

OUT = first_name


And for the Windows popup

import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
import System
from System.Windows.Forms import *
from System.Drawing import *

runme = IN[1]

class CreateWindow(Form):
    def __init__(self):
    
        self.Name = "Create Window"
        self.Text = "This is ©Hangman 2023, " + IN[0] + " !"
        self.Size = Size(400, 180)
        self.CenterToScreen()
        self.ForeColor = Color.Red
        
        label = Label(Text = "Enter a letter >>")
        label.Parent = self
        label.Location = Point(25, 20)
        
        label = Label(Text = "(Careful! Numbers will restart the game!)")
        label.Parent = self
        label.Location = Point(180, 20)
        label.AutoSize = False
        label.Height = 50
        label.Width = 150
        label.ForeColor = Color.Green

        self.textbox = TextBox()
        self.textbox.Parent = self
        self.textbox.Text = ""
        self.textbox.Location = Point(125, 20)
        self.textbox.Width = 40
        self.textbox.ForeColor = Color.Red 

        button = Button()
        button.Parent = self
        button.Text = "OK"
        button.Location = Point(190, 70)
        #button.Width = 100
        button.Click += self.ButtonClicked
        
        self.footer = Label()
        self.footer.Parent = self
        self.footer.Text = "Hanging is barbaric! Why are you playing this game you monster!"
        self.footer.Location = Point(10, 100)
        self.footer.AutoSize = True

    def ButtonClicked(self, sender, args):
        if sender.Click:
            self.value = self.textbox.Text
            self.Close()

ThisGuess = ""
GuessedAlready = IN[2]

#Run the form
if runme:
	form = CreateWindow()
	Application.Run(form)
	ThisGuess = (form.value).upper()

if len(ThisGuess) != 1:
	form = CreateWindow()
	Application.Run(form)
	ThisGuess = (form.value).upper()
else:
# Check if input is an letter
	if ThisGuess.isalpha():
		for i in GuessedAlready:
			if i == ThisGuess:
				form = CreateWindow()
				Application.Run(form)
				ThisGuess = form.value
	else:
		ThisGuess = "Restart"	
        
OUT = ThisGuess


1 Like

I found asking it small bits of code worked better than asking it to write huge chunks.

Questions like,

"I have this bit of code:
xxxxx
How do I add a colour to the text? "

When I asked it to do 2-3 things at once it was a little erratic.

I also got the impression it was taking the mickey at some points… :rofl:

2 Likes

If you try using the openChatGPT pagkage in combination with it you could possibly get it to give you a random hangman word if you query it right. If you keep sending the inputs to an external file and read them in a loop structure you could potentially make a working and randomized hangman - cool!

It works already… sorta…
Few glitches. I’m rewriting it.

And thanks… I opened it to copy the code and now I’m coding again. Byee life :person_facepalming:

I’m using:

https://svnweb.freebsd.org/csrg/share/dict/words?revision=61569&view=co

But cleaned up as the word list.

2 Likes

And 2 more hours later I’ve made it worse…
image

ARGH