7 min read

Bringing tic‑tac‑toe to life with AWS AI services

AI

ThinkTools Team

AI Research Lead

Introduction

The world of robotics and artificial intelligence has long been fascinated by the humble game of tic‑tac‑toe. Though simple, the game encapsulates the core principles of decision‑making, strategy, and real‑time interaction that are central to many AI applications. In this post we dive into RoboTic‑Tac‑Toe, an interactive system that marries physical robots, a tangible game board, and large language models (LLMs) running on AWS AI services. Players issue natural‑language commands to the robots, which then reason about the current board state, choose an optimal move, and physically place a marker on the board. The result is a seamless blend of human intent, machine reasoning, and robotic execution.

What makes this project noteworthy is not just the novelty of a robot playing tic‑tac‑toe, but the architecture that allows a language model to act as both a game‑theoretic strategist and a motion planner. By leveraging AWS’s suite of AI services—Amazon Bedrock for LLM inference, Amazon SageMaker for model hosting, and AWS RoboMaker for robot simulation and deployment—developers can build sophisticated, multimodal systems that translate high‑level natural‑language instructions into precise, coordinated physical actions. The following sections unpack the technical layers, prompt‑engineering strategies, and practical lessons that emerged during the development of RoboTic‑Tac‑Toe.

Main Content

Architecture Overview

At a high level, RoboTic‑Tac‑Toe is composed of three interacting layers: the user interface, the AI reasoning engine, and the robotic control system. The user interface is a simple web or mobile front‑end that captures voice or text commands and forwards them to the backend. The AI reasoning engine, powered by Amazon Bedrock, receives the command, parses it, and constructs a prompt that encapsulates the current board state, the player’s role, and the desired action. The prompt is sent to an LLM, which returns a structured response containing the chosen move and a short natural‑language explanation.

The robotic control system receives the move coordinates from the LLM’s output and translates them into joint‑space trajectories using ROS (Robot Operating System) nodes running on AWS RoboMaker. The robots, equipped with simple manipulators and a marker‑placement mechanism, follow the trajectory to the target cell, place the marker, and return to a ready position. Throughout this pipeline, AWS IoT Core facilitates secure, low‑latency communication between the robots and the cloud services, ensuring that latency remains well below the 200‑ms threshold required for a responsive gaming experience.

Prompt Engineering for Game Reasoning

Prompt engineering is the art of crafting input text that guides an LLM to produce the desired output. In RoboTic‑Tac‑Toe, the prompt must convey the board state in a format the model can understand, specify the player’s symbol (X or O), and request a move that maximizes the chance of winning while avoiding immediate loss.

A typical prompt looks like this:

You are a strategic AI playing tic‑tac‑toe. The board is:
1 | 2 | 3
4 | X | 6
7 | 8 | O

You are X. Choose the best next move and explain why.

The prompt includes a textual representation of the board, the player’s symbol, and a clear instruction. The LLM is instructed to output the move as a cell number and a brief justification. This approach leverages the LLM’s natural‑language understanding while keeping the response format predictable for downstream parsing.

During development, we experimented with different board notations—coordinate pairs, grid indices, and even emojis—to determine which representation yielded the most reliable predictions. The numerical cell notation proved most robust, as it aligns with the LLM’s training data on simple puzzles and reduces ambiguity.

Orchestrating Robot Movements

Translating a cell number into a physical action involves several sub‑tasks: localization, motion planning, and execution. The robots are equipped with an overhead camera that provides a global view of the board. Using computer vision pipelines on AWS Lambda, the camera feed is processed to detect the board’s corners and compute a homography that maps pixel coordinates to real‑world positions.

Once the target cell’s coordinates are known, the motion planner—implemented as a ROS node—generates a collision‑free trajectory for the robot’s arm. The trajectory is discretized into waypoints that respect joint limits and speed constraints. The robot’s firmware, running on an NVIDIA Jetson platform, receives the trajectory via ROS topics and executes it in real time. After placing the marker, the robot publishes a status message back to the cloud, allowing the LLM to update the board state and continue the game.

This tight integration between perception, planning, and execution is made possible by AWS RoboMaker’s managed ROS environment, which abstracts away many of the complexities of deploying ROS across distributed hardware.

Natural Language Interaction

One of the most compelling aspects of RoboTic‑Tac‑Toe is the ability for players to issue commands in plain English. Commands such as “Place an X in the top left corner” or “I want to play as O, start the game” are parsed by an Amazon Comprehend model that extracts intent and entities. The extracted intent is then mapped to a higher‑level action that the LLM can process.

The natural‑language interface not only lowers the barrier to entry for non‑technical users but also demonstrates how LLMs can serve as conversational agents that bridge human intent and robotic action. In practice, we found that providing a small set of canonical command templates—paired with a fallback “I don’t understand” response—improved user satisfaction and reduced the number of failed interactions.

Challenges and Lessons Learned

Building RoboTic‑Tac‑Toe highlighted several practical challenges that are instructive for anyone looking to combine LLMs with robotics.

  1. Latency Management: Even though Bedrock’s inference latency is typically under 200 ms, network hops between the robot, IoT Core, and Bedrock can add jitter. We mitigated this by caching recent board states locally on the robot and using a lightweight rule‑based fallback when the cloud response time exceeded a threshold.

  2. Robust Prompt Design: Small changes in prompt wording can lead to wildly different outputs. Iterative A/B testing with real users helped us converge on a prompt that balances clarity with brevity.

  3. Safety in Physical Interaction: Ensuring that the robot never collides with the board or the player required careful tuning of the motion planner and the use of safety zones defined in ROS. We also implemented a manual override button on the robot’s controller.

  4. Scalability: While a single robot can handle a game in a few minutes, scaling to multiple simultaneous games demands efficient resource allocation. AWS Lambda’s concurrency limits and Bedrock’s request throttling were key constraints that we addressed by batching prompts and using asynchronous invocation.

Future Directions

The success of RoboTic‑Tac‑Toe opens the door to more ambitious multimodal AI‑robotic systems. Potential extensions include:

  • Dynamic Game Rules: Allowing players to modify the board size or introduce new winning conditions, and having the LLM adapt its strategy accordingly.
  • Learning from Interaction: Fine‑tuning the LLM on user interactions to improve move selection over time, effectively creating a personalized AI opponent.
  • Cross‑Device Collaboration: Enabling a human player to control a robot on a remote location, turning the game into a distributed, real‑time experience.
  • Educational Applications: Using the system as a teaching tool for AI concepts, robotics, and human‑computer interaction in classrooms.

Conclusion

RoboTic‑Tac‑Toe exemplifies how cloud‑native AI services can be harnessed to create engaging, embodied experiences that blend natural language, strategic reasoning, and physical robotics. By leveraging AWS’s Bedrock, RoboMaker, and IoT Core, the project demonstrates a scalable, low‑latency pipeline that turns a simple game into a showcase of modern AI capabilities. The lessons learned—from prompt engineering to safety‑first robotics—provide a roadmap for developers seeking to build their own multimodal AI‑robotic applications.

Call to Action

If you’re intrigued by the intersection of language models and robotics, we invite you to experiment with the open‑source codebase available on GitHub. By following the step‑by‑step guide, you can set up your own RoboTic‑Tac‑Toe system, tweak the LLM prompts, or even extend the game to new board configurations. Whether you’re a hobbyist, educator, or enterprise engineer, this project offers a tangible entry point into building AI‑driven robotic experiences that feel natural, responsive, and, most importantly, fun.

We value your privacy

We use cookies, including Google Analytics, to improve your experience on our site. By accepting, you agree to our use of these cookies. Learn more