Esempio n. 1
0
        private List <int> AlterVals(List <int> values, Agent other, int val)
        {
            int privateVal = 1;

            if (val == 1)
            {
                privateVal = 0;
            }

            List <int> altered = new List <int>();

            int amountOfPublicVariables = LeakageTrace.GetAmountOfPublicVariables();

            for (int i = 0; i < amountOfPublicVariables; i++)
            {
                altered.Add(values[i]);
            }
            int totalAmountOfVariables = traces[other].variables.Count;

            int amountOfPrivateVariables = totalAmountOfVariables - amountOfPublicVariables;

            for (int i = 0; i < amountOfPrivateVariables; i++)
            {
                altered.Add(privateVal);
            }

            return(altered);
        }
Esempio n. 2
0
        private TraceState getRevealerRecievedState(Agent agent, Predicate predicateBeforeNegation, int val, Dictionary <Predicate, int> publicEffectsOfChosen, int stateID)
        {
            List <int> receivedStateVals = GetVals(predicateBeforeNegation, agent, val, publicEffectsOfChosen);
            Agent      sender            = LeakageTrace.getNextAgentAndMoveToTheNextInLine(agent);
            int        otherAgentID      = sender.getID();
            int        parentID          = -1;
            int        iparentID         = -1;
            int        cost            = 1;
            int        heuristic       = 1;
            List <int> privateIDs      = GetIDs(stateID, agents, agent, 0);
            string     receivedContext = "received";
            TraceState receivedState   = new TraceState(agent.getID(), otherAgentID, stateID, parentID, iparentID, cost, heuristic, privateIDs, receivedStateVals, receivedContext);

            return(receivedState);
        }