2014-05-24 00:39:22 -07:00
|
|
|
// Copyright 2014 Team 254. All Rights Reserved.
|
|
|
|
|
// Author: pat@patfairbank.com (Patrick Fairbank)
|
|
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2021-05-16 11:00:29 -07:00
|
|
|
"github.com/Team254/cheesy-arena-lite/field"
|
|
|
|
|
"github.com/Team254/cheesy-arena-lite/web"
|
2014-05-24 00:39:22 -07:00
|
|
|
"log"
|
2014-05-25 17:21:42 -07:00
|
|
|
"math/rand"
|
|
|
|
|
"time"
|
2014-05-24 00:39:22 -07:00
|
|
|
)
|
|
|
|
|
|
2014-06-07 02:02:12 -07:00
|
|
|
const eventDbPath = "./event.db"
|
2017-08-28 20:14:32 -07:00
|
|
|
const httpPort = 8080
|
2014-05-25 22:41:28 -07:00
|
|
|
|
2014-09-06 22:25:12 -07:00
|
|
|
// Main entry point for the application.
|
2014-05-24 00:39:22 -07:00
|
|
|
func main() {
|
2014-05-25 17:21:42 -07:00
|
|
|
rand.Seed(time.Now().UnixNano())
|
2014-06-07 02:02:12 -07:00
|
|
|
|
2017-08-28 20:14:32 -07:00
|
|
|
arena, err := field.NewArena(eventDbPath)
|
2014-05-24 00:39:22 -07:00
|
|
|
if err != nil {
|
2017-08-28 20:14:32 -07:00
|
|
|
log.Fatalln("Error during startup: ", err)
|
2014-05-24 00:39:22 -07:00
|
|
|
}
|
2017-08-28 20:14:32 -07:00
|
|
|
|
|
|
|
|
// Start the web server in a separate goroutine.
|
2017-08-31 23:26:22 -07:00
|
|
|
web := web.NewWeb(arena)
|
2017-08-28 20:14:32 -07:00
|
|
|
go web.ServeWebInterface(httpPort)
|
|
|
|
|
|
|
|
|
|
// Run the arena state machine in the main thread.
|
|
|
|
|
arena.Run()
|
2014-05-24 00:39:22 -07:00
|
|
|
}
|