소스 검색

Added higher chance for the first few of something to be picked

tags/v0.7.0
Fen Dweller 7 년 전
부모
커밋
a1908bcad5
2개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. +6
    -1
      recursive-macro.js
  2. +1
    -1
      stroll.html

+ 6
- 1
recursive-macro.js 파일 보기

@@ -58,8 +58,13 @@ function fill_area2(area, weights = {"Person": 0.1, "Car": 0.05, "House": 0.1})
var count = 0;

// for small amounts, actually do the randomness

// the first few ones get a better shot
while (limit > 0) {
count += Math.random() < candidate.weight ? 1 : 0;
if (limit <= 3)
count += Math.random() < (1 - Math.pow((1 - candidate.weight),2)) ? 1 : 0;
else
count += Math.random() < candidate.weight ? 1 : 0;
--limit;
}



+ 1
- 1
stroll.html 파일 보기

@@ -10,7 +10,7 @@
<body>
<div id=game-area>
<div id=log>
<div>Welcome to Stroll 0.1.0</div>
<div>Welcome to Stroll 0.1.1</div>
<div>It's a nice day for a walk</div>
</div>
<button id=button-grow>Get Bigger</button>


불러오는 중...
취소
저장