This document presents a study on the development and evaluation of a localization algorithm for wireless sensor networks (WSNs) across various topologies, specifically square, 'C', and 'L' shapes. The proposed method includes initializing sensor networks, selecting anchor nodes, calculating distances, and designating ad hoc nodes to aid in localizing unknown nodes. The performance of the algorithm is analyzed through metrics such as the number of candidate ad hoc nodes, percentage of ad hoc anchor nodes, and normalized localization error.