Magnus Mårtensson
Microsoft Regional Director, Azure MVP, CEO Loftysoft
Avirag Jain
Director & CTO R Systems
Mahesh Chand
Founder C# Corner, CEO Mindcracker
Chris Gali
CEO & Co-Founder Graphite
Subinder Khurana
Chief Architect StoryProcess, Founder NASSCOM DeepTech Club
Bryan Rishforth
Investor, Chairman Graphite
Bryn Everson
Director Biz Dev Graphite
Raj Tiwari
Digital Transformation Leader, Futurist and Visionary
Joseph Guadagno
Microsoft MVP, Lead Quicken Loans
Nikita Sachdev
Entrepreneur, Blockchain Enthusiast & Advisor, Social Media Influencer
Doug Wagner
COO & Founder Adapt Technical Group
Ritesh Modi
Architect, Senior Evangelist, Cloud Architect
Crystal Wenrick
Director Communications Mindcracker
Allen O’Neill
Microsoft MVP, Consulting Engineer/Architect
Praveen Kumar
CEO MCN Solutions
Chris Love
Founder Love2Dev, Microsoft MVP, Author
Sanjay Vyas
Microsoft Regional Director, Microsoft MVP, Founder & CEO SkillLabs Technologies
Veena Sarda
Deep Learning Consultant, Author
Sekhar Srinivasan
C# Corner MVP, Microsoft Certified Trainer, Pluralsight Author
Lalit Bansal
Founder & CEO - EIY SYS
Navdeep Garg
CEO Revinfotech
Prakash Tripathi
Tech Manager/Leader, Microsoft MVP, Blogger
Bhavna Jain
Breakthrough Consultant
Naveen Sharma
Enterprise Architect, Leadership Coach, Author
Vidya Vrat Agarwal
Principal Architect, Microsoft MVP, Author
Sheetal Agarwal
Founder Clownselors, Medical Clown, Trainer
Abhishek Kant
Founder GTM Catalyst
Vishnu Saran
Founder & CEO VoiceQube
Sandeep Soni
Founder & CEO Deccansoft, Microsoft Certified Trainer
Parveen Malik
AVP InfoSec & Vulnerability Management, Information Security Expert
Nitin Pandit
Microsoft MVP, Developer Evangelist, Author
Niloshima Srivastava
C# Corner MVP, Tech Architect, Trainer, Blogger
Bala Chirtsabesan
Senior Software Engineer at Microsoft, Author
Manoj Mittal
Sr. Technical Architect, C# Corner MVP, Author
Chandni Di
Co-Founder Voice of Slum
Vithal Wadje
Technical Lead, Microsoft MVP, Author
Shivam Ahuja
Founder SkillCircle, Business Mentor
Chervine Bhiwoo
Solution Architect, Microsoft MVP, Author
Saurabh Jain
Vice President Paytm, Founder Fun2Do Labs, Author
Vinay Solanki
Head IoT at Lenovo, Founder IoT-NCR
Anshu kumari
Founder Blockchainkids, Inventor, Trainer
Amit Singal
CEO Startup Buddy
Dev Pratap
Co-Founder & CEO Voice of Slum
Amey Vartak
Technology Consultant, Full Stack Developer, C# Corner MVP, Author
Viswanatha Swamy
Principal Software Engineer, C# Corner MVP, Author
Sanket Verma
Research Engineer @ Ballistics (Forensics) and Chair, PyData Delhi
Sourabh Somani
Lead Developer, Microsoft MVP, Author
Abhishek Mishra
Software Architect, C# Corner MVP, Author
Siddharth Vaghasia
Technical Consultant, C# Corner MVP, Blogger
Bassam Alugili
Senior Software Specialist, Database Expert
S Ravi Kumar
Solution Architect, C# Corner MVP, Author
Sundaram Subramanian
Full Stack Developer, C# Corner MVP, Speaker
Deepesh Somani
Solution Architect, Microsoft MVP, Author
Debasis Saha
Technical Project Manager, C# Corner MVP, Blogger, Author
Vipul Jain
Software Architect, C# Corner MVP, Author
Akshay Patel
Technical Architect, Microsoft Certified Trainer, C# Corner MVP, Author
Stephen Simon
RPA Developer, Evangelist, Author
Vivek Sharma
Founder Kingster636, AR/VR Specialist
Jeetendra Gund
Technical Lead, C# Corner MVP, Author
Sujal Beniwal
AI Enthusiast, Student
M Viknaraj
Microsoft MVP, Azure Architect, Author
Prasham Sabadra
Software Architect, C# Corner MVP, Trainer, Author
Aakash Maurya
Senior Developer, C# Corner MVP, Speaker
Ankit Sharma
Senior Software Engineer, C# Corner MVP, Author
Mangesh Gaherwar
Team Lead, C# Corner MVP, Author
Viral Jain
Technical Consultant, C# Corner MVP, Author
Bhasker Das
Solution Architect, Evangelist
Manish Dwivedi
Associate Project Manager
Ck Nitin
Programmer, Author
Rohit Gupta
Technical Trainer, Author
Manish Tewatia
Full-stack Marketer, UX Designer
Bhavya Gaur
Technical Illustrator
Rohit Tomar
SEO/SMO Expert
Web Track
Cloud & Data Track
Dev Track
Registration & Breakfast
Future of Desktop Apps with JS (ElectronJs)
Nitin Pandit
Building Serverless Microservices Using Microsoft Azure
Vithal Wadje
Innovating RPA: A Robot for Every Person
Stephen Simon
Managing Cloud Storage Accounts using Logic Apps
Viknaraj Manogararajah
Data visualization using Python
Sekhar Srinivasan
Going Cross platform with AR Foundation
Vivek Sharma
Keynote
Managing your Azure dependencies in ASP.NET Core apps using VS
Bala Chirtsabesan
Securing Applications on Intelligent Azure
Abhishek Mishra
Getting started with Blazor the Framework of Future
S Ravi Kumar
Lunch
Build Progressive Web Apps using Angular 9
Debasis Saha
Build and deploy to any platform using Azure DevOps
Chervine Bhiwoo
Deep Dive in Azure Service Bus
Akshay Patel
Build a Native Mobile Application using React Native and JavaScript
Joseph Guadagno
Making sense of Web Job, Web Job SDK and Functions in Azure
Prakash Tripathi
CloudFront Distribution in AWS
Viral Jain
Tea Break
Introduction to PowerBI
Aakash Maurya
Build Advanced SPFx solutions with React and Graph API
Siddharth Vaghasia
Build Business Intelligence Analyst (BIA) Skills
Sundaram Subramanian
Deep dive of Power Platform – AI BUILDER
Prasham Sabadra
Panel 1
What's new in SharePoint development
Vipul Jain
Build a SSO (Single Sign On) based Native JavaScript application with Microsoft Identity within 10 minutes
Manoj Mittal
Panel 2
Applications and working of AI
Veena Sarda
Deploying serverless API's with .Net core 3.0 on AWS & Azure
Amey Vartak
Panel 3
Blockchain with .NET Core (Ark)
Anshu Kumari
Closing Note & Prize Distribution
Dev Track
Cloud Track
Architecture Track
Emerging Tech Track
Registration & Breakfast
Creating Full-Stack Web Apps Using Server-Side Blazor
Ankit Sharma
Real time face recognition with MS Cognitive Services
Niloshima Srivastava
Building Scalable APIs with GraphQL
Jeetendra Gund
Future of development with AI and Blockchain
Navdeep Garg
Debugging Tips and Tricks with Visual Studio 2019
Joseph Guadagno
Azure Containers
Abhishek Kant
Enterprise Architecture
Naveen Sharma
Bot Framework - learn it fast and look like a boss!
Allen O’Neill
Keynote
.Net Core & C# 8 Performance
David McCarter
Working with Azure kubernetes services
Ritesh Modi
Becoming an Architect
Vidyavrat Agarwal
Why Techies Need to Learn Product Management
Saurabh Jain
Lunch
Build a rules engine in .Net Core
Sanjay Vyas
Building CI and CD Pipeline using Azure DevOps
Sandeep Soni
Entity Framework Core - Tips and Tricks, Performance Optimization, and Tuning
Bassam Alugili
Hacking your way into Data Science
Sanket Verma
Speed up your .Net Core Website
Sourabh Somani
Azure
Magnus Mårtensson
Demystifying Open Distro for Elasticsearch
Suman Debnath
Future of Data
Shivam Ahuja
Tea Break
gRPC with C# and .Net Core
Mangesh Gaherwar
Panel 1
Essentials of Cloud security
Parveen Malik
Power platform and Dynamics 365
Deepesh Somani
Microservices - the gRPC Way
Viswanatha Swamy
Panel 2
Reserved
Reserved
Closing Note & Prize Distribution
Building a Tic-Tac-Toe AI with Minimax Algorithm in C
For developers who want to learn how machines "think" during a game, tic-tac-toe is the friendliest possible starting point. The board fits in a single 3×3 array, the rules fit on a napkin, and yet the same recursive search technique you build here shows up everywhere from chess engines to scheduling software. Plenty of Australian programmers draft their first AI between a morning flat white and the arvo commute, and a game this compact is the right scale for that window.
The Minimax algorithm is the heart of that technique. By imagining every future move, scoring the outcomes, and picking the path that maximises a player's score while minimising the opponent's, you create an opponent that never loses. This article walks through the logic in plain English first, then shows how to translate it into clean, portable C code that compiles on Linux, macOS, or Windows from the comfort of an Australian home office.
Why tic-tac-toe is a perfect sandbox for AI concepts
Game-playing programs are usually the first thing programmers build that feels genuinely intelligent. Yet most introductions to the topic skip straight into chess or Go and overwhelm beginners with thousands of possible positions. Tic-tac-toe has only 255,168 distinct games and 26,830 terminal positions, which means a brute-force approach is fully tractable on any laptop a Sydney uni student might own.
The real benefit is the ratio between conceptual difficulty and code complexity. You will write fewer than 150 lines of C and still produce an unbeatable opponent. That tight feedback loop is exactly why bootcamps in Melbourne, Brisbane, and Perth keep returning to this exercise when introducing search algorithms.
The board also serves as a model for many real-world decision systems. Ride-share dispatchers in Adelaide, slot-allocation software at Sydney Airport, and even fixture generators for the A-League rely on similar "look ahead and pick the best" logic. Once you understand Minimax, the same pattern is recognisable in domains far beyond a wooden grid and two sets of noughts and crosses.
How the minimax algorithm makes decisions in C
At its core, Minimax is a depth-first recursion. From the current board state, the program generates every legal move. For each of those moves, it imagines the opponent's reply, then the original player's reply to that reply, and so on until it reaches a terminal state: a win, a loss, or a draw. Each terminal state is given a numeric score, typically +10 for an AI win, -10 for an AI loss, and 0 for a draw. The recursion then propagates those scores back up the tree.
In C, this is expressed through a function with a small but predictable signature. It takes the current board, the depth remaining in the search, and a flag telling it whether it is the maximising player or the minimising player. It returns an integer score. Inside the function, a loop tries each empty square, calls itself recursively with the new board, and tracks the best score according to whose turn it is.
The algorithm assumes the opponent plays perfectly. This is rarely true against humans, so in practice the AI often wins or draws much earlier than the theoretical worst case. A useful tweak is to subtract the depth from the win score, rewarding wins that happen sooner and losses that happen later. That single line of arithmetic is the difference between a passive bot and one that actively steers toward a quick finish.
Translating the logic into a C program step by step
The first design decision is how to represent the board. A 3×3 character array using 'X', 'O', and ' ' is the most readable option for a tutorial, though a flat char[9] works equally well if you prefer passing it by value to recursive functions. Beginners in Canberra's open-source meetups often start with the 2D version for clarity and refactor later.
Next, write helper functions that return booleans: one for "is the board full", another for "has X won" or "has O won". Keeping these separate from the AI keeps the main search function readable. The evaluate function then returns the score, and the minimax function ties everything together.
Finally, the driver code reads the human's move from stdin, alternates turns, prints the board after each move, and calls minimax whenever it is the AI's turn. A simple main loop using a while statement keeps the game flowing until a terminal state is reached. With the GNU C compiler available on most Linux distributions and through WSL on Windows, you can compile and run the whole thing with a single command from a terminal in Hobart or anywhere else.
Common pitfalls and how to handle them
Once the code compiles, a handful of issues tend to trip people up. Catching them early saves hours of debugging, and most are easy to avoid with a short checklist before you start typing.
- Forgetting to undo a move after the recursive call, leaving the board in a corrupted state when control returns to the parent frame.
- Confusing whose turn it is inside the recursion and passing the wrong maximising flag, which silently breaks the score propagation.
- Using a global or static board variable instead of passing the board as a parameter, which makes the code impossible to test or extend.
- Returning the score without recording the move that produced it, so the AI can score perfectly but has no idea which square to actually play.
A reliable way to avoid the first three is to keep every state change local to a function parameter and to return both the score and the chosen move together. The standard idiom is to use a struct that holds the score and the square index, or to track them with two separate variables in the calling function. Adding a small debug print of the board before and after each recursive call also makes problems visible immediately.
For the fourth issue, store the best move index during the loop and return it alongside the score. Many C programmers new to game AI are surprised by how much of the work is bookkeeping rather than algorithm design, but that bookkeeping is what turns a textbook example into a working program.
Where to take this project next
A finished tic-tac-toe AI is a launchpad, not a destination. The natural next step is alpha-beta pruning, which skips branches of the search tree that cannot affect the final decision and often cuts the work in half without changing the result. From there, transposition tables cache previously seen board positions, and iterative deepening lets the AI respect a time budget.
You can also move the engine into a library and call it from a graphical front-end, a web API, or even a small mobile app. The C standard library stays portable across the regions developers care about, and you can build the same source on a MacBook in Surry Hills or a workstation in a Perth data centre without changes. If you ever extend the engine to log player behaviour, the Privacy Act 1988 governs how Australian services handle personal information, so keep identifiers out of any logs you keep.
Common extensions worth exploring:
- Alpha-beta pruning to skip irrelevant branches and roughly halve the search time.
- A transposition table keyed by board state to cache repeated positions.
- Iterative deepening so the AI can return the best move found within a fixed time budget.
- A larger board variant such as 4×4 or 5×5 noughts and crosses, where Minimax alone is no longer tractable.
If you want to see Minimax and similar search techniques applied to far more complex problems, the technical sessions at the C# Corner Annual Conference cover game AI, scheduling systems, and optimisation in depth. Checking the agenda on the conference portal is a good way to plan which talks line up with what you have just built, and you can find everything at the conference site. Building a small project like this in C is the fastest way to make those larger talks land when you attend.
1, CBD, Maharaj Surajmal Road, Near Yamuna Sports Complex, Delhi, 110032
GENERAL QUERIES
Manish Tewatia
manish@csharpcon.com
+91-9718-431-042
TICKET QUERIES
Atul Gupta
conference@csharpcon.com
+91-9910-125-804