| Algorithm 2 Proposed Algorithm | |
| 1. | Initialize: |
| 2. | r = current round |
| 3. | Begin |
| 4. | for r = 1:max |
| 5. | if the sensor network operating normally |
| 6. | The sensors nodes are clustered |
| 7. | if the sensor in the cluster adopt cooperative strategy |
| 8. | The sensor node decides their own state according to the game strategy |
| 9. | else |
| 10. | Calculate the number of penalty rounds M |
| 11. | Mark the ID of the nodes and punish M rounds |
| 12. | end if |
| 13. | else |
| 14. | End of simulation |
| 15. | end if |
| 16. | end for |