🎲 R HARUSPEX DIFFICULTY: Adept Creational

The Singleton: The Oracle Core

A singular point of truth for statistical divination.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Divination // Core Scrying
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// R PATTERN //
library(R6)

# The Oracle Core (Singleton)
OracleCore <- (function() {
  instance <- NULL

  CoreClass <- R6Class("OracleCoreClass",
    public = list(
      state = "Dormant",
      awaken = function() {
        self$state <- "Awake"
      },
      read_omens = function() {
        paste("Oracle is", self$state, "and reading omens.")
      }
    )
  )

  list(
    get_instance = function() {
      if (is.null(instance)) {
        instance <<- CoreClass$new()
      }
      return(instance)
    }
  )
})()

There is only one Oracle Core. It holds the ultimate state of the scrying session, ensuring all subsystems consult the same matrix.

Runic Tags: #R6 #Divination #Creational #Singleton