LLMs as Code Assistants

Thomas Kelley
Course Subject:Computational Problem Solving in Physics, Physics 3211
Student Level:Upper level undergraduate students
Number of Students:6 students
Developed by:Thomas Kelley, Teaching Professor, College of Science

What Students Did

Students used generative AI tools of their choice to modify existing physics simulations used to model kinematics and dynamics. Starting with a simple 2D bouncing ball program they had previously created using visual python language, students prompted their selected chatbot to generate computer code that added more complex behaviors and features to the simulation. Students documented their prompts, compared the results from different AI tools, and reflected on the effectiveness of their interactions with the AI.

Purpose

The activity had a dual purpose: to give students explicit permission to use AI tools for coding assistance and to develop their ability to craft effective prompts. The instructor aimed to normalize AI as a programming resource while teaching students to critically evaluate AI-generated code.

Assessment

The activity was assessed as a checkpoint assignment graded primarily on completion. Students submitted their code and their answers to reflection questions. Reflection questions focused on whether the AI-generated code worked as intended, what issues or mistakes were encountered, which prompts were effective, and which prompts led to problematic results. Evaluation focused on whether students completed all steps and addressed the reflection questions.

Faculty Reflections

I was initially skeptical about AI in education, sharing the concerns of many of my colleagues. However, after experimenting with AI tools, I realized that these tools could be valuable supplements to learning. When I observed students using AI anyway, I decided to incorporate it explicitly. The activity went well given that all students were actively engaged and enjoyed the creative freedom to develop whatever modifications they could imagine. I recommend allowing students freedom within the activity, since too much structure can be stifling. Making space for group debriefing was also crucial to the success of the activity.


Step-by-Step Directions

Step 1Start with your existing 2D bouncing ball simulation that you created in a previous session during which AI chatbots as coding assistants were discussed.
Step 2Prompt your chosen chatbot to modify your simulation by adding more complex features (e.g., adding walls, balls, interactions, and other moving objects).
Step 3Document your AI prompts and the generated code.
Step 4Complete the reflection questions below:

  1. Did the LLM-generated code work as intended?
  2. Were there any issues or mistakes (e.g., errors, “hallucinations,” or unexpected behaviors)?
  3. Which prompts were particularly effective?
  4. Which prompts led to unintended or problematic results?
Step 5Submit both your original code and the AI-modified code along with your prompt documentation and reflection.

Related Materials

Download PDF version of this assignment

Return to AI Gallery Home