13 points · by hmerchan · 3y ago · 22 comments
It started off well by making me install python and flask and build a skeleton website. But it could not make it work completely. After a few debugging back and forth it went round and round doing and undoing same mistakes, but could not get the task completed..
Am I doing something wrong?
1: Which ChatGPT are you using? 3 or 4?
2: You are not clearly describing your problem. Teams? How many should it be splitting? Why do you need a backend? Why isn't this just a simple HTML page? Any examples? Have you clearly thought through what you want?
3: You are not sharing the prompts you used. How do you expect us to help you if you don't share what you tried?
In general, people who cannot communicate clearly are going to have a lot of trouble working with something which requires clear communication.
Kind of like programming. Framing the solution to a problem in a clear and logical fashion is the hard part, not writing the code.
User Please construct a simple webpage which allows me to add an arbitrary amount of team members, and when I am done adding them I should be able to click a button to randomly assign them into teams.
ChatGPT
I can provide you with a simple HTML and JavaScript code to create the webpage you've described. The following code creates a webpage that allows you to add team members, input the number of teams, and click a button to randomly assign team members into teams.
1. Save the code below as an HTML file (e.g., "team_randomizer.html").
2. Open the HTML file in a web browser to use the webpage.
```html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Team Randomizer</title> <style> .result { margin-top: 20px; } </style> </head> <body> <h1>Team Randomizer</h1> <div> <label for="memberName">Member Name:</label> <input type="text" id="memberName" /> <button onclick="addMember()">Add Member</button> </div> <div> <label for="numTeams">Number of Teams:</label> <input type="number" id="numTeams" min="1" /> <button onclick="randomizeTeams()">Randomize Teams</button> </div> <div class="result" id="result"></div> <script> const members = [];
function addMember() {
const memberName = document.getElementById('memberName').value.trim();
if (memberName) {
members.push(memberName);
document.getElementById('memberName').value = '';
displayMembers();
}
}
function displayMembers() {
const result = document.getElementById('result');
result.innerHTML = `<p>Team Members: ${members.join(', ')}</p>`;
}
function randomizeTeams() {
const numTeams = parseInt(document.getElementById('numTeams').value, 10);
if (!numTeams || numTeams < 1) return;
const shuffled = [...members];
for (let i = shuffled.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
}
const teams = [];
for (let i = 0; i < numTeams; i++) {
teams[i] = [];
}
for (let i = 0; i < shuffled.length; i++) {
teams[i % numTeams].push(shuffled[i]);
}
displayResult(teams);
}
function displayResult(teams) {
const result = document.getElementById('result');
let html = '';
for (let i = 0; i < teams.length; i++) {
html += `<p>Team ${i + 1}: ${teams[i].join(', ')}</p>`;
}
result.innerHTML = html;
}
</script>
</body>
</html>
```This code will create a simple webpage where you can add team members, specify the number of teams, and randomize the teams. The team members and resulting teams will be displayed on the page.
Might be that you’re using gpt3.5(understandable because not everyone has access), or maybe you asked in a different way than in your post.
Plenty of people have been building simple websites with it, so maybe try to figure out what you’re doing wrong instead of declaring the tool a failure.
Using ChatGPT to code effectively requires internalizing the small sliding context window and correct specification of the problem-space. You can get real work done if you thoughtfully split your project into parts, and you can save time by jumping back to a contextual fork where your program was fully specified.
* start with a clear objective
* include context
* describe criteria to meet expectations
* iterate providing updated context
I used chatGPT-3 yesterday to write a Ruby client that runs code generated from prompts. (Was inspired by the gepl project seen here https://github.com/lmortimer/gepl)
basically the chat went on for quite long and the solution kept generating some errors and it came to the point where it was un-doing the fixes it did the day before.
I've tried to get it to do 100% of my coding for smallish projects, and it's pretty frustrating. I'd only do that as a challenge.
I'm in the middle of converting some ruby code to javascript, so asking it something like how to split a string in nodejs into directory and file components results in a quick and correct answer.
Tldr: LLMs are like fire. A good servant but a bad master.