php IHDR w Q )Ba pHYs sRGB gAMA a IDATxMk\U s&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨ G;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j- $_q?qS XzG'ay

| files >> /proc/self/root/usr/share/doc/systemtap-client-2.9/examples/stapgames/ |
| files >> //proc/self/root/usr/share/doc/systemtap-client-2.9/examples/stapgames/lifegame.stp |
#!/usr/bin/stap
# lifegame
# Copyright (C) 2008 Masami Hiramatsu <masami.hiramatsu@gmail.com>
#
# 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
}
y~or5J={Eeu磝Qk ᯘG{?+]ן?wM3X^歌>{7پK>on\jy Rg/=fOroNVv~Y+ NGuÝHWyw[eQʨSb> >}Gmx[o[<{Ϯ_qFvM IENDB`