[Attempto] outsourcing business logic
George Herson
gherson at snet.net
Sat Apr 4 18:40:28 CEST 2015
What are thepracticalities of outsourcing the business logic of a general purpose program to ACE? Let's say I want a program to allow two players to play TicTacToe. So I define the game in ACE:
# SetupTicTacToe is a game.
Every game has a board and status and exactly 2 players.If status is not tied or won it is in-progress.The board has exactly nine squares.The squares are square1 … square9.The suits are X and O.Every mark has exactly 1 suit.Every square has exactly 0 or 1 marks.
# PlayThe players are Player1 and Player2.
Every player has exactly 1 suit.
Players have turns.A turn is addingexactly 1 mark to the board.Every mark belongs to the player that added it.A player cannot place a mark if that player owns previous mark. # Alternate turnsA player cannot placea mark whose suit is that of the other player. # A player is X xor O
A player cannot place a mark if status is not in-progress. # Stop playIf the Board hasnine marks the status is tied.If a player has 3 marksin the same row, column, or diagonal, status is that that player wins.A row is …Et cetera.
Then ACE is kept updated during play: Turn for Player1 is adding mark X to Square6.
Each turn is followed by query What is game status?
Response could be X won or Conflict with "Every square has exactly 0 or 1 marks", ... et cetera.
I'm interested in implementation and also for a guest lecture to gifted middle school students interested in programming (to be followed with programming lectures throughout July).
Thank you,George Herson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ifi.uzh.ch/pipermail/attempto/attachments/20150404/b1909717/attachment.html>
More information about the attempto
mailing list