You can use 'await self._client.leave()' to surrender midst game.
483723
async def leave(self):
        
        is_resign = self._game_result is None

        if is_resign:
            # For all clients that can leave, result of leaving the game either
            # loss, or the client will ignore the result
            self._game_result = {self._player_id: Result.Defeat}

        try:
            await self._execute(leave_game=sc_pb.RequestLeaveGame())
        except ProtocolError:
            if is_resign:
                raise
1249333
async def leave(self, *, force: bool = False) -> bool:
        

        params = {"force": force}

        await self.docker._query("swarm/leave", method="POST", params=params)

        return True
1022548
def wait_closed(self):
        
        if self._closed:
            return
        if not self._closing:
            raise RuntimeError(
                ".wait_closed() should be called "
                "after .close()"
            )

        while self._free:
            conn = self._free.popleft()
            if not conn.closed:
                yield from conn.close()
            else:
                # pragma: no cover
                pass
        with (yield from self._cond):
            while self.size > self.freesize:
                yield from self._cond.wait()
        self._used.clear()
        self._closed = True
1024182
function leave() {
            var data = [];
            data.push('leave=' + Math.floor(Math.random() * 10000));

            post(data.join('&'), trackingUrl);
        }
1172122
def exit(self, result=0, msg=None, *args, **kwargs):
    """"""
    if self._finalizer:
      try:
        self._finalizer()
      except Exception as e:
        try:
          NailgunProtocol.send_stderr(
            self._socket,
            '\nUnexpected exception in finalizer: {!r}\n'.format(e)
          )
        except Exception:
          pass

    try:
      # Write a final message to stderr if present.
      if msg:
        NailgunProtocol.send_stderr(self._socket, msg)

      # Send an Exit chunk with the result.
      NailgunProtocol.send_exit_with_code(self._socket, result)

      # Shutdown the connected socket.
      teardown_socket(self._socket)
    finally:
      super(DaemonExiter, self).exit(result=result, *args, **kwargs)
572682
def stop(self):
        """"""

        if self._disconnector:
            self._disconnector.stop()

        self.client.disconnect()
180920
function(client) {
            if(client.debug >= 1)
                client.log(client.balls[client.leaders[0]] + ' WON THE GAME! Server going for restart');

            client.emitEvent('winner', client.leaders[0]);
        }
1352991
def _do_leave(self, leave, in_port, msg):
        """"""
        datapath = msg.datapath
        parser = datapath.ofproto_parser

        self._mcast.setdefault(leave.address, {})
        if in_port in self._mcast[leave.address]:
            self._del_flow_entry(
                datapath, in_port, leave.address)
            del self._mcast[leave.address][in_port]
            actions = []
            for port in self._mcast[leave.address]:
                actions.append(parser.OFPActionOutput(port))
            if len(actions):
                self._set_flow_entry(
                    datapath, actions, self.server_port, leave.address)
            else:
                self._del_flow_entry(
                    datapath, self.server_port, leave.address)
832763
def on_exit(self):
        
        answer = messagebox.askyesnocancel("Exit", "Do you want to save as you quit the application?")
        if answer:
            self.save()
            self.quit()
            self.destroy()
        elif answer is None:
            pass # the cancel action
        else:
            self.quit()
            self.destroy()
746172
def release_client(self, cb):
        
        if cb:
            self._q.put(cb, True)
            self._clients_in_use -= 1
92605
def leave(self):
        
        try:
            self.client.api.leave_room(self.room_id)
            del self.client.rooms[self.room_id]
            return True
        except MatrixRequestError:
            return False
880702
async def release(self, *args, **kwargs):
        '''
        
        '''
        return await _maybe_await(self.lock.release(*args, **kwargs))
191462
def quit(self):
        

        try:
            self.transport.signalProcess('TERM')
            d = Deferred()
            self._on_exit.append(d)

        except error.ProcessExitedAlready:
            self.transport.loseConnection()
            d = succeed(None)
        except Exception:
            d = fail()
        return d
1180582
private void goingAway(Status status) {
    lifecycleManager.notifyShutdown(status);
    final Status goAwayStatus = lifecycleManager.getShutdownStatus();
    final int lastKnownStream = connection().local().lastStreamKnownByPeer();
    try {
      connection().forEachActiveStream(new Http2StreamVisitor() {
        @Override
        public boolean visit(Http2Stream stream) throws Http2Exception {
          if (stream.id() > lastKnownStream) {
            NettyClientStream.TransportState clientStream = clientStream(stream);
            if (clientStream != null) {
              clientStream.transportReportStatus(
                  goAwayStatus, RpcProgress.REFUSED, false, new Metadata());
            }
            stream.close();
          }
          return true;
        }
      });
    } catch (Http2Exception e) {
      throw new RuntimeException(e);
    }
  }
1256436
def release(self, conn):
        """"""
        if conn.in_transaction:
            raise InvalidRequestError(
                "Cannot release a connection with "
                "not finished transaction"
            )
        raw = conn.connection
        res = yield from self._pool.release(raw)
        return res
996994
def close(self):
		
		with self.lock:
			if self.closed:
				return
			self.waitqueue.put(StopIteration)
			self.closed = True
91168
public void leavePlace (ClientObject caller)
    {
        BodyObject body = _locator.forClient(caller);
        leaveOccupiedPlace(body);
    }