Will GPT4 be able to Mod in Games?

I tried Bing AI chat today. I asked it to write C++ code that implements a lock-free priority queue (not an easy task, mind you, but it is doable). To my surprise, it actually came up with some valid C++ code, but the code had quite a few glaring race conditions that I pointed it to, it apologized, fixed some of them, but not all, to which I pointed again, so it tried again and still fell short and that cycle continued until we ran out of the chat depth limit of 20 questions. Some of intermediate results it came up with were pretty hilarious, e.g. there was a check if a vector's number of elements was more than one (with some code to execute if true) and then in the 'else' clause of that it tried to assign something to the second element of that vector (which was guaranteed to have no more than one element in that branch of the code).

My subsequent attempts to solve this in a new chat sessions failed, as it refused to produce any C++ code itself anymore, instead providing me with links to github code or some whitepapers about the problem. I finally managed to make it write a simple (not priority) lock-free queue code in C++, but that code just doesn't work, pushing a value into an empty queue doesn't modify the head, so front() returns garbage instead of the value you just pushed there:
Code:
#include <atomic>
template <typename T>
class Queue {
    private:
        struct Node {
            T data;
            std::atomic<Node*> next;
        };
        std::atomic<Node*> head;
        std::atomic<Node*> tail;
    public:
        Queue() : head(nullptr), tail(nullptr) {
            Node* node = new Node{T(), nullptr};
            head.store(node);
            tail.store(node);
        }
        ~Queue() {
            while (Node* node = head.load()) {
                head.store(node->next.load());
                delete node;
            }
        }
        void push(const T& data) {
            Node* node = new Node{data, nullptr};
            Node* prev_tail = tail.exchange(node);
            prev_tail->next.store(node);
        }
        void pop() {
            Node* old_head = head.load();
            Node* new_head = old_head->next.load();
            while (head.load() != old_head) {
                old_head = head.load();
                new_head = old_head->next.load();
            }
            if (old_head == tail.load()) {
                return;
            }
            head.store(new_head);
            delete old_head;
        }
        bool empty() const {
            return head.load() == tail.load();
        }
        const T& front() const {
            return head.load()->data;
        }
};

I think you might use that if you need some simple boilerplate code that you're too lazy to write yourself and for some reason it's not available as a library, but you'll have to double-check that the code works and anything remotely complex is still out of reach, so I don't expect any miracles here.
 
Last edited:
Looks like people thinking this chatbot thing is like Second Coming of Jesus Christ have to wait of his 3rd comming :roflmao:

jesus 2nd.jpg
 
I'm not one of those, I've been an AI skeptic for a long time and still is. I just wanted to see if claims about computer programmers' jobs soon being replaced by AI bots hold any water.
Dont take my comment in any way as some kind of misplaced patronizing.
Because to the contrary of me you are testing this bot out.
But the reason Im pretty relaxed about this socalled artificially "intelligence" is because I have heard some lectures by IT scientist actually working with this stuff.
And after that I was a bit stunned how simple (or plain unintelligent) these bots are functioning.:whistling:

BæTheWay: They are just collecting words and sentences that normally (statistically) are used in the context they are forced into by the questions asked to them.:rolleyes:
 
Last edited:
Dont take my comment in any way as some kind of misplaced patronizing.
Because to the contrary of me you are testing this bot out.
But the reason Im pretty relaxed about this socalled artificially "intelligence" is because I have heard some lectures by IT scientist actually working with this stuff.
And after that I was a bit stunned how simple (or plain unintelligent) these bots are functioning.:whistling:

CatsAreTheWorstDogs: They are just collecting words and sentences that normally (statistically) are used in the context they are forced into by the questions asked to them.:rolleyes:
Yeah, that's my general understanding of how these things work as well. I still don't quite understand how this approach results in a valid (I just mean compilable, not correctly working) C++ code though. But it does explain how they are so terrible at middle-school grade math

I think the main danger is that they can quickly generate tons of genuine-looking (at least at first glance) content, so pretty soon the whole internet could be overwhelmed by that garbage. Even now when I try to find something using a search engine, I often get the first page that consists mostly of the links to bot-generated content, but it's of pretty bad quality and you can easily spot that it's fake and was not written by a human being. With this new wave of BS generators it's going to be much harder to tell.
 
how this approach results in a valid (I just mean compilable, not correctly working) C++ code
Computer language grammar and syntax are trivial compared to natural language,
and they have plenty of GitHub etc on which to train.
My experience was that AI got syntax correct, but code did not execute requested functions.
 

Latest News

How are you going to watch 24 hours of Le Mans

  • On national tv

    Votes: 47 32.4%
  • Eurosport app/website

    Votes: 44 30.3%
  • WEC app/website

    Votes: 25 17.2%
  • Watch party

    Votes: 10 6.9%
  • At a friends house

    Votes: 3 2.1%
  • At Le Mans

    Votes: 16 11.0%
Back
Top