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


public class Hex : MonoBehaviour
{
    public const float Size = 0.85f;
    public const float Yscale = 0.55f;
}

public class Point
{
    public Point(float x, float y)
    {
        this.x = x;
        this.y = y;
    }
    public readonly float x;
    public readonly float y;
}

public class Hexagon : System.IEquatable<Hexagon>
{
    public Hexagon(int q, int r, int s)
    {
        this.q = q;
        this.r = r;
        this.s = s;
    }
    public Hexagon(int q, int r)
    {
        this.q = q;
        this.r = r;
        this.s = -q - r;
    }
    public readonly int q;
    public readonly int r;
    public readonly int s;

    public Hexagon Rotate(bool left)
    {
        if (left)
            return new Hexagon(s, q);
        else
            return new Hexagon(r, s);
    }

    static public Hexagon Add(Hexagon a, Hexagon b)
    {
        return new Hexagon(a.q + b.q, a.r + b.r, a.s + b.s);
    }


    static public Hexagon Subtract(Hexagon a, Hexagon b)
    {
        return new Hexagon(a.q - b.q, a.r - b.r, a.s - b.s);
    }


    static public Hexagon Scale(Hexagon a, int k)
    {
        return new Hexagon(a.q * k, a.r * k, a.s * k);
    }

    static public List<Hexagon> directions = new List<Hexagon>{new Hexagon(1, 0, -1), new Hexagon(1, -1, 0), new Hexagon(0, -1, 1), new Hexagon(-1, 0, 1), new Hexagon(-1, 1, 0), new Hexagon(0, 1, -1)};

    static public Hexagon Direction(int direction)
    {
        return Hexagon.directions[direction];
    }


    static public Hexagon Neighbor(Hexagon Hexagon, int direction)
    {
        return Hexagon.Add(Hexagon, Hexagon.Direction(direction));
    }

    static public List<Hexagon> diagonals = new List<Hexagon>{new Hexagon(2, -1, -1), new Hexagon(1, -2, 1), new Hexagon(-1, -1, 2), new Hexagon(-2, 1, 1), new Hexagon(-1, 2, -1), new Hexagon(1, 1, -2)};

    static public Hexagon DiagonalNeighbor(Hexagon Hexagon, int direction)
    {
        return Hexagon.Add(Hexagon, Hexagon.diagonals[direction]);
    }


    static public int Length(Hexagon Hexagon)
    {
        return (int)((Mathf.Abs(Hexagon.q) + Mathf.Abs(Hexagon.r) + Mathf.Abs(Hexagon.s)) / 2);
    }


    static public int Distance(Hexagon a, Hexagon b)
    {
        return Hexagon.Length(Hexagon.Subtract(a, b));
    }

    public override int GetHashCode()
    {
        int hq = q.GetHashCode();
        int hr = r.GetHashCode();
        return (int)(hq ^ (hr + 0x9e3779b9 + (hq << 6) + (hq >> 2)));
    }

    bool System.IEquatable<Hexagon>.Equals(Hexagon other)
    {
        return q == other.q && r == other.r && s == other.s;
    }
}

public class FractionalHexagon
{
    public FractionalHexagon(float q, float r, float s)
    {
        this.q = q;
        this.r = r;
        this.s = s;
    }
    public readonly float q;
    public readonly float r;<commit_msg>fixed the rotation scriptgit st<commit_after>﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;


public class Hex : MonoBehaviour
{
    public const float Size = 0.85f;
    public const float Yscale = 0.55f;
}

public class Point
{
    public Point(float x, float y)
    {
        this.x = x;
        this.y = y;
    }
    public readonly float x;
    public readonly float y;
}

public class Hexagon : System.IEquatable<Hexagon>
{
    public Hexagon(int q, int r, int s)
    {
        this.q = q;
        this.r = r;
        this.s = s;
    }
    public Hexagon(int q, int r)
    {
        this.q = q;
        this.r = r;
        this.s = -q - r;
    }
    public readonly int q;
    public readonly int r;
    public readonly int s;

    public Hexagon Rotate(bool left)
    {
        Hexagon center = new Hexagon(0, 0);
        int radius = Hexagon.Length(this);
        Hexagon iter = Hexagon.Add(center, Hexagon.Scale(Hexagon.directions[0], radius));
        bool notFound = true;
        for (int i = 0; i < 6 && notFound; ++i)
        {
            for (int j = 0; j < radius && notFound; ++j)
            {
                if (iter == this)
                {
                    notFound = false;
                    for (int k = j; k < j + radius; ++k)
                    {
                        iter = Hexagon.Neighbor(iter, (i + (k / radius) + 2) % 6);
                    }
                }
                else
                    iter = Hexagon.Neighbor(iter, (i + 2) % 6);
            }
        }
        return iter;
    }

    static public Hexagon Add(Hexagon a, Hexagon b)
    {
        return new Hexagon(a.q + b.q, a.r + b.r, a.s + b.s);
    }


    static public Hexagon Subtract(Hexagon a, Hexagon b)
    {
        return new Hexagon(a.q - b.q, a.r - b.r, a.s - b.s);
    }


    static public Hexagon Scale(Hexagon a, int k)
    {
        return new Hexagon(a.q * k, a.r * k, a.s * k);
    }

    static public List<Hexagon> directions = new List<Hexagon>
        {
            new Hexagon(1, 0, -1), // RU
            new Hexagon(1, -1, 0), // RD
            new Hexagon(0, -1, 1), // D
            new Hexagon(-1, 0, 1), // LD
            new Hexagon(-1, 1, 0), // LU
            new Hexagon(0, 1, -1), // U
        };

    static public Hexagon Direction(int direction)
    {
        return Hexagon.directions[direction];
    }


    static public Hexagon Neighbor(Hexagon Hexagon, int direction)
    {
        return Hexagon.Add(Hexagon, Hexagon.Direction(direction));
    }

    static public List<Hexagon> diagonals = new List<Hexagon>{new Hexagon(2, -1, -1), new Hexagon(1, -2, 1), new Hexagon(-1, -1, 2), new Hexagon(-2, 1, 1), new Hexagon(-1, 2, -1), new Hexagon(1, 1, -2)};

    static public Hexagon DiagonalNeighbor(Hexagon Hexagon, int direction)
    {
        return Hexagon.Add(Hexagon, Hexagon.diagonals[direction]);
    }


    static public int Length(Hexagon Hexagon)
    {
        return (int)((Mathf.Abs(Hexagon.q) + Mathf.Abs(Hexagon.r) + Mathf.Abs(Hexagon.s)) / 2);
    }


    static public int Distance(Hexagon a, Hexagon b)
    {
        return Hexagon.Length(Hexagon.Subtract(a, b));
    }

    public override int GetHashCode()
    {
        int hq = q.GetHashCode();
        int hr = r.GetHashCode();
        return (int)(hq ^ (hr + 0x9e3779b9 + (hq << 6) + (hq >> 2)));
    }

    bool Equal(System.Object other)
    {
        return (other is Hexagon) && (this == (Hexagon)other);
    }

    bool System.IEquatable<Hexagon>.Equals(Hexagon other)
    {
        return q == other.q && r == other.r && s == other.s;
    }

    public static bool operator ==(Hexagon a, Hexagon b)
    {
        return (a.q == b.q) && (a.r == b.r) && (a.s == b.s);
    }
    
    public static bool operator !=(Hexagon a, Hexagon b)
    {
        return !(a == b);
    }
}

public class FractionalHexagon
{
    public FractionalHexagon(float q, float r, float s)
    {
        this.q = q;
        this.r = r;
        this.s = s;
    }
    public readonly float q;
    public readonly float r;
{'fraction_non_alphanumeric': 0.13019192208536237, 'fraction_numerical': 0.01632769979948439, 'mean_word_length': 1.8855371900826445, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 19, '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': '5591005', 'n_tokens_mistral': 2588, 'n_tokens_neox': 2385, 'n_words': 690}