<commit_before>package plastic

import (
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/collision"
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/event"
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/render"

	"bitbucket.org/StephenPatrick/go-winaudio/winaudio"
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/dlog"
	"fmt"
	"image"
	"image/color"
	"image/draw"
	"log"
	"math/rand"
	"time"

	"golang.org/x/exp/shiny/driver"
	"golang.org/x/exp/shiny/screen"
	"golang.org/x/mobile/event/key"
	"golang.org/x/mobile/event/lifecycle"
	"golang.org/x/mobile/event/mouse"
	"golang.org/x/mobile/event/paint"
	"golang.org/x/mobile/event/size"
)

var (
	initCh        = make(chan bool)
	sceneCh       = make(chan bool)
	quitCh        = make(chan bool)
	ScreenWidth   = 640
	ScreenHeight  = 480
	press         = key.DirPress
	release       = key.DirRelease
	runEventLoop  = false
	drawChannel   = make(chan bool)
	black         = color.RGBA{0x00, 0x00, 0x00, 0xff}
	b             screen.Buffer
	winBuffer     screen.Buffer
	eb            event.EventBus
	viewX         = 0
	viewY         = 0
	useViewBounds = false
	viewBounds    []int
	esc           = false
	l_debug       = false
)

// Scene loop initialization
func Init(firstScene string) {
	dlog.CreateLogFile()
	collision.Init()
	render.InitDrawHeap()
	winaudio.InitWinAudio()

	curSeed := time.Now().UTC().UnixNano()
	curSeed = 1463358974925095300
	rand.Seed(curSeed)
	fmt.Println("\n~~~~~~~~~~~~~~~\nTHE SEED IS:", curSeed, "\n~~~~~~~~~~~~~~~\n")

	go driver.Main(eventLoop)

	prevScene := ""
	sceneMap[firstScene].active = true
	<-initCh
	close(initCh)
	runEventLoop = true
	scene := firstScene
	for {
		dlog.Info("~~~~~~~~~~~Scene Start~~~~~~~~~")
		sceneMap[scene].start(prevScene)
		drawChannel <- true
		cont := true
		for cont {
			select {
			case <-quitCh:
				return

			case <-sceneCh:
				cont = sceneMap[scene].loop()
			}<commit_msg>Resolved index bound issues for making our connection graph<commit_after>package plastic

import (
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/collision"
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/event"
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/render"

	"bitbucket.org/StephenPatrick/go-winaudio/winaudio"
	"bitbucket.org/oakmoundstudio/plasticpiston/plastic/dlog"
	"fmt"
	"image"
	"image/color"
	"image/draw"
	"log"
	"math/rand"
	"time"

	"golang.org/x/exp/shiny/driver"
	"golang.org/x/exp/shiny/screen"
	"golang.org/x/mobile/event/key"
	"golang.org/x/mobile/event/lifecycle"
	"golang.org/x/mobile/event/mouse"
	"golang.org/x/mobile/event/paint"
	"golang.org/x/mobile/event/size"
)

var (
	initCh        = make(chan bool)
	sceneCh       = make(chan bool)
	quitCh        = make(chan bool)
	ScreenWidth   = 640
	ScreenHeight  = 480
	press         = key.DirPress
	release       = key.DirRelease
	runEventLoop  = false
	drawChannel   = make(chan bool)
	black         = color.RGBA{0x00, 0x00, 0x00, 0xff}
	b             screen.Buffer
	winBuffer     screen.Buffer
	eb            event.EventBus
	viewX         = 0
	viewY         = 0
	useViewBounds = false
	viewBounds    []int
	esc           = false
	l_debug       = false
)

// Scene loop initialization
func Init(firstScene string) {
	dlog.CreateLogFile()
	collision.Init()
	render.InitDrawHeap()
	winaudio.InitWinAudio()

	curSeed := time.Now().UTC().UnixNano()
	// Basic seed
	//curSeed = 1463358974925095300
	// Seed that required modifying connection algorithm 7/2
	//curSeed = 1467565587127684400
	rand.Seed(curSeed)
	fmt.Println("\n~~~~~~~~~~~~~~~\nTHE SEED IS:", curSeed, "\n~~~~~~~~~~~~~~~\n")

	go driver.Main(eventLoop)

	prevScene := ""
	sceneMap[firstScene].active = true
	<-initCh
	close(initCh)
	runEventLoop = true
	scene := firstScene
	for {
		dlog.Info("~~~~~~~~~~~Scene Start~~~~~~~~~")
		sceneMap[scene].start(prevScene)
		drawChannel <- true
		cont := true
		for cont {
			select {
			case <-quitCh:
				return

			case <-sceneCh:
				cont = sceneMap[scene].loop()
			}
{'fraction_non_alphanumeric': 0.14723618090452262, 'fraction_numerical': 0.02386934673366834, 'mean_word_length': 3.2852529601722282, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1244092', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1479, 'n_words': 253}