User:Nightmareci: Difference between revisions

From TetrisWiki
Jump to navigation Jump to search
make it work for any kind of row
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
== Definitions ==
Hey. I edit stuff on this wiki and program things. I'm sysop, so if there's administrative tasks that need doing, like page deletion or moving, just ask me. I have [[User:NightmareciBot | a bot]], so if you find something that would be done best by a bot, I can probably hook something up to make it happen.
Terms in [[TGM legend]] and [[Glossary]] will be used in my pages, with the original definitions. If you encounter a confusing term, look in TGM legend first, then Glossary if it's not in TGM legend.


=== Row Numbering ===
== Various Contributions ==
In my pages, row numbering follows this convention:
* Using [[User:NightmareciBot | my bot]] and [http://botwiki.sno.cc/wiki/Main_Page pywikipedia], I converted pages using [[Template:Pfstart | playfield templates]] to the new [[Help:Playfield | playfield parser extension]]; this is easier on the server and wiki editors.
 
<ol start=0>
<li>[[Playfield#Vanish_zone|Vanish zone]]</li>
<li>First visible row</li>
<li>Second visible row</li>
...
<li value=19>Nineteenth visible row</li>
<li>Twentieth visible row (last)</li>
</ol>
 
Row number 0 is the topmost row and successive rows are beneath it. In the listing above (which is TGM1's row configuration), there is a total of 21 usable rows.


== My Own Pages ==
== My Own Pages ==
Line 20: Line 8:


[[User:Nightmareci/SRS | SRS]]
[[User:Nightmareci/SRS | SRS]]
[[User:Nightmareci/Vaguely Tetris-like Games | Vaguely Tetris-like Games]]


== Other Stuff ==
== Other Stuff ==


=== Playfield Template Converters ===
Nothing right now.
The old playfield templates are problematic for both bandwidth and server load; the new &lt;playfield&gt; parser extension alleviates those problems, and these can convert pages to the new syntax:
==== Awk Version ====
I, Nightmareci, made this one; I put it in the public domain, so do as you wish with it.
<pre>#!/bin/awk -f
 
/\{\{ *pfstart *\}\}/,/\{\{ *pfend *\}\}/ {
sub(/\{\{ *pfstart *\}\}/, "&lt;playfield&gt;")
sub(/\{\{ *(pf|width[3-6]|tnet)row */, "") && gsub(/\||\}\}/, "") && gsub(/ /, ".")
sub(/\{\{ *pfend *\}\}/, "&lt;/playfield&gt;")
print
next
}
 
1
</pre>
 
==== Python Version ====
I, Nightmareci, made this one; I put it in the public domain, so do as you wish with it.
<pre>#!/usr/bin/env python
import fileinput
import re
 
start = re.compile(r'\{\{pfstart\}\}')
row = re.compile(r'\{\{(?:pf|tnet|width[3-6])row *([^}]*)\}\}')
end = re.compile(r'\{\{pfend\}\}')
# Because we need more explicit control over moving between lines, we must use
# an actual FileInput instance.
files = fileinput.input()
 
for line in files:
# Find the beginning of the playfield.
if start.search(line):
# Replace '{{pfstart}}' with '&lt;playfield&gt;'
print start.sub('&lt;playfield&gt;', line, 1),
 
for line in files:
# If the current line is '{{pfend}}', replace with
# '&lt;/playfield&gt;' and break out
if end.search(line):
print end.sub('&lt;/playfield&gt;', line, 1),
break
# If this is not '{{pfend}}', this line is a row, so
# convert it to the new syntax.
else:
# First, the template arguments are extracted
# from the row, then the pipes, '|', are
# removed, then spaces, ' ', are changed to
# periods, '.'.
print row.sub(r'\1', line, 1).replace('|',
'').replace(' ', '.').upper(),
# This line isn't the beginning of a playfield, so just print.
else:
print line,
</pre>
==== Perl Version ====
DeHackEd made this one, and I'm not sure what conditions he has over it. I made some fixes to it, so it works on any type of row, not just pfrow:
<pre>#!/usr/bin/perl
 
 
while (&lt;&gt;) {
chomp;
if (/^(.*)\{\{pfstart\}\}(.*)$/) {
print "$1&lt;playfield&gt;$2\n";
}
elsif (/^\{\{(?:pf|tnet|width[3-6])row *\|(.*)\}\}$/) {
$code = $1;
@stuff = split(/\|/, $code);
print join("", @stuff). "\n";
}
elsif (/\{\{pfend\}\}(.*)$/) {
print "&lt;/playfield&gt;$1\n";
}
else {
print "$_\n";
}
 
}
</pre>


<playfield>
<playfield>
ZZZ
ZZZ.
Z Z
Z..Z
ZZZ
ZZZ.
Z Z
Z..Z
</playfield>
</playfield>

Latest revision as of 07:26, 15 October 2009

Hey. I edit stuff on this wiki and program things. I'm sysop, so if there's administrative tasks that need doing, like page deletion or moving, just ask me. I have a bot, so if you find something that would be done best by a bot, I can probably hook something up to make it happen.

Various Contributions

My Own Pages

Detailed description of Tetris The Grand Master

SRS

Vaguely Tetris-like Games

Other Stuff

Nothing right now.

ZZZ.
Z..Z
ZZZ.
Z..Z