{"id":1130,"date":"2024-01-30T19:29:39","date_gmt":"2024-01-30T19:29:39","guid":{"rendered":"https:\/\/beams-experiments.com\/?page_id=1130"},"modified":"2025-09-28T06:39:53","modified_gmt":"2025-09-28T05:39:53","slug":"alternate-uses-task-gpt","status":"publish","type":"page","link":"https:\/\/beams-experiments.com\/index.php\/alternate-uses-task-gpt\/","title":{"rendered":"Alternate Uses Task"},"content":{"rendered":"\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Alternate Uses Task (AUT)<\/title>\n    <style>\n          #scoreButton {\n            display: block;\n            background-color: #007bff;\n            color: white;\n            padding: 10px 20px;\n            margin: 20px auto;\n            font-size: 16px;\n            border: none;\n            border-radius: 5px;\n            cursor: not-allowed; \/* Initially not clickable *\/\n            opacity: 0.5; \/* Initially semi-transparent *\/\n        }\n        #scoreButton:enabled {\n            cursor: pointer;\n            opacity: 1.0; \/* Full opacity when enabled *\/\n        }\n        #timer {\n    font-size: 2em;\n    color: red;\n    position: fixed; \/* Changed from absolute to fixed *\/\n    top: 50%; \/* Adjusted to be in the middle of the screen vertically *\/\n    left: 50%; \/* Center horizontally *\/\n    transform: translate(-50%, -50%); \/* Adjust for exact centering *\/\n}\n        .questionnaire {\n            margin: 20px;\n            text-align: left;\n        }\n.spinner {\n    border: 8px solid #f3f3f3; \/* Light grey *\/\n    border-top: 8px solid #3498db; \/* Blue *\/\n    border-radius: 50%;\n    width: 60px;\n    height: 60px;\n    animation: spin 2s linear infinite;\n    margin: 20px auto; \/* Center horizontally *\/\n  }\n\n  @keyframes spin {\n    0% { transform: rotate(0deg); }\n    100% { transform: rotate(360deg); }\n  }\n #scoreDisplay {\n    font-size: 1.5em; \/* Increase font size *\/\n    color: #2c3e50;  \/* Dark blue-gray color for the text *\/\n    text-align: center; \/* Center the text *\/\n    background-color: #f0f4f7; \/* Light background to highlight the score *\/\n    padding: 10px; \/* Add some padding around the text *\/\n    border-radius: 10px; \/* Rounded corners *\/\n    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); \/* Add a subtle shadow *\/\n    margin-top: 20px; \/* Add some space above the score *\/\n  }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"questionnaire\">\n        <p id=\"taskDescription\">Your initial task is to come up with as many unique and unconventional uses for a <strong id=\"randomObjectDisplay\"><\/strong> as possible. Please fill in the table below, briefly naming each use in the corresponding row. Be creative. You have two minutes to complete this task. Once the allocated time is up, click on Submit to see your originality score.<\/p>\n        \n        <div id=\"timer\">00:00<\/div>\n        <table id=\"tableInputArea\"><\/table>\n        <button id=\"scoreButton\" disabled>Submit<\/button>\n<div id=\"loadingSpinner\" class=\"spinner\" style=\"display:none;\"><\/div>\n\n        <div id=\"scoreResult\"><\/div>\n    <\/div>\n<div id=\"scoreDisplay\"><\/div>\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.6.0.min.js\"><\/script>\n    <script>\n       $(document).ready(function() {\n    const objects = [\"brick\", \"newspaper\", \"key\", \"shoe\", \"tire\", \"knife\", \"table\"];\n    const randomIndex = Math.floor(Math.random() * objects.length);\n    \/\/const AUTObject = objects[randomIndex];\n    const AUTObject = \"book\";\n    document.getElementById(\"randomObjectDisplay\").textContent = AUTObject;\n\n    var timerDuration = 120; \/\/ Duration in seconds\n    startTimer(timerDuration);\n\n    \/\/ Create 30 table rows for input with row numbers\n    for (var i = 0; i < 30; i++) {\n        $('#tableInputArea').append('<tr><td>' + (i + 1) + '<\/td><td><input type=\"text\" name=\"user' + i + '\"><\/td><\/tr>');\n    }\n\n    function startTimer(duration) {\n        var timer = duration, minutes, seconds;\n        var interval = setInterval(function() {\n            minutes = parseInt(timer \/ 60, 10);\n            seconds = parseInt(timer % 60, 10);\n\n            minutes = minutes < 10 ? \"0\" + minutes : minutes;\n            seconds = seconds < 10 ? \"0\" + seconds : seconds;\n\n            $('#timer').text(minutes + \":\" + seconds);\n            if (--timer < 0) {\n                clearInterval(interval);\n                alert('Your time is up. Click Next to proceed.');\n                $('#tableInputArea input').prop('disabled', true);\n                $('#scoreButton').removeAttr('disabled').css({\n                    'cursor': 'pointer',\n                    'opacity': '1.0'\n                });\n            }\n        }, 1000);\n    }\n\n    $('#scoreButton').click(function() {\n        var AUTText = '';\n        $('#tableInputArea input[type=\"text\"]').each(function() {\n            var inputVal = $(this).val();\n            if (inputVal.trim() !== '') {\n                AUTText += inputVal + '\\n';\n            }\n        });\n\n        const data = new FormData();\n        data.append('AUTText', AUTText);\n        data.append('AUTObject', AUTObject);\n\/\/ Show the spinner when processing starts\n    document.getElementById('loadingSpinner').style.display = 'block';\n        \/\/ First, send the data to sendAUTTextGPT.php to get the userID\n        fetch('https:\/\/www.beams-experiments.com\/sendAUTTextGPT.php', {\n            method: 'POST',\n            body: data \/\/ Pass the FormData object directly as the body\n        })\n        .then(response => {\n            if (!response.ok) {\n                throw new Error(`HTTP error! status: ${response.status}`);\n            }\n            return response.text(); \/\/ Assuming the response is plain text (userID)\n        })\n        .then(userID => {\n            console.log('Received userID:', userID);\n            \/\/ Now we have the userID, append it to the FormData object\n            data.append('userID', userID);\n\n            \/\/ Fetch to getAUTTextGPT.php with the userID\n            return fetch('https:\/\/www.beams-experiments.com\/getAUTTextGPT.php', {\n                method: 'POST',\n                body: data\n            });\n        })\n        .then(response => {\n            if (!response.ok) {\n                throw new Error(`HTTP error! status: ${response.status}`);\n            }\n            console.log('Request to getAUTTextGPT.php completed successfully');\n            console.log('Response is', response);\n            \n            \/\/ Now make the request to makeAUTScoreGPT4.php\n            return fetch('https:\/\/www.beams-experiments.com\/makeAUTScoreGPT4.php', {\n                method: 'POST',\n                body: data\n            });\n        })\n        .then(response => {\n            if (!response.ok) {\n                throw new Error(`HTTP error! status: ${response.status}`);\n            }\n            return response.text(); \/\/ Assuming the response from this request contains the score\n        })\n     .then(score => {\n    \/\/ Clean up the response to remove any <br> or extraneous whitespace\n    const cleanedScore = score.replace(\/<br\\s*\\\/?>\/gi, '').trim();\n\n    \/\/ Display the cleaned score in the HTML\n    document.getElementById('scoreDisplay').textContent = `${cleanedScore} \/ 5` ;\n\/\/ Hide the spinner and show the score\n        document.getElementById('loadingSpinner').style.display = 'none';\n        document.getElementById('scoreDisplay').style.display = 'block';\n})\n\n\n        .catch(error => {\n            console.error('Fetch error:', error);\n        });\n    });\n});\n\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Alternate Uses Task (AUT) Your initial task is to come up with as many unique and unconventional uses for a as possible. Please fill in the table below, briefly naming each use in the corresponding row. Be creative. You have two minutes to complete this task. Once the allocated time is up, click on Submit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"footnotes":""},"class_list":["post-1130","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/1130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/comments?post=1130"}],"version-history":[{"count":82,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/1130\/revisions"}],"predecessor-version":[{"id":6349,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/1130\/revisions\/6349"}],"wp:attachment":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/media?parent=1130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}