<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Sandbox.Common;
using Sandbox.Common.ObjectBuilders;
using Sandbox.ModAPI;

namespace Rynchodon
{
	/// <summary>
	/// Summary of Relations
	/// 
	/// Unowned:
	/// For a grid, hostile. For a block, None.
	/// 
	/// Hostile:
	/// The goal is to be consistent with what a turret will shoot at.
	/// i.e. A turret will shoot at an enemy block and will shoot at a grid if it contains any enemy blocks.
	/// 
	/// Friendly:
	/// Essentially, any block or grid which is neither enemies nor neutral.
	/// </summary>
	public static class IMyCubeBlockExtensions
	{
		[Flags]
		public enum Relations : byte { None = 0, Enemy = 1, Neutral = 2, Faction = 4, Owner = 8 }

		public static bool HasFlagFast(this Relations rel, Relations flag)
		{ return (rel & flag) > 0; }

		private static bool toIsFriendly(Relations rel)
		{
			if (rel.HasFlagFast(Relations.Enemy))
				return false;
			if (rel.HasFlagFast(Relations.Neutral))
				return false;

			if (rel == Relations.None)
				return false;

			return true;
		}
<commit_msg>updated comment for Relations<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Sandbox.Common;
using Sandbox.Common.ObjectBuilders;
using Sandbox.ModAPI;

namespace Rynchodon
{
	public static class IMyCubeBlockExtensions
	{
		/// <summary>
		/// <para>For a grid, we normally consider the worst relationship.</para>
		/// <para>Eg. A grid that contains any Neutral blocks and no Enemy blocks shall be considered Neutral.</para>
		/// <para>A grid that is completely unowned shall be considered Enemy.</para>
		/// </summary>
		[Flags]
		public enum Relations : byte
		{
			/// <summary>
			/// Owner/Player is "nobody"
			/// </summary>
			None = 0,
			/// <summary>
			/// Owner/Player is a member of an at war faction
			/// </summary>
			Enemy = 1,
			/// <summary>
			/// Owner/Player is a member of an at peace faction
			/// </summary>
			Neutral = 2,
			/// <summary>
			/// Owner/Player is a member of the same faction
			/// </summary>
			Faction = 4,
			/// <summary>
			/// Owner/Player is the same player
			/// </summary>
			Owner = 8
		}

		public static bool HasFlagFast(this Relations rel, Relations flag)
		{ return (rel & flag) > 0; }

		private static bool toIsFriendly(Relations rel)
		{
			if (rel.HasFlagFast(Relations.Enemy))
				return false;
			if (rel.HasFlagFast(Relations.Neutral))
				return false;

			if (rel == Relations.None)
				return false;

			return true;
		}

{'fraction_non_alphanumeric': 0.12165827198760171, 'fraction_numerical': 0.004649360712901976, 'mean_word_length': 2.7970588235294116, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '6600930', 'n_tokens_mistral': 949, 'n_tokens_neox': 800, 'n_words': 279}