Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- type Item struct {
- desc string
- value int
- }
- type Recipe struct {
- name string
- contents []RecipeItem
- }
- type RecipeItem struct {
- item Item
- amount int
- }
- func main() {
- materials := map[string]Item{
- "Iron": Item{
- desc: "Common metal",
- value: 10,
- },
- "Gold": Item{
- desc: "Less common metal",
- value: 15,
- },
- "Wood": Item{
- desc: "Common tree stuff",
- value: 2,
- },
- }
- recipes := []Recipe{
- Recipe{
- name: "Pickaxe",
- contents: []RecipeItem{
- RecipeItem{
- item: materials["Iron"],
- amount: 3,
- },
- RecipeItem{
- item: materials["Wood"],
- amount: 2,
- },
- },
- },
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement