// Homework 27, problem 2: Character. // // Build a character struct with name, hp and maxHP fields, and: // newCharacter(name, hp) -- a function that returns a *character // takeDamage(amount) -- lowers hp, never below 0 // heal(amount) -- raises hp, never above maxHP // isAlive() -- returns true while hp is above 0 // report() -- prints ": / HP (alive: )" // // Walk through a small fight: report, damage 30, report, damage 80, report, // heal 20, report. // // Run with: go run exercises/27/homework/02-character.go package main import "fmt" // TODO: define the character struct, newCharacter and the methods here. func main() { // TODO: write your code here, in place of this placeholder line: fmt.Println("TODO: replace this line") }