{"id":1716,"date":"2026-03-04T11:44:43","date_gmt":"2026-03-04T19:44:43","guid":{"rendered":"http:\/\/macdaddy4sure.ai\/?p=1716"},"modified":"2026-03-06T15:15:06","modified_gmt":"2026-03-06T23:15:06","slug":"swimming-mode-update","status":"publish","type":"post","link":"http:\/\/macdaddy4sure.ai\/index.php\/2026\/03\/04\/swimming-mode-update\/","title":{"rendered":"Swimming Mode Update"},"content":{"rendered":"\n<p>Working with the AI to produce algorithms for swim strokes! Here is a preview of what will be included in the next release.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\n    Copyright(C) 2026 Tyler Crockett | Macdaddy4sure.ai\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http:&#47;&#47;www.apache.org\/licenses\/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n*\/\n\n#include \"AugmentedIntelligence.hpp\"\n#include \"Swimming.hpp\"\n#include \"Kinesthetics.hpp\"\n#include \"Settings.hpp\"\n#include \"Thought.hpp\"\n#include \"Working-Memory.hpp\"\n#include \"Utilities.hpp\"\n\nusing namespace std;\n\nvoid _Swimming::EggBeater()\n{\n    current_stroke = \"egg beater\";\n    \/\/ Simulation options\n    const int NUM_STEPS = 1000; \/\/ Number of time steps\n    double dt = 0.01; \/\/ Time step size (s)\n\n    \/\/ Initial conditions\n    double theta_L = THETA_OFFSET;\n    double theta_R = THETA_OFFSET - AMPLITUDE * std::cos(OMEGA * 0);\n    double phi_L = KNEE_AMPLITUDE * std::sin(2 * OMEGA * 0);\n    double phi_R = -KNEE_AMPLITUDE * std::cos(2 * OMEGA * 0);\n\n    \/\/ Arrays to store the angles and times\n    double* theta_L_array = new double&#91;NUM_STEPS];\n    double* theta_R_array = new double&#91;NUM_STEPS];\n    double* phi_L_array = new double&#91;NUM_STEPS];\n    double* phi_R_array = new double&#91;NUM_STEPS];\n    double* time_array = new double&#91;NUM_STEPS];\n\n    \/\/ Simulate the egg beater stroke\n    for (int i = 0; i &lt; NUM_STEPS; i++)\n    {\n        \/\/ Store the current angles and time in arrays\n        theta_L_array&#91;i] = theta_L;\n        theta_R_array&#91;i] = theta_R;\n        phi_L_array&#91;i] = phi_L;\n        phi_R_array&#91;i] = phi_R;\n        time_array&#91;i] = i * dt;\n\n        \/\/ Calculate the derivatives using Euler's method\n        double dtheta_L_dt, dtheta_R_dt, dphi_L_dt, dphi_R_dt;\n        _Swimming::eggBeaterStroke(theta_L, theta_R, phi_L, phi_R, i * dt, dtheta_L_dt, dtheta_R_dt, dphi_L_dt, dphi_R_dt);\n\n        \/\/ Update the angles\n        theta_L += dtheta_L_dt * dt;\n        theta_R += dtheta_R_dt * dt;\n        phi_L += dphi_L_dt * dt;\n        phi_R += dphi_R_dt * dt;\n    }\n\n    \/\/ Print the results\n    std::cout &lt;&lt; \"Time (s)\\tLeft Leg Angle (rad)\\tRight Leg Angle(rad)\\tLeft Knee Joint Angle(rad)\\tRight Knee Joint Angle(rad)\" &lt;&lt; std::endl;\n    for (int i = 0; i &lt; NUM_STEPS; i++)\n    {\n        std::cout &lt;&lt; time_array&#91;i] &lt;&lt; \"\\t\" &lt;&lt; theta_L_array&#91;i] &lt;&lt; \"\\t\\t\" &lt;&lt; theta_R_array&#91;i] &lt;&lt; \"\\t\\t\" &lt;&lt; phi_L_array&#91;i] &lt;&lt; \"\\t\\t\" &lt;&lt; phi_R_array&#91;i] &lt;&lt; std::endl;\n    }\n\n    \/\/ Clean up memory\n    delete&#91;] theta_L_array;\n    delete&#91;] theta_R_array;\n    delete&#91;] phi_L_array;\n    delete&#91;] phi_R_array;\n    delete&#91;] time_array;\n}\n\n\/\/ Function to calculate the derivative of each leg's angle\nvoid _Swimming::eggBeaterStroke(double theta_L, double theta_R, double phi_L, double phi_R, double time, double&amp; dtheta_L_dt, double&amp; dtheta_R_dt, double&amp;dphi_L_dt, double&amp; dphi_R_dt)\n{\n    \/\/ Calculate the derivatives\n    dtheta_L_dt = SMOOTHING_FACTOR * (_Swimming::calculateLegTargetAngle(time, true) - theta_L);\n    dtheta_R_dt = SMOOTHING_FACTOR * (_Swimming::calculateLegTargetAngle(time, false) - theta_R);\n    dphi_L_dt = 2 * SMOOTHING_FACTOR * (_Swimming::calculateKneeTargetAngle(time, true) - phi_L);\n    dphi_R_dt = 2 * SMOOTHING_FACTOR * (_Swimming::calculateKneeTargetAngle(time, false) - phi_R);\n}\n\n\/\/ Function to calculate the target angle for each leg\ndouble _Swimming::calculateLegTargetAngle(double time, bool isLeftLeg)\n{\n    if (isLeftLeg)\n    {\n        return THETA_OFFSET + AMPLITUDE * std::sin(OMEGA * time);\n    }\n    else\n    {\n        return THETA_OFFSET - AMPLITUDE * std::cos(OMEGA * time);\n    }\n}\n\n\/\/ Function to calculate the target angle for each knee joint\ndouble _Swimming::calculateKneeTargetAngle(double time, bool isLeftLeg)\n{\n    if (isLeftLeg)\n    {\n        return KNEE_AMPLITUDE * std::sin(2 * OMEGA * time);\n    }\n    else\n    {\n        return -KNEE_AMPLITUDE * std::cos(2 * OMEGA * time);\n    }\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Working with the AI to produce algorithms for swim strokes! Here is a preview of what will be included in the next release.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1716","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/1716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/comments?post=1716"}],"version-history":[{"count":2,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/1716\/revisions"}],"predecessor-version":[{"id":1718,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/1716\/revisions\/1718"}],"wp:attachment":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/media?parent=1716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/categories?post=1716"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/tags?post=1716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}