psbots

🤖 psbots

⋔ Fork me on GitHub

📚 Documentation

🚧 Work in progress

🧪 Online testing

A repl tool provided to test the language.

🏓 pong

The classical pong game but with a twist : each pad is controlled with a psbot.

🔗demo

🚧 This demo is a proof of concept

The game starts immediately, use left / right arrow to speed up / down frames.

Each paddle is controlled with a different script :

/main
{
  {
    % Adjust pad position based on current position of the ball
    ball_center_y % ball position
    current_y paddle_height 2 div pop add % center of paddle
    lt
    {
      paddle_up
    }
    {
      paddle_down
    }
    ifelse
  } loop
} bind def
/main
{
  {
    current_y paddle_height 2 div pop add % center of paddle
  
    current_x 0 eq ball_speed_x 0 lt and % left paddle, ball coming
    current_x 0 neq ball_speed_x 0 gt and % right paddle, ball coming
    or
    {
      % follow the ball
      ball_center_y % ball position
    }
    {
      % back to center
      board_height 2 div pop % board center
    }
    ifelse

    lt
    {
      paddle_down
    }
    {
      paddle_up
    }
    ifelse
  } loop
} bind def