4 ms·
Thank you for the examples. I definitely haven't used it much for that type of use case but I'll keep that in mind. I don't want to give up too much info about
by uejfiweun 2y ago
Thank you for the examples. I definitely haven't used it much for that type of use case but I'll keep that in mind. I don't want to give up too much info about my project because it would probably dox me, but it essentially involves generating consistent geometric shapes in a 2d array. Like the following:
0 0 0 0 0 0
0 0 0 0 0 0
0 0 1 1 1 0
0 0 1 1 1 0
0 0 1 1 1 0
Both current flavors of GPT are unable to generate spatially consistent shapes according to my specifications. Who knows, maybe they will improve in this realm in GPT-5 with the inclusion of their rumored Q* algorithm.
- mewpmewp2 2y agoI imagine that I would want to ask for this output differently, as a function that would output this rather than it to write out those tokens. For example: Give a JavaScript function that will output 0 and 1 tokens to render a rectangle on a 2d array. Example output: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 It responded: function generateRectangle(rows, cols, rectStartRow, rectStartCol, rectHeight, rectWidth) { // Create a 2D array filled with 0s let array = Array.from({ length: rows }, () => Array(cols).fill(0)); // Fill the rectangle area with 1s for (let i = rectStartRow; i < rectStartRow + rectHeight; i++) { for (let j = rectStartCol; j < rectStartCol + rectWidth; j++) { array[i][j] = 1; } } return array; } function printArray(array) { array.forEach(row => { console.log(row.join(' ')); }); } // Example usage: let rows = 5; let cols = 6; let rectStartRow = 2; let rectStartCol = 2; let rectHeight = 3; let rectWidth = 3; let rectangleArray = generateRectangle(rows, cols, rectStartRow, rectStartCol, rectHeight, rectWidth); printArray(rectangleArray); ------ And then I asked for a triangle instead, but still with square output example ----- function generateTriangle() { const size = 10; const field = Array.from({ length: size }, () => Array(size).fill(0)); for (let i = 0; i < size; i++) { for (let j = 0; j <= i; j++) { field[size - 1 - i][j] = 1; } } return field; } function printField(field) { for (let row of field) { console.log(row.join(' ')); } } const triangleField = generateTriangle(); printField(triangleField); 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ---- Then I would execute the function programmatically to generate these tokens.
- uejfiweun 2y agoHuh. Very interesting idea, I didn't even think to approach the prompt this way. I'm gonna try this out and report back. Thanks!