angrysaveruk
Member of DD Central
Back and to the left..
Posts: 1,016
Likes: 646
|
Post by angrysaveruk on Jan 3, 2023 11:17:13 GMT
It did not look this up on the internet. Still in the development phase but I am impressed. Are you sure about that? Microsoft's Github's Co-pilot uses ChatGPT and it definitely scrapes Github for code (and has current legal issues as a result). I'm not saying you're wrong, just...
According to the blurb on this implementation it does not. It might have been trained using GitHub of course. Of course it is not magic it just using existing code at some level but it has the ability to combine things from what I can see and does more than just copies and pastes existing code.
|
|
keitha
Member of DD Central
2024, hopefully the year I get out of P2P
Posts: 3,875
Likes: 2,313
|
Post by keitha on Jan 3, 2023 11:25:47 GMT
Oh, Mickey, you're so fine You're so fine, you blow my mind Hey, Mickey, hey, Mickey Oh, Mickey, you're so fine You're so fine, you blow my mind Hey, Mickey, hey, Mickey Oh, Mickey, you're so fine You're so fine, you blow my mind
|
|
angrysaveruk
Member of DD Central
Back and to the left..
Posts: 1,016
Likes: 646
|
Post by angrysaveruk on Jan 3, 2023 12:10:49 GMT
Ok here is another example sorry it is code based but this is where this AI is especially good. This code is fairly complex and has been written by the AI, it is very unlikely it has seen exact problem before
Q: can you make a function in C that puts all the prime numbers between 1 and 100 in an array and then doubles them.
A: Yes I can! Here it is:
#define MAX_SIZE 100
int prime[MAX_SIZE]; // array to store prime numbers int index = 0; // index of the next available slot in the array
void find_primes(int n) { for (int i = 2; i <= n; i++) { int is_prime = 1; for (int j = 2; j < i; j++) { if (i % j == 0) { is_prime = 0; break; } } if (is_prime) { prime[index] = i; index++; } } }
void double_primes() { for (int i = 0; i < index; i++) { prime *= 2; } }
int main() { find_primes(100); double_primes();
for (int i = 0; i < index; i++) { printf("%d ", prime); } printf("\n");
return 0; }
|
|
|
Post by Deleted on Jan 3, 2023 12:20:48 GMT
Ok here is another example sorry it is code based but this is where this AI is especially good. This code is fairly complex and has been written by the AI, it is very unlikely it has seen exact problem before
Q: can you make a function in C that puts all the prime numbers between 1 and 100 in an array and then doubles them.
A: Yes I can! Here it is:
#define MAX_SIZE 100
int prime[MAX_SIZE]; // array to store prime numbers int index = 0; // index of the next available slot in the array
void find_primes(int n) { for (int i = 2; i <= n; i++) { int is_prime = 1; for (int j = 2; j < i; j++) { if (i % j == 0) { is_prime = 0; break; } } if (is_prime) { prime[index] = i; index++; } } }
void double_primes() { for (int i = 0; i < index; i++) { prime *= 2; } }
int main() { find_primes(100); double_primes();
for (int i = 0; i < index; i++) { printf("%d ", prime); } printf("\n");
return 0; }
You've just provided a great example of the 'authoritative bullsh!t' that people are complaining about I can see problems with that code just by eyeballing it.
|
|
angrysaveruk
Member of DD Central
Back and to the left..
Posts: 1,016
Likes: 646
|
Post by angrysaveruk on Jan 3, 2023 12:23:34 GMT
I then asked it this
Q: Can you do that in C++ using std::vector and combining find_primes and double_primes into a single function?
A: Yes I can! Here it is:
#include <iostream> #include <vector>
void find_and_double_primes(int n, std::vector<int>& primes) { for (int i = 2; i <= n; i++) { int is_prime = 1; for (int j = 2; j < i; j++) { if (i % j == 0) { is_prime = 0; break; } } if (is_prime) { primes.push_back(i * 2); } } }
int main() { std::vector<int> primes; find_and_double_primes(100, primes);
for (int x : primes) { std::cout << x << " "; } std::cout << std::endl;
return 0; }
Incredible...
|
|
angrysaveruk
Member of DD Central
Back and to the left..
Posts: 1,016
Likes: 646
|
Post by angrysaveruk on Jan 3, 2023 12:27:11 GMT
Ok here is another example sorry it is code based but this is where this AI is especially good. This code is fairly complex and has been written by the AI, it is very unlikely it has seen exact problem before
Q: can you make a function in C that puts all the prime numbers between 1 and 100 in an array and then doubles them.
A: Yes I can! Here it is:
You've just provided a great example of the 'authoritative bullsh!t' that people are complaining about I can see problems with that code just by eyeballing it.
What problem? If it is to do with a missing [ ] it is to do with the forum not liking that for some reason. I compiled it and works fine.
|
|
agent69
Member of DD Central
Posts: 5,625
Likes: 4,195
|
Post by agent69 on Jan 3, 2023 12:43:54 GMT
Oh, Mickey, you're so fine You're so fine, you blow my mind Hey, Mickey, hey, Mickey Oh, Mickey, you're so fine You're so fine, you blow my mind Hey, Mickey, hey, Mickey Oh, Mickey, you're so fine You're so fine, you blow my mind Courtesy of American singer and part time adult actress Toni Basil.
|
|
|
Post by bernythedolt on Jan 3, 2023 12:45:40 GMT
Ok here is another example sorry it is code based but this is where this AI is especially good. This code is fairly complex and has been written by the AI, it is very unlikely it has seen exact problem before
Q: can you make a function in C that puts all the prime numbers between 1 and 100 in an array and then doubles them.
A: Yes I can! Here it is:
#define MAX_SIZE 100
int prime[MAX_SIZE]; // array to store prime numbers int index = 0; // index of the next available slot in the array
void find_primes(int n) { for (int i = 2; i <= n; i++) { int is_prime = 1; for (int j = 2; j < i; j++) { if (i % j == 0) { is_prime = 0; break; } } if (is_prime) { prime[index] = i; index++; } } }
void double_primes() { for (int i = 0; i < index; i++) { prime *= 2; } }
int main() { find_primes(100); double_primes();
for (int i = 0; i < index; i++) { printf("%d ", prime); } printf("\n");
return 0; }
Impressive, if not very efficient code. The variable j doesn't need to increment to i, only to its square root. Also a typo involving the square brackets problem again in the (screen rendering of) double_primes function, which I believe should read prime [ i ] *=2; The problem, I think, is BBCode takes [ i ] as an instruction to switch to italics font. EDIT: My workaround is to place a space each side of the i.
|
|
iRobot
Member of DD Central
Posts: 1,657
Likes: 2,450
|
Post by iRobot on Jan 3, 2023 12:58:05 GMT
Ok here is another example sorry it is code based but this is where this AI is especially good. This code is fairly complex and has been written by the AI, it is very unlikely it has seen exact problem before
Q: can you make a function in C that puts all the prime numbers between 1 and 100 in an array and then doubles them.
A: Yes I can! Here it is:
The problem, I think, is BBCode takes [ i ] as an instruction to switch to italics font. EDIT: My workaround is to place a space each side of the i.Or, for blocks of code, you can use the 'Insert Code' option: "Insert Code: If you have some coding to share, you can use the code box to isolate the code from the rest of your message. This code box will prevent any styling or smiley images from appearing within the code you provide, allowing your code to display as intended. To add a code box to your message, click the Insert Code button and in the message area you should see an outline of a table, with default text that reads "insert code here". Replace this default text with the code you would like to share in your post." [source]
|
|
|
Post by Badly Drawn Stickman on Jan 3, 2023 13:24:55 GMT
01001111 01101000 00100000 01100100 01100101 01100001 01110010 00100000 01110011 01101111 01101101 01100101 01100010 01101111 01100100 01111001 00100000 01101000 01100001 01110011 00100000 01100001 01100011 01110100 01101001 01110110 01100001 01110100 01100101 01100100 00100000 01100001 01101100 01101100 00100000 01110100 01101000 01100101 00100000 01100011 01101111 01100100 01100101 00100000 01101110 01100101 01110010 01100100 01110011
|
|
littleoldlady
Member of DD Central
Running down all platforms due to age
Posts: 3,017
Likes: 1,835
|
Post by littleoldlady on Jan 3, 2023 13:32:27 GMT
01001111 01101000 00100000 01100100 01100101 01100001 01110010 00100000 01110011 01101111 01101101 01100101 01100010 01101111 01100100 01111001 00100000 01101000 01100001 01110011 00100000 01100001 01100011 01110100 01101001 01110110 01100001 01110100 01100101 01100100 00100000 01100001 01101100 01101100 00100000 01110100 01101000 01100101 00100000 01100011 01101111 01100100 01100101 00100000 01101110 01100101 01110010 01100100 01110011 Don't be rude!
|
|
agent69
Member of DD Central
Posts: 5,625
Likes: 4,195
|
Post by agent69 on Jan 3, 2023 13:51:04 GMT
01001111 01101000 00100000 01100100 01100101 01100001 01110010 00100000 01110011 01101111 01101101 01100101 01100010 01101111 01100100 01111001 00100000 01101000 01100001 01110011 00100000 01100001 01100011 01110100 01101001 01110110 01100001 01110100 01100101 01100100 00100000 01100001 01101100 01101100 00100000 01110100 01101000 01100101 00100000 01100011 01101111 01100100 01100101 00100000 01101110 01100101 01110010 01100100 01110011
001100010010011110100001101101110011
|
|
mrk
Posts: 807
Likes: 753
|
Post by mrk on Jan 3, 2023 14:00:18 GMT
The problem, I think, is BBCode takes [ i ] as an instruction to switch to italics font. EDIT: My workaround is to place a space each side of the i.Or, for blocks of code, you can use the 'Insert Code' option: "Insert Code: If you have some coding to share, you can use the code box to isolate the code from the rest of your message. This code box will prevent any styling or smiley images from appearing within the code you provide, allowing your code to display as intended. To add a code box to your message, click the Insert Code button and in the message area you should see an outline of a table, with default text that reads "insert code here". Replace this default text with the code you would like to share in your post." [source]Or you could have asked ChatGPT
|
|
|
Post by bernythedolt on Jan 3, 2023 14:07:14 GMT
01001111 01101000 00100000 01100100 01100101 01100001 01110010 00100000 01110011 01101111 01101101 01100101 01100010 01101111 01100100 01111001 00100000 01101000 01100001 01110011 00100000 01100001 01100011 01110100 01101001 01110110 01100001 01110100 01100101 01100100 00100000 01100001 01101100 01101100 00100000 01110100 01101000 01100101 00100000 01100011 01101111 01100100 01100101 00100000 01101110 01100101 01110010 01100100 01110011 1001000 1100001 1110000 1110000 1111001 100000 1001110 1100101 1110111 100000 1011001 1100101 1100001 1110010 100000 1110100 1101111 100000 1111001 1101111 1110101 100000 1110100 1101111 1101111 100000 111011 101101 101001
|
|
|
Post by Deleted on Jan 3, 2023 14:19:01 GMT
01001111 01101000 00100000 01100100 01100101 01100001 01110010 00100000 01110011 01101111 01101101 01100101 01100010 01101111 01100100 01111001 00100000 01101000 01100001 01110011 00100000 01100001 01100011 01110100 01101001 01110110 01100001 01110100 01100101 01100100 00100000 01100001 01101100 01101100 00100000 01110100 01101000 01100101 00100000 01100011 01101111 01100100 01100101 00100000 01101110 01100101 01110010 01100100 01110011 1001000 1100001 1110000 1110000 1111001 100000 1001110 1100101 1110111 100000 1011001 1100101 1100001 1110010 100000 1110100 1101111 100000 1111001 1101111 1110101 100000 1110100 1111101 1101111 1101111 100000 111011 101101 101001 fixed that for you
|
|