<commit_before>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PoliticsTracker : MonoBehaviour {

    public int PercentApprovalWH, PercentApprovalPK, PercentApprovalBalance;
    public int PercentWH, PercentPK, PercentBalance;

	public void AlterPercentApproval(int percentChange, PoliticsParty party)
    {
        switch (party)
        {
            case PoliticsParty.Warhawk:
                if(PercentApprovalWH <= 100 && PercentApprovalWH >= 0)
                {
                    if((PercentApprovalWH + percentChange) > 100)
                    {
                        PercentApprovalWH = 100;
                    }
                    else if ((PercentApprovalWH + percentChange) < 0)
                    {
                        PercentApprovalWH = 0;
                    }
                    else
                    {
                        PercentApprovalWH += percentChange;
                    }
                    
                }
                break;
            case PoliticsParty.Peacenik:
                if (PercentApprovalPK <= 100 && PercentApprovalPK >= 0)
                {
                    if ((PercentApprovalPK + percentChange) > 100)
                    {
                        PercentApprovalPK = 100;
                    }
                    else if ((PercentApprovalPK + percentChange) < 0)
                    {
                        PercentApprovalPK = 0;
                    }
                    else
                    {
                        PercentApprovalPK += percentChange;
                    }
                }
                break;
            case PoliticsParty.Balance:
                if (PercentApprovalBalance <= 100 && PercentApprovalBalance >= 0)
                {
                    if ((PercentApprovalBalance + percentChange) > 100)
                    {
                        PercentApprovalBalance = 100;
                    }
                    else if ((PercentApprovalBalance + percentChange) < 0)
                    {
                        PercentApprovalBalance = 0;
                    }
                    else
                    {
                        PercentApprovalBalance += percentChange;
                    }
                }
                break;
        }
    }
	public void ShuffleProportions ()
    {
        int WarhawkChange = Random.Range(-5, 5);
        Debug.Log("WarhawkChange" + WarhawkChange);
        int PeacenikChange = Random.Range(-5, 5);

        if (PercentWH > 0 && PercentWH < 100)
        {
            PercentWH += WarhawkChange;
            Debug.Log("Actually does something");
        }

        if (PercentPK > 0 && PercentPK < 100)
        {
            PercentPK += PeacenikChange;
        }

        PercentBalance = 100 - PercentWH - PercentPK;

        
    }
}<commit_msg>Give em the clamps.<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PoliticsTracker : MonoBehaviour {

    public int PercentApprovalWH, PercentApprovalPK, PercentApprovalBalance;
    public int PercentWH, PercentPK, PercentBalance;

	public void AlterPercentApproval(int percentChange, PoliticsParty party)
    {
        switch (party)
        {
            case PoliticsParty.Warhawk:
                if(PercentApprovalWH <= 100 && PercentApprovalWH >= 0)
                {
                    PercentApprovalWH += percentChange;
                    PercentApprovalWH = Mathf.Clamp(PercentApprovalWH, 0, 100);
                }
                break;
            case PoliticsParty.Peacenik:
                if (PercentApprovalPK <= 100 && PercentApprovalPK >= 0)
                {
                    PercentApprovalPK += percentChange;
                    PercentApprovalPK = Mathf.Clamp(PercentApprovalPK, 0, 100);
                }
                break;
            case PoliticsParty.Balance:
                if (PercentApprovalBalance <= 100 && PercentApprovalBalance >= 0)
                {
                    PercentApprovalBalance += percentChange;
                    PercentApprovalBalance = Mathf.Clamp(PercentApprovalBalance, 0, 100);
                }
                break;
        }
    }
	public void ShuffleProportions ()
    {
        int WarhawkChange = Random.Range(-5, 5);
        Debug.Log("WarhawkChange" + WarhawkChange);
        int PeacenikChange = Random.Range(-5, 5);

        if (PercentWH >= 0 && PercentWH <= 100)
        {
            PercentWH += WarhawkChange;
            PercentWH = Mathf.Clamp(PercentWH, 5, 100);
        }

        if (PercentPK > 0 && PercentPK < 100)
        {
            PercentPK += PeacenikChange;
            PercentPK = Mathf.Clamp(PercentPK, 5, 100);
        }

        PercentBalance = 100 - PercentWH - PercentPK;

        
    }
}
{'fraction_non_alphanumeric': 0.07545605306799337, 'fraction_numerical': 0.0203150912106136, 'mean_word_length': 1.2578380907814692, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5924239', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1133, 'n_words': 243}