* get_wormno() * * Find an unused worm tail slot and return the index. A zero means that * there are no slots available. This means that the worm head can exist, * it just cannot ever grow a tail. * * It, also, means that there is an optimization to made. The [0] positions * of the arrays are never used. Meaning, we really *could* have one more * tailed worm on the level, or use
| 93 | * Implementation is left to the interested hacker. |
| 94 | */ |
| 95 | int |
| 96 | get_wormno(void) |
| 97 | { |
| 98 | int new_wormno = 1; |
| 99 | |
| 100 | while (new_wormno < MAX_NUM_WORMS) { |
| 101 | if (!wheads[new_wormno]) |
| 102 | return new_wormno; /* found empty wtails[] slot at new_wormno */ |
| 103 | new_wormno++; |
| 104 | } |
| 105 | return 0; /* level infested with worms */ |
| 106 | } |
| 107 | |
| 108 | /* |
| 109 | * initworm() |
no outgoing calls
no test coverage detected