(result, rect)
| 906 | } |
| 907 | |
| 908 | function addRect (result, rect) { |
| 909 | if (result.falseCount > 100) { |
| 910 | // console.log('infinite loop', rect) |
| 911 | result.falseCount = 0 |
| 912 | return true |
| 913 | } |
| 914 | |
| 915 | for (const existingRect of result.rects) { |
| 916 | if ((Math.abs(existingRect.x - rect.x) <= ((rect.width / 2) + (existingRect.width / 2))) && (Math.abs(existingRect.y - rect.y) <= ((rect.height / 2) + (existingRect.height / 2)))) { |
| 917 | result.falseCount++ |
| 918 | return false |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | result.rects.push(rect) |
| 923 | return true |
| 924 | } |
| 925 | |
| 926 | function getRandomThang (thangList) { |
| 927 | return thangList[_.random(0, thangList.length - 1)] |
no outgoing calls
no test coverage detected