Game framework

Description

Framework for Game Playing.

Source: The Art of Prolog

Download

Program source code: game_framework.pl

Listing

/*
   play(Game) :- Play game with name Game.
*/
     play(Game) :- 
	initialize(Game,Position,Player), 
	display_game(Position,Player),
	play(Position,Player,Result).
 
     play(Position,Player,Result) :- 
        game_over(Position,Player,Result), !, announce(Result).
     play(Position,Player,Result) :-
        choose_move(Position,Player,Move),
        move(Move,Position,Position1),
        display_game(Position1,Player), 
        next_player(Player,Player1),
        !, play(Position1,Player1,Result).
 
%   Program 20.8 : Framework for Game Playing.

Comments

pl/prolog/pllib/game_framework.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0