Restarts the board and the game vars
162842
public function initGame()
    {
        $this->board = array();
        $this->last_player = null;

        for ($x=0; $x<$this->size; $x++) {
            $row = array();

            for ($y=0; $y<$this->size; $y++) {
                $row[] = null;
            }

            $this->board[] = $row;
        }

        $this->display();
    }
425982
public void restart() {
        for (InputVariable inputVariable : this.inputVariables) {
            inputVariable.setValue(Double.NaN);
        }
        for (OutputVariable outputVariable : this.outputVariables) {
            outputVariable.clear();
        }
    }
1162041
def gameloop(self):
        
        try:
            while True:
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        sys.exit()
                    if event.type == pygame.KEYDOWN:
                        if event.key == pygame.K_ESCAPE:
                            pygame.event.post(pygame.event.Event(pygame.QUIT))

                self.recv_data()
                self.update()
                self.render()
        except KeyboardInterrupt:
            pass
915741
def run(self):
        """"""
        self.ms_game.tcp_accept()

        while True:
            data = self.ms_game.tcp_receive()

            if data == "help\n":
                self.ms_game.tcp_help()
                self.ms_game.tcp_send("> ")
            elif data == "exit\n":
                self.ms_game.tcp_close()
            elif data == "print\n":
                self.ms_game.tcp_send(self.ms_game.get_board())
                self.ms_game.tcp_send("> ")
            elif data == "":
                self.ms_game.tcp_send("> ")
            else:
                self.transfer.emit(data)
                self.ms_game.tcp_send("> ")

            if self.ms_game.game_status == 1:
                self.ms_game.tcp_send("[MESSAGE] YOU WIN!\n")
                self.ms_game.tcp_close()
            elif self.ms_game.game_status == 0:
                self.ms_game.tcp_send("[MESSAGE] YOU LOSE!\n")
                self.ms_game.tcp_close()
1071760
public void restart() {
        lock.writeLock().lock();
        try {
            if (this.timeoutTask == null) {
                throw new IllegalStateException(Tr.formatMessage(tc, "internal.error.CWMFT4999E"));
            }
            stop();
            this.stopped = false;
            start(this.timeoutTask);
        } finally {
            lock.writeLock().unlock();
        }
    }
1055574
public void restartGesture() {
    if (!mGestureInProgress) {
      return;
    }
    stopGesture();
    for (int i = 0; i < MAX_POINTERS; i++) {
      mStartX[i] = mCurrentX[i];
      mStartY[i] = mCurrentY[i];
    }
    startGesture();
  }
480663
def random_start_board(cls):
        """"""
        board = cls()
        board._random_fill()
        destructions = True  # prime the loop
        while destructions:
            board, destructions = board.execute_once()
            board._random_fill()
        return board
572983
public void restart(final String dev_name) throws DevFailed {
        Util.out4.println("In DServer.restart(" + dev_name + ") method");
        //
        // Check if the wanted device exists in each class
        //

        final Util tg = Util.instance();
        Vector dev_list = tg.get_device_list_by_class(((DeviceClass) class_list.elementAt(0))
                .get_name());
        final int nb_class = class_list.size();
        int i, j, nb_dev;
        DeviceImpl dev_to_del = null;
        DeviceClass dev_cl = null;

        j = 0;
        for (i = 0; i < nb_class; i++) {
            dev_list = tg.get_device_list_by_class(((DeviceClass) class_list.elementAt(i))
                    .get_name());
            nb_dev = dev_list.size();
            for (j = 0; j < nb_dev; j++) {
                if (((DeviceImpl) dev_list.elementAt(j)).get_name().equals(dev_name) == true) {
                    // Get device & class reference
                    dev_to_del = (DeviceImpl) dev_list.elementAt(j);
                    dev_cl = (DeviceClass) class_list.elementAt(i);
                    break;
                }
            }
            if (dev_to_del != null && dev_cl != null) {
                break;
            }
        }

        //
        // Throw exception if the device is not found
        //

        if (dev_to_del == null || dev_cl == null) // Have been found
        {
            final StringBuffer o = new StringBuffer("Device ");
            o.append(dev_name);
            o.append(" not found");

            Except.throw_exception("API_DeviceNotFound", new String(o), "Dserver.restart()");
        }

        //
        // Remove ourself from device list
        //

        dev_list.removeElementAt(j);

        // Store polling conditions if any
        assert dev_to_del != null;
        final Vector p_obj = dev_to_del.get_poll_obj_list(); // PollObj
        final Vector dev_pol = new Vector(); // Pol

        for (i = 0; i < p_obj.size(); i++) {
            dev_pol.add(p_obj.elementAt(i));
        }
        if (dev_pol.size() > 0) {
            stop_polling();
        }

        // Delete the device (deactivate it and remove it)
        final POA r_poa = tg.get_poa();
        if (dev_to_del.get_exported_flag() == true) {
            try {
                r_poa.deactivate_object(dev_to_del.get_obj_id());
            } catch (final WrongPolicy ex) {
            } catch (final ObjectNotActive ex) {
            }
        }

        // Re-create device
        final String[] dev_name_list = new String[1];
        dev_name_list[0] = dev_name;
        assert dev_cl != null;
        dev_cl.device_factory(dev_name_list);

        // Re-start device polling (if any)
        final DevVarLongStringArray send = new DevVarLongStringArray();
        send.lvalue = new int[1];
        send.svalue = new String[3];

        for (i = 0; i < dev_pol.size(); i++) {
            final PollObj poll_obj = (PollObj) dev_pol.elementAt(i);
            // Send command to the polling thread
            send.lvalue[0] = poll_obj.get_upd_i();
            send.svalue[0] = poll_obj.get_name();
            if (poll_obj.type == Tango_POLL_CMD) {
                send.svalue[1] = "command";
            } else {
                send.svalue[1] = "attribute";
            }
            send.svalue[2] = poll_obj.name;

            try {
                add_obj_polling(send, false);
            } catch (final DevFailed e) {
                if (Util._tracelevel >= 4) {
                    Except.print_exception(e);
                }
            }
        }
    }
818048
function restartRelay(cb) {
        var self = this;
        this.stop(function (err) {
            if (err) {
                return cb(err);
            }
            self.start(cb);
        });
    }
634787
def gameloop(self):
        
        try:
            while True:
                self.handle_events()
                self.update()
                self.render()
        except KeyboardInterrupt:
            pass
884134
public void reset()
    {
        for (final Tile tile : revealed)
        {
            final Tile reset = new TileGame(tile.getSheet(),
                                            FOG,
                                            tile.getX(),
                                            tile.getY(),
                                            tile.getWidth(),
                                            tile.getHeight());
            map.setTile(reset);
        }
        revealed.clear();
    }
796763
public void reset() {
        if (debug) LogD("Count reset");
        editor.putInt(KEY_COUNT, 0);
        editor.putBoolean(KEY_CLICKED, false);
        editor.putLong(KEY_LAST_CRASH, 0L);
        commitEditor();
    }
671893
def restart_minecraft(world_state, agent_host, client_info, message):
    """""""
    if world_state.is_mission_running:
        agent_host.sendCommand("quit")
        time.sleep(10)
    agent_host.killClient(client_info)
    raise MissionTimeoutException(message)
315495
def _restart():
    ''''''
    if _restart_cb:
        # https://github.com/formwork-io/lazarus/issues/2
        if _restart_cb() is not None:
            # restart cancelled
            return True

    def down_watchdog():
        _observer.stop()
        _observer.join()

        if _close_fds:
            # close all fds...
            _util.close_fds()

        # declare a mulligan ;)
        if _restart_func:
            _restart_func()
            _deactivate()
        else:
            _util.do_over()

    _util.defer(down_watchdog)
    return False
658448
def reset(self):
        '''
        
        '''
        self.initializeSim()
        self.aLvlNow = self.kInit*np.ones(self.AgentCount) # Start simulation near SS
        self.aNrmNow = self.aLvlNow/self.pLvlNow
214222
function onTick()
	{
		$this->tick++;

		switch ($this->state)
		{
			case self::OVER:
			case self::SLEEPING:
				break;

			case self::WAITING:
			case self::DECIDING:
			case self::PLAYING:
				break;

			case self::PLAYER_LEFT:
			case self::WAITING_BACKUPS:
				break;
		}
		if(new \DateTime() < $this->nextTick) return;

		switch($this->state)
		{
			case self::SLEEPING:
				//Waiting for a match in database
				$match = $this->matchMakingService->getServerCurrentMatch($this->storage->serverLogin, $this->scriptName, $this->titleIdString);
				if ($match)
				{
					$this->prepare($match);
				}
				else
				{
					$this->sleep();
				}
				break;
			case self::WAITING:
				//Waiting for players, if Match change or cancel, change state and wait
				$this->waitingTime += 5;
				\ManiaLive\Utilities\Logger::debug(sprintf('waiting time %d',$this->waitingTime));
				$match = $this->matchMakingService->getServerCurrentMatch($this->storage->serverLogin, $this->scriptName, $this->titleIdString);
				if($this->waitingTime > static::TIME_WAITING_CONNECTION)
				{
					\ManiaLive\Utilities\Logger::debug('Waiting time over');
					foreach($this->players as $login => $state)
					{
						if($state == Services\PlayerInfo::PLAYER_STATE_NOT_CONNECTED)
						{
							$this->updateMatchPlayerState($login,Services\PlayerInfo::PLAYER_STATE_QUITTER);
						}
					}
					$this->waitBackups();
					break;
				}
				if($match === false)
				{
					\ManiaLive\Utilities\Logger::debug('Match was prepared but not in database anymore (canceled on lobby ?');
					$this->cancel(false);
					break;
				}
				if($this->match->isDifferent($match))
				{
					$this->prepare($match);
					break;
				}
				$this->changeState(self::WAITING);
				break;
			case self::DECIDING:
				\ManiaLive\Utilities\Logger::debug('tick: DECIDING');
				$this->play();
				break;
			case static::PLAYING:
				$this->changeState(static::PLAYING);
				break;
			case self::PLAYER_LEFT:
				\ManiaLive\Utilities\Logger::debug('tick: PLAYER_LEFT');
				$this->waitBackups();
				break;
			case self::WAITING_BACKUPS:
				switch($this->config->waitingForBackups)
				{
					case 0:
						$isWaitingTimeOver = true;
						break;
					case 2:
						$isWaitingTimeOver = false;
						break;
					case 1:
						//nobreak
					default:
						$isWaitingTimeOver = (++$this->waitingBackupTime > static::TIME_WAITING_BACKUP);
						break;
				}
				if($isWaitingTimeOver)
				{
					\ManiaLive\Utilities\Logger::debug('tick: WAITING_BACKUPS over');
					$this->cancel();
				}
				else
				{
					$match = $this->matchMakingService->getServerCurrentMatch($this->storage->serverLogin, $this->scriptName, $this->titleIdString);
					if($match && $this->match->isDifferent($match))
					{
						$this->updatePlayerList($match);
					}
					$this->changeState(self::WAITING_BACKUPS);
				}
				break;
			case self::OVER:
				\ManiaLive\Utilities\Logger::debug('tick: OVER');
				$this->end();
		}
	}
965767
function() {
        // Compute the amount of play left to go
        t.playLeft = t.playEnd - Date.now();

        // Done playing
        if (t.playLeft <= 0) {
          clearInterval(t.timer);
          t.next();
        }

        // Set the progress bar width
        t.setProgress();
      }