<commit_before>package pattern

import (
    "fmt"
    "github.com/pravj/geo_pattern/svg"
    "github.com/pravj/geo_pattern/shapes"
    "github.com/pravj/geo_pattern/utils"
)

var Svg = new(svg.SVG)
var hash = utils.Hash("Happy Diwali")

func Start() string {
    generate_background()
    geo_concentric_circles()

    return Svg.Str()
}

func generate_background() {
    args := make(map[string]interface{})
    args["fill"] = "rgb(120, 160, 200)"

    Svg.Rect(0, 0, "100%", "100%", args)
}

func geo_concentric_circles() {
    scale := utils.Hex_val(hash, 0, 1)
    ring_size := utils.Map(scale, 0, 15, 10, 60)
    stroke_width := ring_size/5

    fmt.Println((ring_size + stroke_width) * 6)

    Svg.Set_height(int((ring_size + stroke_width) * 6))
    Svg.Set_width(int((ring_size + stroke_width) * 6))

    i := 0
    for y := 0; y <= 5; y++ {
        for x := 0; x <= 5; x++ {

            val := utils.Hex_val(hash, i, 1)
            opacity := utils.Opacity(val)
            fill := utils.Fill_color(val)

            cx := float64(x) * ring_size + float64(x) * stroke_width + (ring_size + stroke_width)/2
            cy := float64(y) * ring_size + float64(y) * stroke_width + (ring_size + stroke_width)/2

            styles := make(map[string]interface{})
            styles["fill"] = "none"
            styles["stroke"] = fill
            styles["style"] = map[string]string{"opacity": fmt.Sprintf("%v", opacity), "stroke-width": fmt.Sprintf("%vpx", stroke_width)}

            Svg.Circle(cx, cy, ring_size/2, styles)

            val = utils.Hex_val(hash, 39 - i, 1)
            opacity = utils.Opacity(val)
            fill = utils.Fill_color(val)

            styles = make(map[string]interface{})
            styles["fill"] = fill
            styles["fill-opacity"] = opacity

            Svg.Circle(cx, cy, ring_size/4, styles)

            i = i + 1
        }
    }
}

func geo_octagons() {
    square_size := utils.Map(utils.Hex_val(hash, 0, 1), 0, 15, 10, 60)
    tile := shapes.Build_octagon(square_size)

    Svg.Set_height(int(square_size * 6))
    Svg.Set_width(int(square_size * 6))

    i := 0
    for y := 0; y <= 5; y++ {
        for x := 0; x <= 5; x++ {
            val := utils.Hex_val(hash, i ,1)
            opacity := utils.Opacity(val)
            fill := utils.Fill_color(val)

            styles := make(map[string]interface{})
            styles["fill"] = fill
            styles["fill-opacity"] = opacity
            styles["stroke"] = utils.STROKE_COLOR
            styles["stroke-opacity"] = utils.STROKE_OPACITY
            styles["transform"] = fmt.Sprintf("translate(%v, %v)", float64(x) * square_size, float64(y) * square_size)

            Svg.Polyline(tile, styles)

            i = i + 1
        }<commit_msg>initial prototype of concentric rings pattern<commit_after>package pattern

import (
    "fmt"
    "github.com/pravj/geo_pattern/svg"
    "github.com/pravj/geo_pattern/shapes"
    "github.com/pravj/geo_pattern/utils"
)

var Svg = new(svg.SVG)
var hash = utils.Hash("Happy Diwali")

func Start() string {
    generate_background()
    geo_overlapping_rings()

    return Svg.Str()
}

func generate_background() {
    args := make(map[string]interface{})
    args["fill"] = "rgb(120, 160, 200)"

    Svg.Rect(0, 0, "100%", "100%", args)
}

func geo_overlapping_rings() {
    scale := utils.Hex_val(hash, 0 ,1)
    ring_size := utils.Map(scale, 0, 15, 10, 60)
    stroke_width := ring_size / 4

    Svg.Set_height(int(ring_size * 6))
    Svg.Set_width(int(ring_size * 6))

    i := 0
    for y := 0; y <= 5; y++ {
        for x := 0; x <= 5; x++ {

            val := utils.Hex_val(hash, i, 1)
            opacity := utils.Opacity(val)
            fill := utils.Fill_color(val)

            styles := make(map[string]interface{})
            styles["fill"] = "none"
            styles["stroke"] = fill
            styles["style"] = map[string]string{"opacity": fmt.Sprintf("%v", opacity), "stroke-width": fmt.Sprintf("%vpx", stroke_width)}

            Svg.Circle(float64(x) * ring_size, float64(y) * ring_size, ring_size - (stroke_width/2), styles)

            if x == 0 {
                Svg.Circle(6 * ring_size, float64(y) * ring_size, ring_size - (stroke_width/2), styles) 
            }

            if y == 0 {
                Svg.Circle(float64(x) * ring_size, 6 * ring_size, ring_size - (stroke_width/2), styles)
            }

            if x == 0 && y == 0 {
                Svg.Circle(6 * ring_size, 6 * ring_size, ring_size - (stroke_width/2), styles)
            }

            i = i + 1
        }
    }
}

func geo_concentric_circles() {
    scale := utils.Hex_val(hash, 0, 1)
    ring_size := utils.Map(scale, 0, 15, 10, 60)
    stroke_width := ring_size / 5

    fmt.Println((ring_size + stroke_width) * 6)

    Svg.Set_height(int((ring_size + stroke_width) * 6))
    Svg.Set_width(int((ring_size + stroke_width) * 6))

    i := 0
    for y := 0; y <= 5; y++ {
        for x := 0; x <= 5; x++ {

            val := utils.Hex_val(hash, i, 1)
            opacity := utils.Opacity(val)
            fill := utils.Fill_color(val)

            cx := float64(x) * ring_size + float64(x) * stroke_width + (ring_size + stroke_width) / 2
            cy := float64(y) * ring_size + float64(y) * stroke_width + (ring_size + stroke_width) / 2

            styles := make(map[string]interface{})
            styles["fill"] = "none"
            styles["stroke"] = fill
            styles["style"] = map[string]string{"opacity": fmt.Sprintf("%v", opacity), "stroke-width": fmt.Sprintf("%vpx", stroke_width)}

            Svg.Circle(cx, cy, ring_size / 2, styles)

            val = utils.Hex_val(hash, 39 - i, 1)
            opacity = utils.Opacity(val)
            fill = utils.Fill_color(val)

            styles = make(map[string]interface{})
            styles["fill"] = fill
            styles["fill-opacity"] = opacity

            Svg.Circle(cx, cy, ring_size / 4, styles)

            i = i + 1
        }
    }
}

func geo_octagons() {
    square_size := utils.Map(utils.Hex_val(hash, 0, 1), 0, 15, 10, 60)
    tile := shapes.Build_octagon(square_size)

    Svg.Set_height(int(square_size * 6))
    Svg.Set_width(int(square_size * 6))

    i := 0
    for y := 0; y <= 5; y++ {
        for x := 0; x <= 5; x++ {
            val := utils.Hex_val(hash, i ,1)
            opacity := utils.Opacity(val)
            fill := utils.Fill_color(val)

            styles := make(map[string]interface{})
            styles["fill"] = fill
            styles["fill-opacity"] = opacity
            styles["stroke"] = utils.STROKE_COLOR
            styles["stroke-opacity"] = utils.STROKE_OPACITY
            styles["transform"] = fmt.Sprintf("translate(%v, %v)", float64(x) * square_size, float64(y) * square_size)

            Svg.Polyline(tile, styles)

            i = i + 1
        }
{'fraction_non_alphanumeric': 0.15489249670908292, 'fraction_numerical': 0.027351177416995758, 'mean_word_length': 2.2028103044496485, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 3, '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': '67262', 'n_tokens_mistral': 2510, 'n_tokens_neox': 2331, 'n_words': 490}