Skip to content

Commit

Permalink
Get everything working
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Overmyer committed Apr 15, 2019
1 parent 2941635 commit eadae3a
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 45 deletions.
16 changes: 10 additions & 6 deletions cmd/worldapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
"github.com/ironarachne/random"
"github.com/ironarachne/world/pkg/character"
"github.com/ironarachne/world/pkg/culture"
"github.com/ironarachne/world/pkg/organization"
"github.com/ironarachne/world/pkg/pantheon"
"github.com/ironarachne/world/pkg/region"
"github.com/ironarachne/world/pkg/town"
)

func getCharacter(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -88,7 +92,7 @@ func getPantheon(w http.ResponseWriter, r *http.Request) {

random.SeedFromString(id)

o = pantheon.Generate()
o = pantheon.Generate(26)

json.NewEncoder(w).Encode(o)
}
Expand All @@ -98,7 +102,7 @@ func getPantheonRandom(w http.ResponseWriter, r *http.Request) {

rand.Seed(time.Now().UnixNano())

o = pantheon.Generate()
o = pantheon.Generate(26)

json.NewEncoder(w).Encode(o)
}
Expand All @@ -110,7 +114,7 @@ func getRegion(w http.ResponseWriter, r *http.Request) {

random.SeedFromString(id)

o = region.Generate()
o = region.Generate("random")

json.NewEncoder(w).Encode(o)
}
Expand All @@ -120,7 +124,7 @@ func getRegionRandom(w http.ResponseWriter, r *http.Request) {

rand.Seed(time.Now().UnixNano())

o = region.Generate()
o = region.Generate("random")

json.NewEncoder(w).Encode(o)
}
Expand All @@ -132,7 +136,7 @@ func getTown(w http.ResponseWriter, r *http.Request) {

random.SeedFromString(id)

o = town.Generate()
o = town.Generate("random", "random")

json.NewEncoder(w).Encode(o)
}
Expand All @@ -142,7 +146,7 @@ func getTownRandom(w http.ResponseWriter, r *http.Request) {

rand.Seed(time.Now().UnixNano())

o = town.Generate()
o = town.Generate("random", "random")

json.NewEncoder(w).Encode(o)
}
Expand Down
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/ironarachne/world

require (
github.com/Joker/hpp v1.0.0 // indirect
github.com/ajstarks/svgo v0.0.0-20181006003313-6ce6a3bcf6cd
github.com/divan/num2words v0.0.0-20170904212200-57dba452f942
github.com/go-chi/chi v4.0.2+incompatible
github.com/ironarachne/heraldry v0.0.0-20190325172346-07bf7eeae990
github.com/ironarachne/naminglanguage v0.0.0-20190326140911-90c4c9184634
github.com/ironarachne/random v0.0.0-20190325170425-9caaa0b3405a
github.com/ironarachne/utility v0.0.0-20181021125830-32a6c250e33b
github.com/juju/testing v0.0.0-20190415054131-a282c42ba059 // indirect
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a // indirect
golang.org/x/net v0.0.0-20190415100556-4a65cf94b679 // indirect
golang.org/x/sys v0.0.0-20190415145633-3fd5a3612ccd // indirect
golang.org/x/tools v0.0.0-20190415154727-2b5498619ef1 // indirect
)
71 changes: 71 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Joker/hpp v0.0.0-20180418125244-6893e659854a/go.mod h1:MzD2WMdSxvbHw5fM/OXOFily/lipJWRc9C1px0Mt0ZE=
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
github.com/Joker/jade v1.0.0/go.mod h1:efZIdO0py/LtcJRSa/j2WEklMSAw84WV0zZVMxNToB8=
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/ajstarks/svgo v0.0.0-20181006003313-6ce6a3bcf6cd h1:JdtityihAc6A+gVfYh6vGXfZQg+XOLyBvla/7NbXFCg=
github.com/ajstarks/svgo v0.0.0-20181006003313-6ce6a3bcf6cd/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/divan/num2words v0.0.0-20170904212200-57dba452f942 h1:fJ8/Lid8fF4i7Bwl7vWKvG2KeZzr3yU4qG6h/DPdXLU=
github.com/divan/num2words v0.0.0-20170904212200-57dba452f942/go.mod h1:K88GQWK1aAiPMo9q2LZwyKBfEGnge7kmVVTUcZ61HSc=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/flosch/pongo2 v0.0.0-20181225140029-79872a7b2769/go.mod h1:tbAXHifHQWNSpWbiJHpJTZH5fi3XHhDMdP//vuz9WS4=
github.com/go-check/check v1.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI=
github.com/iris-contrib/formBinder v0.0.0-20190104093907-fbd5963f41e1/go.mod h1:i8kTYUOEstd/S8TG0ChTXQdf4ermA/e8vJX0+QruD9w=
github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0=
github.com/ironarachne/heraldry v0.0.0-20190325172346-07bf7eeae990 h1:mekG9VvMDcbEVif9E43R8eOsWz3WQBUvd+i89Ur06XM=
github.com/ironarachne/heraldry v0.0.0-20190325172346-07bf7eeae990/go.mod h1:gQEvdxW/dafJgeFEjoOu8jKtk6DW2wqHBAM95cb5+48=
github.com/ironarachne/naminglanguage v0.0.0-20190326140911-90c4c9184634 h1:p9Rg9Xt34r+oEmZ+sWz49ef2dCVTCN0z+cHsJaoo6eg=
github.com/ironarachne/naminglanguage v0.0.0-20190326140911-90c4c9184634/go.mod h1:iQlQfXBFCQzoRgnBym09tjmTfI3gRBmxactk18WNP0A=
github.com/ironarachne/random v0.0.0-20190325170425-9caaa0b3405a h1:Wf3LfJ3RJ9m7WFveQs/S6I/NkNiviSfew9afED9BPS0=
github.com/ironarachne/random v0.0.0-20190325170425-9caaa0b3405a/go.mod h1:YUzpzLiGzz2YTOhXMk61UBGze9jiaKfpFXF6YF2nd2Q=
github.com/ironarachne/utility v0.0.0-20181021125830-32a6c250e33b h1:EhG1yiJbIUwbHhtAAqoPxW0ClJnE9W5HLSyHSu9gVk8=
github.com/ironarachne/utility v0.0.0-20181021125830-32a6c250e33b/go.mod h1:1pbHvjC5wh3M6kSUB46xHYUnWZ1iMqr8h/07w0n2Gak=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
github.com/juju/errors v0.0.0-20190207033735-e65537c515d7/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
github.com/juju/loggo v0.0.0-20190212223446-d976af380377/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
github.com/juju/testing v0.0.0-20190415054131-a282c42ba059/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
github.com/kataras/golog v0.0.0-20180321173939-03be10146386/go.mod h1:PcaEvfvhGsqwXZ6S3CgCbmjcp+4UDUh2MIfF2ZEul8M=
github.com/kataras/iris v11.1.1+incompatible/go.mod h1:ki9XPua5SyAJbIxDdsssxevgGrbpBmmvoQmo/A0IodY=
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190324223953-e3b2ff56ed87/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190415100556-4a65cf94b679/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190415145633-3fd5a3612ccd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190325161752-5a8dccf5b48a/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190415154727-2b5498619ef1/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
18 changes: 9 additions & 9 deletions pkg/character/character.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ func (character Character) randomFacialHair() string {
return "none"
}

// GenerateCharacter generates a random character
func GenerateCharacter() Character {
// Generate generates a random character
func Generate() Character {
char := Character{}

char.Gender = random.Item(genders)
char.Culture = culture.GenerateCulture()
char.Culture = culture.Generate()

char.FirstName, char.LastName = getAppropriateName(char.Gender, char.Culture)

Expand Down Expand Up @@ -222,16 +222,16 @@ func GenerateCharacter() Character {

// GenerateCharacterOfCulture generates a random character with a given culture
func GenerateCharacterOfCulture(culture culture.Culture) Character {
character := GenerateCharacter()
character := Generate()
character = character.SetCulture(culture)

return character
}

// GenerateCouple generates a couple
func GenerateCouple() Couple {
char1 := GenerateCharacter()
char2 := GenerateCharacter()
char1 := Generate()
char2 := Generate()
canHaveChildren := false

if char1.AgeCategory == "child" {
Expand Down Expand Up @@ -270,7 +270,7 @@ func GenerateCouple() Couple {

// GenerateAdultDescendent generates an adult character based on a couple
func GenerateAdultDescendent(couple Couple) Character {
descendent := GenerateCharacter()
descendent := Generate()

descendent.LastName = couple.Partner1.LastName

Expand All @@ -282,7 +282,7 @@ func GenerateAdultDescendent(couple Couple) Character {

// GenerateChild generates a child character for a couple
func GenerateChild(couple Couple) Character {
child := GenerateCharacter()
child := Generate()

child.LastName = couple.Partner1.LastName
child.Age, child.AgeCategory = getAgeFromParents(couple)
Expand All @@ -296,7 +296,7 @@ func GenerateChild(couple Couple) Character {

// GenerateCompatibleMate generates a character appropriate as a mate for another
func GenerateCompatibleMate(char Character) Character {
mate := GenerateCharacter()
mate := Generate()

mate.Age = getRandomAge(char.AgeCategory)
mate.AgeCategory = getAgeCategoryFromAge(mate.Age)
Expand Down
10 changes: 6 additions & 4 deletions pkg/culture/culture.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package culture

import (
"math/rand"

"github.com/ironarachne/world/pkg/climate"
)

// Culture is a fantasy culture
Expand All @@ -26,8 +28,8 @@ type Culture struct {
Religion Religion
}

// GenerateCulture generates a culture
func GenerateCulture() Culture {
// Generate generates a culture
func Generate() Culture {
culture := Culture{}

culture.Language = randomLanguage()
Expand Down Expand Up @@ -59,9 +61,9 @@ func GenerateCulture() Culture {
}

// SetClimate sets the climate and recalculates some traits
func (culture Culture) SetClimate(climate string) Culture {
func (culture Culture) SetClimate(query string) Culture {
newCulture := culture
newCulture.HomeClimate = climate.GetClimate(climate)
newCulture.HomeClimate = climate.GetClimate(query)
newCulture.MusicStyle = newCulture.randomMusicStyle()
newCulture.ClothingStyle = newCulture.generateClothingStyle()
newCulture.FoodStyle = newCulture.generateFoodStyle()
Expand Down
4 changes: 2 additions & 2 deletions pkg/culture/religion.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package culture

import (
"github.com/ironarachne/world/pkg/pantheon"
"github.com/ironarachne/random"
"github.com/ironarachne/world/pkg/pantheon"
)

// Religion is a culture's religion
Expand All @@ -28,7 +28,7 @@ func (culture Culture) generateReligion() Religion {
religion.GatheringPlaceName = religion.randomGatheringPlaceName()

if religion.Class.PantheonMaxSize > 0 {
religion.Pantheon = pantheon.GeneratePantheon(religion.Class.PantheonMaxSize)
religion.Pantheon = pantheon.Generate(religion.Class.PantheonMaxSize)
}

for _, deity := range religion.Pantheon.Deities {
Expand Down
4 changes: 2 additions & 2 deletions pkg/pantheon/pantheon.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func (pantheon Pantheon) GenerateDeity() Deity {
return deity
}

// GeneratePantheon creates a random pantheon of deities
func GeneratePantheon(maxSize int) Pantheon {
// Generate creates a random pantheon of deities
func Generate(maxSize int) Pantheon {
var deity Deity
var pantheon Pantheon

Expand Down
28 changes: 14 additions & 14 deletions pkg/region/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"math/rand"
"strings"

"github.com/ironarachne/chargen"
"github.com/ironarachne/random"
"github.com/ironarachne/world/pkg/character"
"github.com/ironarachne/world/pkg/climate"
"github.com/ironarachne/world/pkg/culture"
"github.com/ironarachne/heraldry"
"github.com/ironarachne/world/pkg/heraldry"
"github.com/ironarachne/world/pkg/organization"
"github.com/ironarachne/random"
"github.com/ironarachne/world/pkg/town"
)

Expand Down Expand Up @@ -45,34 +45,34 @@ func randomClass() RegionClass {
return regionClass
}

// GenerateRegion generates a random region
func GenerateRegion(regionType string) Region {
// Generate generates a random region
func Generate(regionType string) Region {
region := Region{}
climate := climate.Climate{}
biome := climate.Climate{}

if regionType == "random" {
climate = climate.Generate()
biome = climate.Generate()
} else {
climate = climate.GetClimate(regionType)
biome = climate.GetClimate(regionType)
}

regionType = climate.Name
regionType = biome.Name

region.Biome = climate.Name
region.Climate = climate
region.Culture = culture.GenerateCulture()
region.Biome = biome.Name
region.Climate = biome
region.Culture = culture.Generate()
region.Culture = region.Culture.SetClimate(region.Biome)

region.Class = randomClass()

newTown := town.GenerateTown("city", regionType)
newTown := town.Generate("city", regionType)
newTown = town.SetCulture(region.Culture, newTown)
region.Towns = append(region.Towns, newTown)

region.Capital = newTown.Name

for i := region.Class.MinNumberOfTowns - 1; i < region.Class.MaxNumberOfTowns-1; i++ {
newTown = town.GenerateTown("random", regionType)
newTown = town.Generate("random", regionType)
newTown = town.SetCulture(region.Culture, newTown)
region.Towns = append(region.Towns, newTown)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/region/ruler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package region
import (
"math/rand"

"github.com/ironarachne/chargen"
"github.com/ironarachne/world/pkg/character"
)

func (region Region) generateRuler() character.Character {
Expand Down
14 changes: 7 additions & 7 deletions pkg/town/town.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package town
import (
"math/rand"

"github.com/ironarachne/chargen"
"github.com/ironarachne/random"
"github.com/ironarachne/world/pkg/character"
"github.com/ironarachne/world/pkg/climate"
"github.com/ironarachne/world/pkg/culture"
"github.com/ironarachne/random"
)

// Town is a town
Expand Down Expand Up @@ -77,22 +77,22 @@ func (town Town) generateTownName() string {
return name
}

// GenerateTown generates a random town
func GenerateTown(category string, climate string) Town {
// Generate generates a random town
func Generate(category string, biome string) Town {
town := Town{}

if category == "random" {
town.Category = generateRandomCategory()
} else {
town.Category = townCategories[category]
}
if climate == "random" {
if biome == "random" {
town.Climate = climate.Generate()
} else {
town.Climate = climate.GetClimate(climate)
town.Climate = climate.GetClimate(biome)
}

culture := culture.GenerateCulture()
culture := culture.Generate()
culture = culture.SetClimate(town.Climate.Name)
town = SetCulture(culture, town)

Expand Down

0 comments on commit eadae3a

Please sign in to comment.