Akavall / GoGamesProject

Trying to make some simple games using golang.
1 stars 1 forks source link

changed AppendDice to AddDice #21

Closed Akavall closed 9 years ago

Akavall commented 9 years ago

I was going to add interfaces, but ran into problems, so I am just submitting this.

Problems:

Since our AIs will take different parameters it will create different functions signatures, so we cannot user interface for that. And we cannot specify shouldKeepGoing() with different signatures in the interface:

type Addy interface{
    add(x, y int) int
    add(x, y, z int) int  // duplicate method add
}

Unless I am missing something, something like this is not allowed.

If the above does not work, the only other option I see is to pass all the possible parameters to every AI, and they will just use what they need. But I am not sure this would be better deign, probably not.