5 ms·
How not? method makeAutoMove(mark: String[PlayerMark], rnd: Int): Game requires !this->hasWinner(); method makeExplicitMove(x: Int, y:
by hacker_9 7y ago
How not?
method makeAutoMove(mark: String[PlayerMark], rnd: Int): Game
requires !this->hasWinner();
method makeExplicitMove(x: Int, y: Int, mark: String[PlayerMark]): Game
requires !this.board->isCellOccupied(x, y);
If I'm reading it right though, it looks more like it simple doesn't execute the function at all instead of throwing etc. So yet another possible route to deal with an invalid contract.
- asimpletune 7y agoIt could be checked at compile time no?
- Sean1708 7y agoHow would you check them at compile time without using dependent types (at least it doesn't look to me like these are dependent types)?