Talk:One-dimensional cellular automata: Difference between revisions

Content added Content deleted
(add quick pre tags.)
No edit summary
Line 2: Line 2:
<pre>
<pre>
#!/usr/local/bin/gawk -f
#!/usr/local/bin/gawk -f

# FONCTIONS DEFINIES PAR UTILISATEUR
# User defined functions
function ASCII_to_Binary(str_) {
function ASCII_to_Binary(str_) {
gsub("_","0",str_); gsub("@","1",str_)
gsub("_","0",str_); gsub("@","1",str_)
Line 20: Line 21:
return d == 1 ? 1 : 0
return d == 1 ? 1 : 0
}
}

# POUR CHAQUE LIGNE DU FICHIER EN ENTREE FAIRE
# For each line in input do
{
{
str_=$0
str_=$0
Line 39: Line 41:
} while (str_ != str_previous)
} while (str_ != str_previous)
}
}
</pre>
# ACTIONS POST TRAITEMENT

END {
Then :
}</pre>
$ echo ".@@@.@@.@.@.@.@..@.." | awk -f automata.awk
0: .@@@.@@.@.@.@.@..@..
1: _@_@@@@@_@_@_@______
2: __@@___@@_@_@_______
3: __@@___@@@_@________
4: __@@___@_@@_________
5: __@@____@@@_________
6: __@@____@_@_________
7: __@@_____@__________
8: __@@________________
9: __@@________________

--[[User:Poulteki|Poulteki]]

:Please sign your posts and try and fix formatting issues, thanks. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 18:41, 17 January 2015 (UTC)
:Please sign your posts and try and fix formatting issues, thanks. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 18:41, 17 January 2015 (UTC)