// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Incoprea
// Count distinct votes toward a local quorum
// Not compiled or tested in-world
// Setup: Place in a spare owned prim. Touch through a fixed member sequence including a repeated member. Owner touch runs the local demonstration.
// Stop / restore: Disable/remove. No external requests or scene changes occur; reset clears memory.
// Notes: This does not authenticate real voters or implement consensus. It demonstrates unique-count bookkeeping only.
// License: see LICENSE in this distribution.
// Original Incoprea. MIT. Local owner-only protocol laboratory.
list MEMBERS=[0,2,2,4,1];
integer cursor;
integer votes;
default
{
    touch_start(integer detectedCount)
    {
        if(llDetectedKey(0)!=llGetOwner())return;
        if(cursor>=llGetListLength(MEMBERS))
        {
            llOwnerSay("Voting sample complete.");
            return;
        }
        integer member=llList2Integer(MEMBERS,cursor);
        ++cursor;
        votes=votes|(1<<member);
        integer count;
        integer i;
        for(i=0;i<5;++i)if(votes&(1<<i))++count;
        llOwnerSay("Distinct votes="+(string)count+"; quorum reached="+(string)(count>=3));
    }
}
