📄 walk2d.h
字号:
#ifndef _WALK2D_H
#define _WALK2D_H
#include "point.h"
class RandomWalk2D
{
public:
RandomWalk2D(long maxSteps,
int size); // # of steps, size of one step
void Init(); // take first step of walk
bool HasMore(); // returns false if walk finished, else true
void Next(); // take next step of random walk
void Simulate(); // complete an entire random walk
long TotalSteps() const; // total # of steps taken by molecule
Point Position() const; // current position
Point Current() const; // alias for Position
private:
void TakeStep(); // simulate one step of walk
Point myPosition; // coordinate of current position
long mySteps; // # of steps taken
int myStepSize; // size of step
long myMaxSteps; // maximum # of steps allowed
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -