The AI discussion thread

Page 34 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Red Squirrel

No Lifer
May 24, 2003
69,219
13,001
126
www.anyf.ca
I'm surprised ChatGPT is actually coded in python. Seems C++ would be more optimized for that sort of thing.

If you want to USE C++ you need to learn it first. Aka write a program in it. You need to have a goal in mind of what you want to write and what you want the program to do.
 

sdifox

No Lifer
Sep 30, 2005
97,977
16,739
126
I'm a little confused, Wikipedia says that Facebook, YouTube, and Windows 11 all run on C++.

Also alot of video game engines runs on C++ such as unreal engine.
No. They were written in C++, then compiled to machine code. That is what makes it faster. Python is interpreted just in time so there is more overhead. Of course, you can also compile Python to machine code.
 
Reactions: [DHT]Osiris

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
49,253
5,812
136
Is there a app like chatgpt that runs on C++?

Google says chatgpt runs on Python, I'm trying to learn C++ because it's the language most video games use.

Help & training:



Generators:



 
Reactions: igor_kavinski

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
49,253
5,812
136
I don't want to just "LEARN" C++, I want to "USE" it.

I would rather use a program that runs on C++.

You can use C++ for the underlying code. I use ChatGPT to program Python GUI's to quickly build custom programs:



 
Reactions: igor_kavinski

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
49,253
5,812
136
I'm a little confused, Wikipedia says that Facebook, YouTube, and Windows 11 all run on C++.

Also alot of video game engines runs on C++ such as unreal engine.

Two parts:

1. Game engine

2. Game design

Unity & Unreal are game engines that have lots of tools used to reduce the amount of time & effort required to program. Sort of like building a house by cutting down trees vs. just buying pre-cut lumber. You can use ChatGPT to make games:


 
Reactions: igor_kavinski
Jul 27, 2020
22,307
15,567
146
I don't want to just "LEARN" C++, I want to "USE" it.

I would rather use a program that runs on C++.
First of all, C++ is not a beginner friendly language.

Two people can say "I know C++". One could be a person who has compiled a "Hello World" C++ program and the other could be Bjarne Stroustrup (the actual inventor of C++).

A very proficient sysadmin (rachelbythebay.com) with intermediate (and maybe advanced) C language capabilities hated C++, until someone with C++ expertise showed her how to write C++ code that uses C++'s strengths rather than using it superficially and now she actually likes C++. That should tell you that C++ is not for the faint of heart.

If you seriously want to do game programming, start here: https://github.com/poyea/scrabble

First step: Install Visual Studio

2nd step: Install Git

3rd step: Clone that repo

4th step: Double click the Scrabble.sln and then "Build" it using Visual Studio. Once that is finished, you will find an EXE file in the repo folder. Double click it and that's the game.

Now open the source file of that game and tinker with it. Try to recognize familiar things in it (like colors or number of rows and columns in the board etc.) and tinker with the values and see how that changes the game. There might be useful comments in the source file. Otherwise, copy any code snippet you want to understand and give it to ChatGPT to explain it to you.

Once you have thoroughly understood everything, try writing your own version of this game on your own. It will take a long time. But once you succeed, you will finally have the confidence to pursue harder stuff.

BUT the most important thing: try to do things on your own.
 

pmv

Lifer
May 30, 2008
14,205
9,047
136
First of all, C++ is not a beginner friendly language.

Two people can say "I know C++". One could be a person who has compiled a "Hello World" C++ program and the other could be Bjarne Stroustrup (the actual inventor of C++).

A very proficient sysadmin (rachelbythebay.com) with intermediate (and maybe advanced) C language capabilities hated C++, until someone with C++ expertise showed her how to write C++ code that uses C++'s strengths rather than using it superficially and now she actually likes C++. That should tell you that C++ is not for the faint of heart.

If you seriously want to do game programming, start here: https://github.com/poyea/scrabble

First step: Install Visual Studio

2nd step: Install Git

3rd step: Clone that repo

4th step: Double click the Scrabble.sln and then "Build" it using Visual Studio. Once that is finished, you will find an EXE file in the repo folder. Double click it and that's the game.

Now open the source file of that game and tinker with it. Try to recognize familiar things in it (like colors or number of rows and columns in the board etc.) and tinker with the values and see how that changes the game. There might be useful comments in the source file. Otherwise, copy any code snippet you want to understand and give it to ChatGPT to explain it to you.

Once you have thoroughly understood everything, try writing your own version of this game on your own. It will take a long time. But once you succeed, you will finally have the confidence to pursue harder stuff.

Trying to learn to program in C++ (after starting with BASIC and moving on to Pascal and then FORTRAN77) was the point where I decided that my brain was now full. I mean, as you imply, I could write programs with it, but I was never at all sure I was using the language as it was intended to be used. Couldn't get my head around when to use 'objects' and what the correct way to think about the structure of a program using Object methods was. I suspect I was just writing old school procedural programs using C++ syntax.
 
Reactions: igor_kavinski
Jul 27, 2020
22,307
15,567
146
I suspect I was just writing old school procedural programs using C++ syntax.
That's true for a huge number of people with CS degrees. If you start with procedural programming, you are kinda screwed in making sense of OOP concepts. That's why I've seen CS curriculums where they start teaching directly with Java (but that has its own issues). But at least with Java as a starting point, you can apply your OOP concepts better in C++.

A good starting point is the "principles" book by the C++ inventor: https://www.stroustrup.com
 

Red Squirrel

No Lifer
May 24, 2003
69,219
13,001
126
www.anyf.ca
One good place to start too is client-server stuff. GUI stuff in C++ is very hard. I wouldn't start there. If you want to make a game, I would make the server in C++ and client in a language that has better built in GUI libraries, like Python. All the heavy lifting should be happening at the server anyway, the client is only displaying what the server is telling it to.

That said there are gaming engines like as Ogre for C++ that could very well be worth exploring. I always wanted to look into making a game like minecraft in C++ but never really started on anything. Games are hard, not only from a coding perspective but an artistic one. You have to design all the textures, 3D models, sounds, music etc...
 
Jul 27, 2020
22,307
15,567
146
Games are hard, not only from a coding perspective but an artistic one. You have to design all the textures, 3D models, sounds, music etc...
An LLM trained to do those things could do 80% of the heavy lifting

The big question is, HOW to train such an LLM

I suppose it would have to connect to multiple AI models at the backend, one for programming, one for 3D models, one for NPC AI, one for audio etc.
 

pmv

Lifer
May 30, 2008
14,205
9,047
136
That's true for a huge number of people with CS degrees. If you start with procedural programming, you are kinda screwed in making sense of OOP concepts. That's why I've seen CS curriculums where they start teaching directly with Java (but that has its own issues). But at least with Java as a starting point, you can apply your OOP concepts better in C++.

A good starting point is the "principles" book by the C++ inventor: https://www.stroustrup.com

Well I'm past caring now. Funnily enough I found moving from coding in assembler to being a self-taught hack BASIC programmer (in the days where you had to worry about the size of your program, and use all sorts of ploys to keep the code short even at the expense of readability or structure) to proper 'structured programming' with PASCAL or C, to be pretty straight-forward...but shifting to 'object oriented' programming was a step too far, something I never managed to fully get my head around. Felt like my brain had reached its limits at that point.
 
Jul 27, 2020
22,307
15,567
146
Felt like my brain had reached its limits at that point.
Have a look, thanks to ChatGPT:

C++:
Converting a float to a string can be done in both C and C++, but the approaches differ in terms of complexity, safety, and convenience. Below, I will show you how to perform this conversion in both languages and then explain why the C++ approach is often considered better, particularly from an Object-Oriented Programming (OOP) perspective.

C Code Example
In C, you can convert a float to a string using the sprintf function or snprintf for safer string manipulation. Here's an example using snprintf:

 
#include <stdio.h>

int main() {
    float number = 123.456;
    char buffer[50];

    // Convert float to string
    snprintf(buffer, sizeof(buffer), "%.2f", number);

    // Print the result
    printf("The float as a string is: %s
", buffer);
    return 0;
}
C++ Code Example
In C++, you can utilize the std::to_string function from the <string> header or use a std::ostringstream object for more control. Here's an example using std::to_string:

 
#include <iostream>
#include <string>

int main() {
    float number = 123.456;

    // Convert float to string
    std::string strNumber = std::to_string(number);

    // Print the result
    std::cout << "The float as a string is: " << strNumber << std::endl;
    return 0;
}
Comparison and OOP Advantages of C++
Ease of Use:

In C++, using std::to_string is straightforward and requires less boilerplate code compared to C's sprintf or snprintf. This ease of use makes the code cleaner and less error-prone.
Type Safety:

C++ provides better type safety through its standard library. The std::to_string function directly takes a float and returns a string, reducing the risk of buffer overflows or format string vulnerabilities that can occur in C.
Object-Oriented Features:

C++ supports OOP principles, allowing you to encapsulate related functionalities into classes. For example, you could create a class that represents a numeric value and includes methods for formatting it as a string. This encapsulation makes the code more modular and reusable.
Here’s a simple class that demonstrates this idea:
 
#include <iostream>
#include <string>
#include <iomanip>
#include <sstream>

class FloatConverter {
public:
    FloatConverter(float num) : number(num) {}

    std::string toString(int precision = 2) const {
        std::ostringstream oss;
        oss << std::fixed << std::setprecision(precision) << number;
        return oss.str();
    }

private:
    float number;
};

int main() {
    FloatConverter converter(123.456);
    std::cout << "The float as a string is: " << converter.toString(2) << std::endl;
    return 0;
}
In this example:

The FloatConverter class encapsulates the float value and provides a method for converting it to a string with a specified precision.
This makes the conversion reusable and allows for future extensions (e.g., more formatting options) without changing the interface.
Standard Library and Flexibility:
C++ has a rich standard library that provides many utilities for string handling, making it easier to manipulate and format strings compared to C.
In summary, while C can efficiently convert floats to strings, C++ provides a more robust, safer, and easier-to-use mechanism that benefits from OOP principles and the rich standard library, leading to more maintainable and flexible code.
 

Gizmo j

Golden Member
Nov 9, 2013
1,234
331
136
Anyone know's if you could use ChatGPT on the Nintendo Switch?

I tried googling it but i didn't get an answer.

I never had a Nintendo Switch, can you download apps like you can on a smartphone?
 

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
49,253
5,812
136
Anyone know's if you could use ChatGPT on the Nintendo Switch?

I tried googling it but i didn't get an answer.

I never had a Nintendo Switch, can you download apps like you can on a smartphone?

Stock, the Switch has a Nintendo app store for games. There are a couple apps like Youtube, but no native easy browser or ChatGPT app. There is a hidden browser that you could try ChatGPT on I guess:


tbh I just pay for the new Advanced Voice version of ChatGPT on my phone & ask it questions all day. $20a month for voice access to the world's information that reads it back to me in a human voice is kind of insane lol
 

Kaido

Elite Member & Kitchen Overlord
Feb 14, 2004
49,253
5,812
136
That's true for a huge number of people with CS degrees. If you start with procedural programming, you are kinda screwed in making sense of OOP concepts. That's why I've seen CS curriculums where they start teaching directly with Java (but that has its own issues). But at least with Java as a starting point, you can apply your OOP concepts better in C++.

A good starting point is the "principles" book by the C++ inventor: https://www.stroustrup.com

I took an Advanced C++ class in college like twenty years ago & bought the books that summer. I couldn't figure anything out ahead of time, so I emailed the author and he said yeah it's kind of difficult, definitely take the class. Turns out it was Stroustrup LOL. I was like uhhh can I also interview you for my class hahaha. Super cool guy! I failed the class & had to retake it FYI

Twitter did the same thing in terms of connecting to people doing cool stuff...everyone from the pfSense guys to John Carmack (Doom) were on there all the time back in the day!
 
Reactions: igor_kavinski

sdifox

No Lifer
Sep 30, 2005
97,977
16,739
126
I took an Advanced C++ class in college like twenty years ago & bought the books that summer. I couldn't figure anything out ahead of time, so I emailed the author and he said yeah it's kind of difficult, definitely take the class. Turns out it was Stroustrup LOL. I was like uhhh can I also interview you for my class hahaha. Super cool guy! I failed the class & had to retake it FYI

Twitter did the same thing in terms of connecting to people doing cool stuff...everyone from the pfSense guys to John Carmack (Doom) were on there all the time back in the day!
I learnt Java from James Gosling. Not that I retained the lecture or anything
 
Reactions: igor_kavinski

RnR_au

Platinum Member
Jun 6, 2021
2,205
5,271
106
I'm surprised ChatGPT is actually coded in python. Seems C++ would be more optimized for that sort of thing.
Python calls highly optimised gpu specific routines written in C/C++ to accelerate the AI task. Python is just used as a simple scripting language initiating operations and passing references to and from various data structures to be operated on.
 
Reactions: igor_kavinski
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |