<commit_before>package main

import (
	"time"

	"github.com/Queens-Hacks/Propagate/sim"
	"github.com/Sirupsen/logrus"
	"golang.org/x/net/context"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	total := make(chan []byte)
	diff := make(chan []byte)

	s := sim.SimpleState(100, 50)
	data, err := sim.MarshalGameState(s)
	if err != nil {
		logrus.Fatal(err)
	}

	go func() {
		total <- data
	}()

	port := ":4444"

	logrus.Infof("Listening on port %s", port)
	go New(ctx, total, diff, port)

	for {
		st, df := updateState(&s, sim.DirtTile)
		total <- st
		diff <- df

		time.Sleep(time.Second)

		st, df = updateState(&s, sim.DirtTile)
		total <- st
		diff <- df
	}
}

func updateState(s *sim.State, t sim.TileType) ([]byte, []byte) {
	for x := 40; x < 60; x++ {
		for y := 20; y < 25; y++ {
			s.SetTile(sim.Location{x, y}, sim.Tile{T: t})
		}
	}
	s.Finalize()
	st := s.MarshalState()
	df := s.MarshalDiff()
	return st, df
}<commit_msg>log data sent<commit_after>package main

import (
	"fmt"
	"time"

	"github.com/Queens-Hacks/Propagate/sim"
	"github.com/Sirupsen/logrus"
	"golang.org/x/net/context"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	total := make(chan []byte)
	diff := make(chan []byte)

	s := sim.SimpleState(100, 50)
	data, err := sim.MarshalGameState(s)
	if err != nil {
		logrus.Fatal(err)
	}

	go func() {
		total <- data
	}()

	port := ":4444"

	logrus.Infof("Listening on port %s", port)
	go New(ctx, total, diff, port)

	for {
		st, df := updateState(&s, sim.DirtTile)
		total <- st
		diff <- df

		time.Sleep(5 * time.Second)

		st, df = updateState(&s, sim.DirtTile)
		total <- st
		diff <- df
	}
}

func updateState(s *sim.State, t sim.TileType) ([]byte, []byte) {
	for x := 40; x < 60; x++ {
		for y := 20; y < 25; y++ {
			s.SetTile(sim.Location{x, y}, sim.Tile{T: t})
		}
	}
	s.Finalize()
	st := s.MarshalState()
	df := s.MarshalDiff()
	fmt.Printf("total: %s", st)
	fmt.Printf("diff: %s", df)
	return st, df
}
{'fraction_non_alphanumeric': 0.1910167818361303, 'fraction_numerical': 0.017275419545903257, 'mean_word_length': 3.3036093418259025, 'pattern_counts': {'":': 2, '<': 17, '<?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': '1403223', 'n_tokens_mistral': 928, 'n_tokens_neox': 838, 'n_words': 200}