ch17ex01.pro

来自「prolog,人工智能推理程序,运行环境prolog」· PRO 代码 · 共 47 行

PRO
47
字号
/*
   Turbo Prolog 2.0 Chapter 17, Example Program 1
   
   Copyright (c) 1986, 88 by Borland International, Inc
   
*/
constants
% To access your BGI drivers and fonts bgi_path may need to equal "..\\BGI".
   bgi_path = ""


% To access the GRAPDECL.PRO file you may need to add a path: 
% include "..\\programs\\GRAPDECL.PRO" 
include "GRAPDECL.PRO" 

predicates
   toText
   tempTextmode
   toGraphic

goal
   toGraphic,
   tempTextmode,
   toText.

clauses
   toGraphic:-
      % Detect graphics hardware
      detectGraph(G_Driver, G_Mode),
      initGraph(G_Driver,G_Mode, New_Driver,New_Mode, bgi_path),
      write("A look into the BGI"),nl,
      writef("Graph_Driver = %, Graph_Mode = %",G_Driver,G_Mode),nl,
      writef("Newe_Driver = %, New_Mode = %",New_Driver,New_Mode),nl,	
      write("Press key to return:"),
      readchar(_).

  TempTextmode:-
      getGraphMode(GraphMode),
      restoreCRTMode,
      write("\nNow you are in text mode.\n\n"),
      write("\nPress any key to go back to graphics ..."),
      readchar(_),
      setGraphMode(GraphMode).

   ToText:-
      closegraph().

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?