NetBurner 3.5.6
PDF Version
TicTacToe

NetBurner TicTacToe Web Application

Overview

This is a web-based TicTacToe game designed for NetBurner development boards. The application demonstrates embedded web server capabilities, interactive HTML content, and real-time gameplay through a web browser interface.

Features

Core Functionality

  • Interactive TicTacToe Game: Play against the computer through a web interface
  • Web Server: Built-in HTTP server running on port 80
  • LED Manipulation: Control LEDs on the NetBurner development board (URL encoding example)
  • Request Echo: View web browser requests sent to the server
  • Auto-Refresh Pages: Meta tag example for automatically reloading web pages

Technical Capabilities

  • Network Stack: Full TCP/IP implementation with DHCP support
  • Serial Console: Debug interface with command-line utilities
  • Diagnostic Tools: Network diagnostics, ARP tables, TCP debugging
  • Real-time Updates: Dynamic content generation and state management

Game Rules

  • Player Symbol: X (Cross)
  • Computer Symbol: O (Circle)
  • Objective: Get three symbols in a row (horizontal, vertical, or diagonal)
  • Turn Order: Player moves first by clicking on empty squares
  • Game State: Preserved in URL parameters between moves

File Structure

/
main.cpp # Main application entry point and command processor
tictactoe.cpp # TicTacToe game logic and web handlers
index.html # Default homepage with navigation links
tt.htm # TicTacToe game interface
once.htm # Single-load counter demonstration
repeat.htm # Auto-refreshing page example

Web Interface

Available Pages

  • / or /index.html: Main navigation page
  • /TT.HTM: TicTacToe game interface
  • /REPEAT.HTM: Auto-refreshing demonstration page
  • /ONCE.HTM: Page load counter example

Game Assets

  • CROSS.GIF: X symbol image
  • NOT.GIF: O symbol image
  • BLANK.GIF: Empty square image

Command Line Interface

The application provides a serial console interface with the following commands:

Command Description
A Show ARP table
C Show network counters
E Dump Ethernet statistics
P x.x.x.x Ping specified IP address
W Display current system time
? Show help menu

Debug Commands (when _DEBUG is defined)

Command Description
T Dump TCP debug information
L Setup debug log levels
U Dump OS tasks
S Dump OS stacks
H Show task changes

Technical Implementation

Game Logic

The TicTacToe game uses a bit-encoding system to represent the board state:

Player (X) Positions:**

0x01 0x04 0x10
0x40 0x100 0x400
0x1000 0x4000 0x10000

Computer (O) Positions:**

0x02 0x08 0x20
0x80 0x200 0x800
0x2000 0x8000 0x20000

State Management

  • Game state is encoded in URL parameters
  • Each move generates a new URL with updated state
  • Computer moves are calculated using strategic algorithms
  • Win/lose conditions are checked after each move

Web Server Integration

  • Uses NetBurner's built-in HTTP server
  • Dynamic content generation through function calls
  • HTML templates with embedded C++ function calls
  • Real-time state updates without page refresh

Hardware Requirements

  • NetBurner development board with network capability
  • Ethernet connection for web access
  • Serial port for debug console (115200 baud)
  • LEDs for visual feedback (board-dependent)

Network Configuration

  • DHCP: Automatically obtains IP address
  • Web Server: Port 80 (HTTP)
  • Serial Console: Available for diagnostics
  • Ping Support: Built-in network connectivity testing

Getting Started

  1. Setup: Connect NetBurner board to network via Ethernet
  2. Power On: Board will automatically start and obtain DHCP address
  3. Access: Open web browser and navigate to board's IP address
  4. Play: Click "Play Tic Tak Toe" to start the game
  5. Debug: Use serial console for network diagnostics