Talk with Core

Description

Talk with Core (Math Precalculus Engine) 🔗

A secure, hardened mathematical engine and chat terminal mod for Luanti (formerly Minetest). This mod introduces an in-game terminal item that allows players to communicate with an AI-themed mathematical "Core" capable of solving complex algebraic expressions, precalculus functions, and equations using numeric methods directly inside the game environment.

Features 🔗

  • In-Game Terminal UI: A sleek, custom formspec UI designed as a terminal interface with scrollable message logs.
  • Precalculus Math Engine: Supports advanced arithmetic, factorials, roots, trigonometry, logarithms, and exponential functions.
  • Equation Solver: Solves single-variable algebraic equations using an optimized, lag-safe iterative Newton-Raphson numeric approach.
  • Complex Root Detection: Analytically detects and computes complex/imaginary roots for quadratic equations ($ax^2 + bx + c = 0$).
  • Hardened Sandbox Security: Designed specifically for multiplayer environments. Features an isolated sandboxed execution environment (setfenv), input token whitelisting to block code injection exploits, and iterative constraints to fully eliminate server crash vectors (like stack overflows).

Getting Started 🔗

Crafting the Communicator 🔗

To interact with the math engine, you need to craft the Core Communicator item using the following recipe:

Recipe
Mese Crystal
Mese Crystal Mese Crystal Mese Crystal
Mese Crystal

How to Use 🔗

  1. Equip the Core Communicator in your hotbar.
  2. Right-click (use) the item to boot up the AI Core Math Terminal.
  3. Type resolve help in the input bar to view capabilities, or use the syntax rules below to start calculating.

Command Syntax & Capabilities 🔗

To evaluate expressions or equations, your messages must begin with the resolve: prefix.

1. Basic Arithmetic & Algebra 🔗

  • Operators: +, -, *, /, ^ (power), ! (factorial)
  • Example: resolve: (23! - 34!) * 3
  • Implicit Multiplication: Handles syntax shorthand like 4x or (x)(x).

2. Supported Functions 🔗

  • Roots & Exponents: sqrt(x), root(n, x) (e.g., cubic roots), exp(x)
  • Logarithms: ln(x) (natural log), log(n, x) (log base $n$)
  • Trigonometry: sin(x), cos(x), tan(x), sec(x), csc(x), cot(x)
  • Miscellany: abs(x) (absolute value), constants pi and e.

3. Solving Equations 🔗

Simply write an equation containing an = sign and the variable x. The engine will scan and isolate the roots.

  • Linear/Non-linear Examples: * resolve: exp(3x) = 93 / sqrt(4x)

  • resolve: -6x^2 + 57x - 43.87 = 0

  • Complex Roots Example:

  • resolve: x^2 + 4 = 0 (Returns: Complex Roots: x = 0 + 2i | x = 0 - 2i)


Technical Architecture & Security 🔗

Because executing string-based math input dynamically in Lua (loadstring) can introduce server-crippling security exploits, this mod implements multi-layered hardening patches:

  1. Token Whitelisting: Before compiling, the string is thoroughly stripped and checked against allowed math structures. Malicious Lua keywords (function, while, local, os, debug, etc.) are caught and blocked immediately.
  2. Environment Isolation: Code is compiled into a strictly custom sandbox environment (math_sandbox) containing only safe mathematical functions and constants.
  3. Crash & Lag Mitigations: * Factorials are solved iteratively instead of recursively to avoid stack overflows.
  • Iterative ranges for numeric root-finding loops are strictly bounded to prevent infinite loops and lag spikes on multiplayer servers.

Requirements 🔗

  • Luanti / Minetest: Version 5.0.0 or newer.
  • Dependencies: default (from Minetest Game) for crafting components.

Reviews

Review

Do you recommend this mod?

  • No reviews, yet.

Releases

All releases