2 Star 8 Fork 4

sailor-Wang/golang-design-pattern

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
memento_test.go 278 Bytes
一键复制 编辑 原始数据 按行查看 历史
sailor-Wang 提交于 5年前 . go语言设计模式
package memento
func ExampleGame() {
game := &Game{
hp: 10,
mp: 10,
}
game.Status()
progress := game.Save()
game.Play(-2, -3)
game.Status()
game.Load(progress)
game.Status()
// Output:
// Current HP:10, MP:10
// Current HP:7, MP:8
// Current HP:10, MP:10
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/git_sailor/golang-design-pattern.git
git@gitee.com:git_sailor/golang-design-pattern.git
git_sailor
golang-design-pattern
golang-design-pattern
master

搜索帮助