Skip to content

Commit

Permalink
feat!: in Rome
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Still not working
  • Loading branch information
squillero committed Aug 3, 2024
1 parent bdcde5b commit f5f7a8a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 2024-25/golang-demos/shortest-path/british-museum.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func britishMuseum(graph *Graph, feed chan<- interface{}, tag int32) {
cs := float32(graph.canvasSize)
for {
var p viz.TaggedPolyline
var p viz.TaggedVanishingPolyline
p.Tag = tag
p.Points = make([]viz.Point, 0)
for np := 3 + rand.Intn(10); np > 0; np -= 1 {
Expand Down
3 changes: 3 additions & 0 deletions 2024-25/golang-demos/shortest-path/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ require (
github.com/ebitengine/gomobile v0.0.0-20240518074828-e86332849895 // indirect
github.com/ebitengine/hideconsole v1.0.0 // indirect
github.com/ebitengine/purego v0.7.0 // indirect
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984 // indirect
github.com/jezek/xgb v1.1.1 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.16.0 // indirect
)
8 changes: 8 additions & 0 deletions 2024-25/golang-demos/shortest-path/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
github.com/ebitengine/purego v0.7.0 h1:HPZpl61edMGCEW6XK2nsR6+7AnJ3unUxpTZBkkIXnMc=
github.com/ebitengine/purego v0.7.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984 h1:NwCC36eQsDf1xVZG9jD7ngXNNjsvk8KXky15ogA1Vo0=
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984/go.mod h1:2+owI/sxa73XA581LAzVuEBZ3WEEV2pXeDswCH/3i1I=
github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66 h1:GUrm65PQPlhFSKjLPGOZNPNxLCybjzjYBzjfoBGaDUY=
github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66/go.mod h1:DDxDdQEnB70R8owOx3LVpEFvpMK9eeH1o2r0yZhFI9o=
github.com/hajimehoshi/bitmapfont/v3 v3.0.0 h1:r2+6gYK38nfztS/et50gHAswb9hXgxXECYgE8Nczmi4=
github.com/hajimehoshi/bitmapfont/v3 v3.0.0/go.mod h1:+CxxG+uMmgU4mI2poq944i3uZ6UYFfAkj9V6WqmuvZA=
github.com/hajimehoshi/ebiten/v2 v2.7.8 h1:QrlvF2byCzMuDsbxFReJkOCbM3O2z1H/NKQaGcA8PKk=
github.com/hajimehoshi/ebiten/v2 v2.7.8/go.mod h1:Ulbq5xDmdx47P24EJ+Mb31Zps7vQq+guieG9mghQUaA=
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
Expand All @@ -14,3 +20,5 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
34 changes: 29 additions & 5 deletions 2024-25/golang-demos/shortest-path/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,28 @@ package main

import (
"demo-sp/viz"
"flag"
"log"
"log/slog"
)

const CanvasSize int = 1000
const WindowSize int = 800
const (
CanvasSize int = 1000
WindowSize int = 800
)

func main() {
log.SetPrefix("CI24 ") // 🐁
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lmsgprefix | log.LUTC)

// command line arguments
verbose := flag.Bool("v", false, "Verbose operations")
flag.Parse()
if *verbose {
slog.SetLogLoggerLevel(slog.LevelDebug)
}
slog.Debug("This is Computational Intelligence 🐹 2024/25!")

// Create problem
numVertexes := 50
edgeDensity := 0.01
Expand All @@ -23,13 +39,13 @@ func main() {

go func() {
for _, c := range graph.nodes {
feed <- viz.Circle{Color: viz.ColorBabyPink, Center: c, Radius: 5}
feed <- viz.ColoredCircle{Color: viz.ColorBabyPink, Center: c, Radius: 3}
}
for n1 := 0; n1 < numVertexes; n1 += 1 {
for n2 := n1 + 1; n2 < numVertexes; n2 += 1 {
if graph.edges[n1][n2] > 0 {
feed <- viz.Polyline{Color: viz.ColorBabyPink,
Points: []viz.Point{graph.nodes[n1], graph.nodes[n2]}}
feed <- viz.ColoredPolyline{Color: viz.ColorBabyPink,
Polyline: viz.Polyline{Points: []viz.Point{graph.nodes[n1], graph.nodes[n2]}}}
}
}
}
Expand All @@ -39,6 +55,14 @@ func main() {
go britishMuseum(graph, feed, 1)
go britishMuseum(graph, feed, 2)
go britishMuseum(graph, feed, 3)

go func() {
feed <- viz.TaggedText{Tag: 0, Text: "British Museum Algorithm"}
feed <- viz.TaggedText{Tag: 1, Text: "British Museum Algorithm"}
feed <- viz.TaggedText{Tag: 2, Text: "British Museum Algorithm"}
feed <- viz.TaggedText{Tag: 3, Text: "British Museum Algorithm"}
}()

viz.Run(feed, "Zap!", CanvasSize, WindowSize)
//britishMuseum(graph)
}

0 comments on commit f5f7a8a

Please sign in to comment.