After implementing the join() function, it’s time to define the ping() function, which will allow the player to update their activity, as follows:
function ping() external returns(bool) {
ping_time[msg.sender] = now;
return true;
}
There's nothing complex about this code. Each time ping() is called, we will store the current time returned by now as the new ping time. Players will not literally ping the contract as we do in a network, they will only send a transaction invoking the ping method to prove their activity.