TinyChan

Topic: Using AI powered technology is still no substitute for an actual programmer.

+Anonymous A2.8 years ago #63,422

Unless I am doing something wrong, the AI cannot comprehend errors in it's logic so the need for a human programmer remains necessary.

+Anonymous B2.8 years ago, 4 minutes later[T] [B] #637,238

Although I have no clue about programming but isn't AI capabilities rapidly growing?

+Anonymous C2.8 years ago, 17 minutes later, 21 minutes after the original post[T] [B] #637,240

Someone on iritu said that the programs ChatGPT made for them worked 20-40% of the time.

(Edited 24 seconds later.)


+Lanky Lorenzo !cbHHk9GdPo2.8 years ago, 15 minutes later, 36 minutes after the original post[T] [B] #637,242

Let's see if ChatGPT can do what I did yesterday, write a program for my learning Python course. It's a simple program to emulate a coffee machine. About 100 lines.

·Lanky Lorenzo !cbHHk9GdPo2.8 years ago, 7 minutes later, 44 minutes after the original post[T] [B] #637,243

# Define initial resources of the coffee machine
resources = {
    'water': 300,
    'milk': 200,
    'coffee': 100,
    'money': 0
}

# Define the cost of each drink
menu = {
    'espresso': {
        'ingredients': {
            'water': 50,
            'coffee': 18
        },
        'cost': 1.5
    },
    'latte': {
        'ingredients': {
            'water': 200,
            'milk': 150,
            'coffee': 24
        },
        'cost': 2.5
    },
    'cappuccino': {
        'ingredients': {
            'water': 250,
            'milk': 100,
            'coffee': 24
        },
        'cost': 3.0
    }
}

# Define functions for the actions the user can take
def report():
    """Prints a report of the current resource values."""
    print(f"Water: {resources['water']}ml")
    print(f"Milk: {resources['milk']}ml")
    print(f"Coffee: {resources['coffee']}g")
    print(f"Money: ${resources['money']}")

def check_resources(drink):
    """Checks if there are enough resources to make the drink."""
    for ingredient in drink['ingredients']:
        if resources[ingredient] < drink['ingredients'][ingredient]:
            print(f"Sorry there is not enough {ingredient}.")
            return False
    return True

def process_coins():
    """Prompts the user to insert coins and returns the total value."""
    print("Please insert coins.")
    quarters = int(input("How many quarters?: ")) * 0.25
    dimes = int(input("How many dimes?: ")) * 0.10
    nickles = int(input("How many nickles?: ")) * 0.05
    pennies = int(input("How many pennies?: ")) * 0.01
    total = quarters + dimes + nickles + pennies
    return total

def check_transaction_successful(drink, total):
    """Checks if the transaction is successful."""
    if total < drink['cost']:
        print("Sorry that's not enough money. Money refunded.")
        return False
    else:
        change = round(total - drink['cost'], 2)
        resources['money'] += drink['cost']
        if change > 0:
            print(f"Here is ${change} in change.")
        return True

def make_coffee(drink):
    """Deducts the ingredients from the resources to make the drink."""
    for ingredient in drink['ingredients']:
        resources[ingredient] -= drink['ingredients'][ingredient]
    print(f"Here is your {user_choice}. Enjoy!")


# Start the program
while True:
    user_choice = input("What would you like? (espresso/latte/cappuccino): ")
    
    # Turn off the coffee machine
    if user_choice == "off":
        break
    
    # Print report of the current resource values
    elif user_choice == "report":
        report()
    
    # Make a drink
    else:
        drink = menu[user_choice]
        if check_resources(drink):
            total = process_coins()
            if check_transaction_successful(drink, total):
                make_coffee(drink)

·Lanky Lorenzo !cbHHk9GdPo2.8 years ago, 1 minute later, 46 minutes after the original post[T] [B] #637,244

I gave it the program requirements, a list of features. The program works, which is kind of scary. The program is nearly identical to the solution given, which was written a few years ago.

(Edited 6 minutes later.)


·Anonymous A (OP) — 2.8 years ago, 13 minutes later, 1 hour after the original post[T] [B] #637,245

@637,243 (Lanky Lorenzo !cbHHk9GdPo)
It can put the code in a separate window too.

+ !tr.t4dJfuU2.8 years ago, 21 hours later, 22 hours after the original post[T] [B] #637,278

@previous (A)
Ask AI to review your code.

Start a new topic to continue this conversation.
Or browse the latest topics.

:

You are required to fill in a captcha for your first 5 posts. Sorry, but this is required to stop people from posting while drunk. Please be responsible and don't drink and post!
If you receive this often, consider not clearing your cookies.



Please familiarise yourself with the rules and markup syntax before posting.