Play with the Akinator in your Golang program.
go get github.com/Acidic9/go-akinator
Import go-akinator
import "github.com/Acidic9/go-akinator"
Create akinator client
c, err := akinator.NewClient()
if err != nil {
log.Fatal(err)
}
Loop over each response
for r := range c.Next() {
if r.Status != akinator.StatusOk {
log.Fatal("Bad Status:", r.Status)
}
if r.Guessed {
// Akinator made a guess.
// ...
fmt.Println("I guess", r.CharacterName, "is your character.")
continue
}
// Akinator asked a question.
// ...
// For the next response to be called,
// you must answer the akinator's question with r.AnswerYes(), r.AnswerNo(), etc.
}
The official guide Contributing to Open Source on GitHub explains in detail how you can contribute to a project.
A quick explination:
- Fork it
- Create your feature branch (
git checkout -b new-feature
) - Commit your changes (
git commit -am 'Some cool reflection'
) - Push to the branch (
git push origin new-feature
) - Create new Pull Request