本文整理匯總了PHP中Generator::map方法的典型用法代碼示例。如果您正苦於以下問題:PHP Generator::map方法的具體用法?PHP Generator::map怎麽用?PHP Generator::map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Generator
的用法示例。
在下文中一共展示了Generator::map方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: map
function map()
{
$this->clear();
$start = $this->options['start_column'];
$left = $start - $this->lines;
if ($left < 0) {
$left = 0;
}
$line = 0;
for ($col = $start; $col > $left; $col--) {
$this->set($line, $col, $this->options['character']);
$line++;
}
return parent::map();
}
示例2: map
function map()
{
$this->clear();
$start = $this->options['start_column'];
$right = $start + $this->lines;
if ($right < $this->columns) {
$right = $this->columns;
}
$line = 0;
for ($col = $start; $col < $right; $col++) {
$this->set($line, $col, $this->options['character']);
$line++;
}
return parent::map();
}
示例3: map
function map()
{
$this->clear();
for ($l = 0; $l < $this->lines; $l++) {
// line
$line_columns = (int) (($this->lines - $l) / $this->lines * $this->columns);
for ($c = 0; $c < $line_columns; $c++) {
// character
$x = 1.0 - $c / $line_columns;
$y = 1.0 - $l / $this->lines;
$r = Generator::random_0_1();
$z = Generator::f($x, $y);
if ($r > $z) {
$this->set($l, $c, $this->options['character']);
}
}
}
return parent::map();
}