Search results

  1. fukurou

    port overlort python ->Swift assed edition!

    /// Stores a log of notes and allows cyclical access class Notes { private var log: [String] = [] private var index: Int = 0 /// Add a new note to the log func add(_ note: String) { log.append(note) } /// Clear all notes func clear() {...
  2. fukurou

    port overlort python ->Swift assed edition!

    /// Manages a pool of dynamic strategies drawn from a central responder class Strategy { private var allStrategies: UniqueResponder private var strategiesLim: Int private var activeStrategy: UniqueItemSizeLimitedPriorityQueue init(_ allStrategies: UniqueResponder, _...
  3. fukurou

    port overlort python ->Swift assed edition!

    /// Enables pattern-based event prediction and alert recognition class SpiderSense { private var spiderSense: Bool = false private var events: UniqueItemSizeLimitedPriorityQueue private var alerts: UniqueItemSizeLimitedPriorityQueue private var previous: String = "null"...
  4. fukurou

    port overlort python ->Swift assed edition!

    // ╔════════════════════════════════════════════════════════════════════════╗ // ║ LEARNABILITY ║ // ╚════════════════════════════════════════════════════════════════════════╝
  5. fukurou

    port overlort python ->Swift assed edition!

    /// Detects directional changes between two observed string tokens /// and returns a corresponding code. class ChangeDetector { private let A: String private let B: String private var prev: Int = -1 init(_ a: String, _ b: String) { self.A = a self.B = b }...
  6. fukurou

    port overlort python ->Swift assed edition!

    /// Tracks the difference between sampled power levels. class Differ { private var powerLevel: Int = 90 private var difference: Int = 0 /// Returns the last sampled power level. func getPowerLevel() -> Int { return powerLevel } /// Returns the most recent...
  7. fukurou

    port overlort python ->Swift assed edition!

    /// AXHandshake manages time-based shout-outs and user acknowledgment class AXHandshake { private var trgTime = TrgTime() private var trgTolerance = TrgTolerance(10) private var shoutout = AXShoutOut() private var userName: String = "" private var dripper = PercentDripper()...
  8. fukurou

    port overlort python ->Swift assed edition!

    /// Reacts to a contextual "shout out" once and disables itself after reply. class AXShoutOut { private var isActive: Bool = false var handshake: Responder = Responder() /// Enable the shout out system—must be called to activate engagement func activate() { isActive =...
  9. fukurou

    port overlort python ->Swift assed edition!

    /// Detects if a button was pressed (on edge change). /// Disables physical engagement while the button remains pressed. class ButtonEngager { private var prevState: Bool = false /// Returns true only once when button is newly pressed. func engage(_ btnState: Bool) -> Bool {...
  10. fukurou

    port overlort python ->Swift assed edition!

    /// Common code lines used in machine logic to declutter /// Also provides simplified extensions for dictionary actions class AXMachineCode { private var dic: [String: Int] = [:] /// Adds a key-value pair to the internal dictionary /// Returns self to allow builder-style chaining...
  11. fukurou

    port overlort python ->Swift assed edition!

    class AXPrompt { private var isActive: Bool = false private var index: Int = 0 private var prompts: [Prompt] = [] private var kv: AXKeyValuePair? = AXKeyValuePair() /// Add a prompt to the sequence func addPrompt(_ p: Prompt) { prompts.append(p) } ///...
  12. fukurou

    port overlort python ->Swift assed edition!

    class Prompt { private var kv = AXKeyValuePair() private var prompt: String = "" private var regex: String = "" init() { kv.key = "default" } func getPrompt() -> String { return prompt } func setPrompt(_ prompt: String) { self.prompt =...
  13. fukurou

    port overlort python ->Swift assed edition!

    // ╔════════════════════════════════════════════════════════════════════════╗ // ║ STATE MANAGEMENT ║ // ╚════════════════════════════════════════════════════════════════════════╝
  14. fukurou

    port overlort python ->Swift assed edition!

    /// Learns 1-word inputs and returns a recently learned word class Responder1Word { private var q = UniqueItemSizeLimitedPriorityQueue(limit: 5) init() { // Seed with some baby-babble classics q.insert("chi") q.insert("gaga") q.insert("gugu")...
  15. fukurou

    port overlort python ->Swift assed edition!

    class Magic8Ball { private var questions: Responder = Responder() private var answers: Responder = Responder() init() { // Affirmative responses answers.addResponse("It is certain") answers.addResponse("It is decidedly so")...
  16. fukurou

    port overlort python ->Swift assed edition!

    /// AXTimeContextResponder selects responses based on the current part of day. class AXTimeContextResponder { private var morning = Responder() private var afternoon = Responder() private var evening = Responder() private var night = Responder() private var responders...
  17. fukurou

    port overlort python ->Swift assed edition!

    class PercentDripper { private var dr = DrawRnd() private var limis: Int = 35 /// Set the base drip activation limit (0–100) func setLimit(_ limis: Int) { self.limis = limis } /// Returns true based on a percentage chance (`limis`%) func drip() -> Bool {...
  18. fukurou

    port overlort python ->Swift assed edition!

    class EventChatV2 { private var dic: [String: LimUniqueResponder] = [:] private var modifiedKeys: Set<String> = [] private var lim: Int init(_ lim: Int) { self.lim = lim } func getModifiedKeys() -> Set<String> { return modifiedKeys } func...
  19. fukurou

    port overlort python ->Swift assed edition!

    class LimUniqueResponder { private var responses: [String] = [] private var lim: Int private var urg: UniqueRandomGenerator init(_ lim: Int) { self.lim = lim self.urg = UniqueRandomGenerator(0) } func getAResponse() -> String { guard...
  20. fukurou

    port overlort python ->Swift assed edition!

    // ╔════════════════════════════════════════════════════════════════════════╗ // ║ OUTPUT MANAGEMENT ║ // ╚════════════════════════════════════════════════════════════════════════╝
Top