⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.e

📁 数据挖掘中de一个算法 hamster的实例
💻 E
字号:
-------------------------------------------------------------------------- File    : client.e-- Contents: basic hamster control class-- Authors : Ilona Bl"umel and Christian Borgelt-- History : 11.03.1999 file created------------------------------------------------------------------------class CLIENTcreation  make-------------------------------------------------------------------------- Global Variables------------------------------------------------------------------------feature {NONE}randgen: MIN_STAND;             -- a random number generator-------------------------------------------------------------------------- Methods------------------------------------------------------------------------feature {ANY}make is                         -- create a hamster control objectlocal  hamster: HAMSTER;             -- the controlled hamsterdo  !!randgen.make                -- create a random number generator  !!hamster.make;               -- create the hamster to be controlled  control(hamster);             -- call the hamster control function  hamster.delete;               -- delete the hamster (that is, sendend  -- make                    -- a delete message to the server)------------------------------------------------------------------------random (range: INTEGER): INTEGER isdo                              -- generate a random number  randgen.next;                 -- in the range [1..range]  Result := randgen.last_integer(range);end  -- random------------------------------------------------------------------------control (hamster: HAMSTER) is   -- hamster control function (dummy)local  cnt: INTEGER;                 -- number of turns madedo  from    cnt := 0;                   -- initialize the counter  until    cnt = 50                    -- turn 50 times  loop    hamster.turn(hamster.left); -- turn the hamster left    cnt := cnt +1;              -- count the turn made  endend  -- control------------------------------------------------------------------------end  -- CLIENT

⌨️ 快捷键说明

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