亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? life.sh

?? Shall高級編程
?? SH
字號:
#!/bin/bash# life.sh: "Life in the Slow Lane"# Version 2: Patched by Daniel Albers#+           to allow non-square grids as input.# ##################################################################### ## This is the Bash script version of John Conway's "Game of Life".      ## "Life" is a simple implementation of cellular automata.               ## --------------------------------------------------------------------- ## On a rectangular grid, let each "cell" be either "living" or "dead".  ## Designate a living cell with a dot, and a dead one with a blank space.##  Begin with an arbitrarily drawn dot-and-blank grid,                  ##+ and let this be the starting generation, "generation 0".             ## Determine each successive generation by the following rules:          ## 1) Each cell has 8 neighbors, the adjoining cells                     ##+   left, right, top, bottom, and the 4 diagonals.                     ##                       123                                             ##                       4*5                                             ##                       678                                             ##                                                                       ## 2) A living cell with either 2 or 3 living neighbors remains alive.   ## 3) A dead cell with 3 living neighbors becomes alive (a "birth").     #SURVIVE=2                                                               #BIRTH=3                                                                 ## 4) All other cases result in a dead cell for the next generation.     ## ##################################################################### #startfile=gen0   # Read the starting generation from the file "gen0".                 # Default, if no other file specified when invoking script.                 #if [ -n "$1" ]   # Specify another "generation 0" file.then    startfile="$1"fi  #############################################  Abort script if "startfile" not specified#+ AND#+ "gen0" not present.E_NOSTARTFILE=68if [ ! -e "$startfile" ]then  echo "Startfile \""$startfile"\" missing!"  exit $E_NOSTARTFILEfi############################################ALIVE1=.DEAD1=_                 # Represent living and "dead" cells in the start-up file.#  ---------------------------------------------------------- ##  This script uses a 10 x 10 grid (may be increased,#+ but a large grid will will cause very slow execution).ROWS=10COLS=10#  Change above two variables to match grid size, if necessary.#  ---------------------------------------------------------- #GENERATIONS=10          #  How many generations to cycle through.                        #  Adjust this upwards,                        #+ if you have time on your hands.NONE_ALIVE=80           #  Exit status on premature bailout,                        #+ if no cells left alive.TRUE=0FALSE=1ALIVE=0DEAD=1avar=                   # Global; holds current generation.generation=0            # Initialize generation count.# =================================================================let "cells = $ROWS * $COLS"                        # How many cells.declare -a initial      # Arrays containing "cells".declare -a currentdisplay (){alive=0                 # How many cells "alive" at any given time.                        # Initially zero.declare -a arrarr=( `echo "$1"` )     # Convert passed arg to array.element_count=${#arr[*]}local ilocal rowcheckfor ((i=0; i<$element_count; i++))do  # Insert newline at end of each row.  let "rowcheck = $i % COLS"  if [ "$rowcheck" -eq 0 ]  then    echo                # Newline.    echo -n "      "    # Indent.  fi    cell=${arr[i]}  if [ "$cell" = . ]  then    let "alive += 1"  fi    echo -n "$cell" | sed -e 's/_/ /g'  # Print out array and change underscores to spaces.done  return}IsValid ()                            # Test whether cell coordinate valid.{  if [ -z "$1"  -o -z "$2" ]          # Mandatory arguments missing?  then    return $FALSE  filocal rowlocal lower_limit=0                   # Disallow negative coordinate.local upper_limitlocal leftlocal rightlet "upper_limit = $ROWS * $COLS - 1" # Total number of cells.if [ "$1" -lt "$lower_limit" -o "$1" -gt "$upper_limit" ]then  return $FALSE                       # Out of array bounds.fi  row=$2let "left = $row * $COLS"             # Left limit.let "right = $left + $COLS - 1"       # Right limit.if [ "$1" -lt "$left" -o "$1" -gt "$right" ]then  return $FALSE                       # Beyond row boundary.fi  return $TRUE                          # Valid coordinate.}  IsAlive ()              # Test whether cell is alive.                        # Takes array, cell number, state of cell as arguments.{  GetCount "$1" $2      # Get alive cell count in neighborhood.  local nhbd=$?  if [ "$nhbd" -eq "$BIRTH" ]  # Alive in any case.  then    return $ALIVE  fi  if [ "$3" = "." -a "$nhbd" -eq "$SURVIVE" ]  then                  # Alive only if previously alive.    return $ALIVE  fi    return $DEAD          # Default.}  GetCount ()             # Count live cells in passed cell's neighborhood.                        # Two arguments needed:			# $1) variable holding array			# $2) cell number{  local cell_number=$2  local array  local top  local center  local bottom  local r  local row  local i  local t_top  local t_cen  local t_bot  local count=0  local ROW_NHBD=3  array=( `echo "$1"` )  let "top = $cell_number - $COLS - 1"    # Set up cell neighborhood.  let "center = $cell_number - 1"  let "bottom = $cell_number + $COLS - 1"  let "r = $cell_number / $COLS"  for ((i=0; i<$ROW_NHBD; i++))           # Traverse from left to right.   do    let "t_top = $top + $i"    let "t_cen = $center + $i"    let "t_bot = $bottom + $i"    let "row = $r"                        # Count center row of neighborhood.    IsValid $t_cen $row                   # Valid cell position?    if [ $? -eq "$TRUE" ]    then      if [ ${array[$t_cen]} = "$ALIVE1" ] # Is it alive?      then                                # Yes?        let "count += 1"                  # Increment count.      fi	    fi      let "row = $r - 1"                    # Count top row.              IsValid $t_top $row    if [ $? -eq "$TRUE" ]    then      if [ ${array[$t_top]} = "$ALIVE1" ]       then        let "count += 1"      fi	    fi      let "row = $r + 1"                    # Count bottom row.    IsValid $t_bot $row    if [ $? -eq "$TRUE" ]    then      if [ ${array[$t_bot]} = "$ALIVE1" ]       then        let "count += 1"      fi	    fi    done    if [ ${array[$cell_number]} = "$ALIVE1" ]  then    let "count -= 1"        #  Make sure value of tested cell itself  fi                        #+ is not counted.  return $count  }next_gen ()               # Update generation array.{local arraylocal i=0array=( `echo "$1"` )     # Convert passed arg to array.while [ "$i" -lt "$cells" ]do  IsAlive "$1" $i ${array[$i]}   # Is cell alive?  if [ $? -eq "$ALIVE" ]  then                           #  If alive, then    array[$i]=.                  #+ represent the cell as a period.  else      array[$i]="_"                #  Otherwise underscore   fi                            #+ (which will later be converted to space).    let "i += 1" done   # let "generation += 1"   # Increment generation count.# Why was the above line commented out?# Set variable to pass as parameter to "display" function.avar=`echo ${array[@]}`   # Convert array back to string variable.display "$avar"           # Display it.echo; echoecho "Generation $generation  -  $alive alive"if [ "$alive" -eq 0 ]then  echo  echo "Premature exit: no more cells alive!"  exit $NONE_ALIVE        #  No point in continuingfi                        #+ if no live cells.}# =========================================================# main ()# Load initial array with contents of startup file.initial=( `cat "$startfile" | sed -e '/#/d' | tr -d '\n' |\sed -e 's/\./\. /g' -e 's/_/_ /g'` )# Delete lines containing '#' comment character.# Remove linefeeds and insert space between elements.clear          # Clear screen.echo #         Titleecho "======================="echo "    $GENERATIONS generations"echo "           of"echo "\"Life in the Slow Lane\""echo "======================="# -------- Display first generation. --------Gen0=`echo ${initial[@]}`display "$Gen0"           # Display only.echo; echoecho "Generation $generation  -  $alive alive"# -------------------------------------------let "generation += 1"     # Increment generation count.echo# ------- Display second generation. -------Cur=`echo ${initial[@]}`next_gen "$Cur"          # Update & display.# ------------------------------------------let "generation += 1"     # Increment generation count.# ------ Main loop for displaying subsequent generations ------while [ "$generation" -le "$GENERATIONS" ]do  Cur="$avar"  next_gen "$Cur"  let "generation += 1"done# ==============================================================echoexit 0   # END# The grid in this script has a "boundary problem."# The the top, bottom, and sides border on a void of dead cells.# Exercise: Change the script to have the grid wrap around,# +         so that the left and right sides will "touch,"      # +         as will the top and bottom.## Exercise: Create a new "gen0" file to seed this script.#           Use a 12 x 16 grid, instead of the original 10 x 10 one.#           Make the necessary changes to the script,#+          so it will run with the altered file.## Exercise: Modify this script so that it can determine the grid size#+          from the "gen0" file, and set any variables necessary#+          for the script to run.#           This would make unnecessary any changes to variables#+          in the script for an altered grid size.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品天干天干在线综合| 在线一区二区视频| 久久亚洲精华国产精华液| 免费在线观看一区| 久久综合九色综合欧美就去吻 | 久久久久国产精品麻豆| 精彩视频一区二区三区| 久久亚洲综合av| 不卡一区二区在线| 亚洲男人的天堂在线aⅴ视频| 在线亚洲欧美专区二区| 日韩精品亚洲一区二区三区免费| 在线播放91灌醉迷j高跟美女 | 日本视频免费一区| 亚洲精品一区二区三区精华液| 国产精品白丝av| 中文字幕一区在线| 欧美丰满美乳xxx高潮www| 精品无码三级在线观看视频| 国产精品理伦片| 欧美日本一道本在线视频| 久久99国产精品久久99果冻传媒| 久久久久久久久久久电影| 91蝌蚪国产九色| 亚洲国产欧美一区二区三区丁香婷| 日韩欧美国产综合在线一区二区三区| 国产精品91xxx| 伊人性伊人情综合网| 欧美一区二区三级| jizz一区二区| 蜜臀精品一区二区三区在线观看| 亚洲国产岛国毛片在线| 欧美日本在线视频| 波多野结衣在线aⅴ中文字幕不卡| 亚洲午夜精品一区二区三区他趣| 精品少妇一区二区三区日产乱码 | 亚洲一区二区视频| 久久精品网站免费观看| 色婷婷亚洲一区二区三区| 久久精品久久综合| 亚洲蜜桃精久久久久久久| 日韩精品一区二区三区swag| zzijzzij亚洲日本少妇熟睡| 另类小说综合欧美亚洲| 亚洲激情五月婷婷| 国产日韩精品视频一区| 欧美福利电影网| 91蝌蚪porny成人天涯| 国内精品久久久久影院薰衣草 | 亚洲三级电影网站| 精品成人一区二区三区四区| 色菇凉天天综合网| 国产高清久久久久| 奇米精品一区二区三区在线观看一| 中文字幕在线不卡国产视频| 精品动漫一区二区三区在线观看| 一本色道亚洲精品aⅴ| 国产成人在线视频网址| 久草热8精品视频在线观看| 亚洲制服欧美中文字幕中文字幕| 中文幕一区二区三区久久蜜桃| 在线电影一区二区三区| 99re视频这里只有精品| 国产超碰在线一区| 韩国欧美国产1区| 日本aⅴ免费视频一区二区三区| 亚洲图片另类小说| 国产精品久久久久久久久免费桃花 | 一区二区三区免费观看| 国产精品麻豆久久久| 久久久久亚洲综合| 欧美一区二区三区四区高清| 欧美丰满少妇xxxbbb| 欧美午夜精品一区| 欧洲精品在线观看| 日本韩国一区二区三区| 91在线免费看| 99久久久久久| 99国产精品久| 91片黄在线观看| 91在线一区二区三区| 97se亚洲国产综合自在线观| 91视频在线观看| 91在线观看视频| 色一情一伦一子一伦一区| av一区二区不卡| 91老司机福利 在线| 欧美午夜精品久久久久久超碰| 在线欧美一区二区| 欧美日韩1234| 精品国产人成亚洲区| 欧美精品一区二区在线观看| 久久久久国产精品麻豆ai换脸 | 麻豆专区一区二区三区四区五区| 美女被吸乳得到大胸91| 精品一区二区三区不卡| 国产成人av资源| 91麻豆蜜桃一区二区三区| 欧美亚洲一区三区| 欧美一区日韩一区| 久久婷婷国产综合国色天香| 国产精品入口麻豆原神| 亚洲综合久久av| 日本午夜精品视频在线观看 | 亚洲午夜私人影院| 日本不卡中文字幕| 国产成人在线看| 91高清视频在线| 欧美成人性福生活免费看| 国产色产综合色产在线视频| 亚洲欧洲精品成人久久奇米网| 亚洲一区二区综合| 精品伊人久久久久7777人| 粉嫩一区二区三区性色av| 在线国产电影不卡| 欧美α欧美αv大片| 综合激情网...| 日韩av在线发布| av资源站一区| 日韩一级黄色大片| 亚洲色图丝袜美腿| 美腿丝袜在线亚洲一区| 不卡的av电影在线观看| 欧美日本视频在线| 亚洲欧洲另类国产综合| 久久国产福利国产秒拍| 97se亚洲国产综合自在线| 欧美大肚乱孕交hd孕妇| 亚洲精品写真福利| 国产精品一区免费视频| 91久久精品一区二区三| 国产婷婷色一区二区三区在线| 亚洲一区二区三区中文字幕| 国产一区二区导航在线播放| 欧美日韩久久不卡| 最新成人av在线| 精品一区二区三区免费毛片爱| 欧美性大战xxxxx久久久| 日本一区二区三区四区在线视频| 日韩高清一区在线| 91在线porny国产在线看| 精品国产精品网麻豆系列| 亚洲国产综合色| www.欧美.com| wwwwww.欧美系列| 肉丝袜脚交视频一区二区| 97se亚洲国产综合自在线观| 国产欧美一区二区精品忘忧草 | 成人高清伦理免费影院在线观看| 日韩一级精品视频在线观看| 午夜精品久久久久久久99樱桃| 不卡影院免费观看| 日本一区二区视频在线| 国产一区二区不卡| 精品国产91乱码一区二区三区| 三级精品在线观看| 欧美日韩精品系列| 夜夜精品视频一区二区| 91蜜桃免费观看视频| 国产日韩欧美精品电影三级在线 | 国产风韵犹存在线视精品| 日韩欧美国产小视频| 日本中文字幕一区二区有限公司| 欧美三级日韩在线| 亚洲成a人v欧美综合天堂| 欧美影院午夜播放| 亚洲国产精品一区二区www在线| 91电影在线观看| 一区二区三区精品久久久| 色噜噜偷拍精品综合在线| 亚洲欧美激情在线| 色综合久久88色综合天天免费| 中文字幕一区免费在线观看| www.亚洲国产| 自拍偷拍国产亚洲| 91国产成人在线| 午夜一区二区三区视频| 欧美一区二区三区视频在线| 蜜臀av一级做a爰片久久| 日韩午夜激情免费电影| 激情综合色丁香一区二区| 精品国产麻豆免费人成网站| 国产精品一区二区91| 欧美激情一区二区三区四区| 99久久久久久| 一区二区视频免费在线观看| 欧美日韩亚洲综合一区二区三区| 婷婷久久综合九色综合绿巨人 | 在线观看区一区二| 视频一区二区三区中文字幕| 日韩一级完整毛片| 国产成人精品免费在线| 中文字幕一区二区5566日韩| 色999日韩国产欧美一区二区| 午夜精品福利视频网站| 精品国产伦一区二区三区免费| 国产白丝网站精品污在线入口| 亚洲男人电影天堂| 欧美一区二区三区四区在线观看| 国产一区啦啦啦在线观看|