Skip to content

Hecke (HECKEMERIDIANS)

Overview

Hecke implements a geographic coordinate system with 90 meridian bands. It maps large numbers (Waat values) to latitude/longitude coordinates, enabling location-based token mechanics.

  • Inherits: DYSNOMIA V2
  • License: Sharia
  • Solidity: ^0.8.21

What This Means For Players

Plain English Summary: Hecke is the coordinate system - it turns numbers into map locations. Every QING has a "Waat" (position number) that Hecke converts into latitude and longitude coordinates. This is how the game places venues on the world map.

Real-World Analogy: Think of Hecke like a GPS system that converts numerical addresses into physical locations. Just as your GPS turns an address into "you are here" on a map, Hecke turns a Waat number into a specific latitude/longitude position in the Dysnomia world.

How It Affects Your Gameplay: - Map positions - Every venue has a unique position calculated by Hecke - 90 meridian bands - The world is divided into 90 zones from south to north - Territory proximity - When claiming territory, your distance from venues is calculated using Hecke coordinates - Geographic lookup - Find which venue is at any given coordinates

State Variables

Variable Type Visibility Description
Meridians uint256[90] public Array of 90 meridian boundary values

Meridians Array

The Meridians array contains exponentially increasing boundary values:

Meridians[0]  = 476733977057179         // ~4.7e14
Meridians[1]  = 3256639860692891        // ~3.2e15
...
Meridians[88] = 394003890037732925341349197890665503744188106368861304015211794431709973855
Meridians[89] = 788007780075465850682698395781331007488376212737722608030423588863419947711

The array represents: - Meridians 0-88: Southern to Northern hemisphere bands - Meridian 89: Maximum value (wraps to north pole)

Read Functions

Compliment

function Compliment(uint256 Waat) public view returns (int256 Longitude, int256 Latitude)
- Access: public view - Parameters: - Waat (uint256): Position value (must be <= Meridians[89]) - Returns: - Longitude (int256): East/West coordinate (negative = West, positive = East) - Latitude (int256): North/South coordinate (scaled by 333) - Description: Converts a Waat value to geographic coordinates using meridian band lookup. - Logic Flow: 1. Assert: Waat <= Meridians[89] or revert 2. Get meridian index via GetMeridian 3. If Meridian == 89: flip to northern hemisphere, recalculate from inverse 4. Calculate Latitude: distance from Meridians[88] / 333 5. Calculate Longitude within band: - First half of band → positive (East) - Second half → negative (West) 6. Apply hemisphere sign to Latitude - Computation Details: - Latitude = (Waat % Meridians[88]) / 333 - Longitude = Waat / Meridians[Meridian] with sign based on position in band - In Plain English: Convert a venue's position number into map coordinates. Takes a Waat and returns the latitude/longitude so you know where the venue is located on the world map.

GetWaat

function GetWaat(int256 Latitude) public view returns (uint256 Waat)
- Access: public view - Parameters: - Latitude (int256): Latitude value to convert - Returns: - Waat (uint256): Corresponding position value at meridian 88 - Description: Reverse lookup from latitude to Waat using Meridians[88]. - Computation Details: - Waat = abs(Latitude) * 333 (scaled back to Waat range) - In Plain English: Convert a latitude back to a position number. The reverse of Compliment - useful for finding venues at a specific latitude.

GetMeridian

function GetMeridian(uint256 Waat) public view returns (uint256 Meridian)
- Access: public view - Parameters: - Waat (uint256): Position value to look up - Returns: - Meridian (uint256): Index 0-89 of the containing meridian band - Description: Binary or linear search through Meridians array to find containing band. - Logic Flow: 1. Iterate through Meridians array 2. Find first index where Waat < Meridians[i] 3. Return that index (or 89 if at maximum) - In Plain English: Find which of the 90 world zones a position falls into. The world is divided into bands from 0 (south) to 89 (north).

Meridians

uint256[90] public Meridians
- Access: public - Returns: Direct access to meridian boundary array at specified index - In Plain English: Access the boundary values that define each meridian band. Meridians[0] is the smallest (near equator), Meridians[89] is the maximum.

Contract Interactions

Depends On

Depended On By

  • MAP - Uses for coordinate mapping
  • WORLD - Geographic operations

Special Mechanisms

Coordinate System

         North Pole (Meridian 89)
    +Lat  ←---|---→  -Lat
              |
         South Pole (Meridian 0)

    West ← Longitude → East
    (-X)              (+X)

Compliment Algorithm

1. Assert Waat <= Meridians[89]
2. Get Meridian index
3. If Meridian == 89:
   - Flip to northern hemisphere
   - Recalculate from inverse
4. Calculate Latitude from Meridians[88] distance
5. Calculate Longitude within meridian band:
   - First half: positive longitude
   - Second half: negative longitude
6. Scale Latitude by 333
7. Apply hemisphere sign

Latitude Scaling

Latitude is divided by 333 to compress the large Waat values into manageable coordinate ranges.

Hemisphere Handling

Values above Meridian 88 represent the northern hemisphere, handled by subtracting from the maximum and recalculating.

Usage Pattern

// Get coordinates for a Waat value
(int256 lon, int256 lat) = hecke.Compliment(someWaat);

// Find meridian for a value
uint256 meridian = hecke.GetMeridian(someWaat);

// Get Waat for latitude
uint256 waat = hecke.GetWaat(lat);

Geographic Token Mechanics

The Hecke system enables: 1. Location-based tokens: Each QING token has a Waat that maps to coordinates 2. Proximity checks: Determine if tokens are in the same region 3. Territory mechanics: Define areas based on meridian bands 4. Distance calculations: Compare Waat values for relative position

Example Mapping

Waat = 476733977057179 (Meridian 0 boundary)
→ Near equator, specific longitude

Waat = 394003890037732925... (Meridian 88)
→ Near north pole, high latitude

Waat between boundaries
→ Proportional position within band

Integration with MAP

The MAP contract uses Hecke to: 1. Assign geographic position to new QING tokens 2. Organize tokens by location 3. Enable location-based lookup via _map[Latitude][Longitude]


Contract Verification

Property Value
Keccak256 Hash 0x43eaadc802dbc2559957b17ac5f11129b3490732c0c2e8a44b7e38395f4a74de
Source URL https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/lib/heckemeridians.sol
Hash Generated 2026-02-08T00:29:08Z