Battlemachy Jade Bandit 飛龍騎士

Battlemachy Jade Bandit 飛龍騎士

軟體:Battlemachy Jade Bandit(版本:N/A)
類別:射擊遊戲
性質:Freeware()

【編輯/宗文】

這是一款射擊遊戲,玩家將操控女主角來與眾多敵人對抗。遊戲中玩家會發現有各種顏色類似軌道的各種形狀圖示,這些將是限制我方或者敵人的移動範圍,也就是說只能在其規劃的路線上移動(有時是直線,有時為圓圈,又有時為半圓弧狀。),而不是整個畫面中都能自由移動。遊戲中每一關遊戲前後都會有劇情說明,以及過關的任務或目的,讓玩家能瞭解劇情,更有遊戲的參與感。

遊戲過關後,會出現一個武器變更以及能力升級的畫面,在此玩家可以變更女主角使用的武器(一共有四種不同的武器供玩家來選擇。),或者利用戰鬥中所賺得的金錢用來升級能力。如果有足夠的金錢,便能夠讓這四種不同的能力獲得升級,如此才能應付愈來愈難纏的眾多敵人。敵人的數量以及射擊武器的數量非常龐大,因此玩家必須適時來躲避,以免被射成蜂窩。

遊戲操控方面,利用滑鼠移動來操控女主角,按滑鼠左鍵可以進行射擊。如果先按住滑鼠左鍵不動,再移動滑鼠可以用來瞄準目標。

下載:http://www.arcadetown.com/battlemachyjadebandit/gameonline.asp

EclipseCrossword填字遊戲-打發時間的好幫手!

EclipseCrossword填字遊戲-打發時間的好幫手!

軟體:EclipseCrossword(版本:1.2.54)
類別:益智遊戲
性質:Freeware(360 K)

【編輯/lillian】

EclipseCrossword是一套免費的填字遊戲產生軟體,但是功能卻一點也不陽春喔!精簡的安裝過程與操作介面,只要輸入你的字串、選擇字格數,就可以自動幫你產生好一個完美的填字遊戲。

更棒的是,他還支援輸出成互動網頁喔!經由原公司提供的Java applet與scripting,你就可以輕易的與網頁結合。讓你的網站更豐富與多元。此外,EclipseCrossword也很適合提供編輯人員使用,豐富的排版樣式也省去編輯人員不少時間。

年假不知道該去哪玩嗎?找個三五好友,各自設計一個填字遊戲互相挑戰吧!

下載:

Perl Regular Expression Tutorial

Perl Regular Expression Tutorial

 






Contents



  1. Overview
  2. Simple Regular Expressions
  3. Metacharacters
  4. Forbidden Characters
  5. Things To Remember







Overview



Simple Regular Expressions


In its simplest form, a regular expression is just a word or phrase to search for. For example,
  gauss

would match any subject with the string “gauss” in it, or which mentioned the word “gauss” in the subject line. Thus, subjects with “gauss”, “gaussian” or “degauss” would all be matched, as would a subject containing the phrases “de-gauss the monitor” or “gaussian elimination.” Here are some more examples:
  carbon


Finds any subject with the string “carbon” in its name, or which mentions carbon (or carbonization or hydrocarbons or carbon-based life forms) in the subject line.
  hydro


Finds any subject with the string “hydro” in its name or contents. Subjects with “hydro”, “hydrogen” or “hydrodynamics” are found, as well as subjects containing the words “hydroplane” or “hydroelectric”.
  oxy


Finds any subject with the string “oxy” in the subject line. This could be used to find subjects on oxygen, boxy houses or oxymorons.
  top ten


Note that spaces may be part of the regular expression. The above expression could be used to find top ten lists. (Note that they would also find articles on how to stop tension.)


Metacharacters


Some characters have a special meaning to the searcher. These characters are called metacharacters. Although they may seem confusing at first, they add a great deal of flexibility and convenience to the searcher.

The period (.) is a commonly used metacharacter. It matches exactly one character, regardless of what the character is. For example, the regular expression:

  2,.-Dimethylbutane

will match “2,2-Dimethylbutane” and “2,3-Dimethylbutane”. Note that the period matches exactly one character– it will not match a string of characters, nor will it match the null string. Thus, “2,200-Dimethylbutane” and “2,-Dimenthylbutane” will not be matched by the above regular expression.

But what if you wanted to search for a string containing a period? For example, suppose we wished to search for references to pi. The following regular expression would not work:

  3.14     (THIS IS WRONG!)

This would indeed match “3.14”, but it would also match “3514”, “3f14”, or even “3+14”. In short, any string of the form “3×14”, where x is any character, would be matched by the regular expression above.

To get around this, we introduce a second metacharacter, the backslash (\). The backslash can be used to indicate that the character immediately to its right is to be taken literally. Thus, to search for the string “3.14”, we would use:

  3\.14    (This will work.)

This is called “quoting”. We would say that the period in the regular expression above has been quoted. In general, whenever the backslash is placed before a metacharacter, the searcher treats the metacharacter literally rather than invoking its special meaning.

(Unfortunately, the backslash is used for other things besides quoting metacharacters. Many “normal” characters take on special meanings when preceded by a backslash. The rule of thumb is, quoting a metacharacter turns it into a normal character, and quoting a normal character may turn it into a metacharacter.)

Let’s look at some more common metacharacters. We consider first the question mark (?). The question mark indicates that the character immediately preceding it either zero times or one time. Thus

  m?ethane

would match either “ethane” or “methane”. Similarly,
  comm?a

would match either “coma” or “comma”.

Another metacharacter is the star (*). This indicates that the character immediately to its left may be repeated any number of times, including zero. Thus

  ab*c

would match “ac”, “abc”, “abbc”, “abbbc”, “abbbbbbbbc”, and any string that starts with an “a”, is followed by a sequence of “b”‘s, and ends with a “c”.

The plus (+) metacharacter indicates that the character immediately preceding it may be repeated one or more times. It is just like the star metacharacter, except it doesn’t match the null string. Thus

  ab+c

would not match “ac”, but it would match “abc”, “abbc”, “abbbc”, “abbbbbbbbc” and so on.

Metacharacters may be combined. A common combination includes the period and star metacharacters, with the star immediately following the period. This is used to match an arbitrary string of any length, including the null string. For example:

  cyclo.*ane

would match “cyclodecane”, “cyclohexane” and even “cyclones drive me insane.” Any string that starts with “cyclo”, is followed by an arbitrary string, and ends with “ane” will be matched. Note that the null string will be matched by the period-star pair; thus, “cycloane” would be matche by the above expression.

If you wanted to search for articles on cyclodecane and cyclohexane, but didn’t want to match articles about how cyclones drive one insane, you could string together three periods, as follows:

  cyclo…ane

This would match “cyclodecane” and “cyclohexane”, but would not match “cyclones drive me insane.” Only strings eleven characters long which start with “cyclo” and end with “ane” will be matched. (Note that “cyclopentane” would not be matched, however, since cyclopentane has twelve characters, not eleven.)

Here are some more examples. These involve the backslash. Note that the placement of backslash is important.

  a\.*z


Matches any string starting with “a”, followed by a series of periods (including the “series” of length zero), and terminated by “z”. Thus, “az”, “a.z”, “a..z”, “a…z” and so forth are all matched.
  a.\*z


(Note that the backslash and period are reversed in this regular expression.)

Matches any string starting with an “a”, followed by one arbitrary character, and terminated with “*z”. Thus, “ag*z”, “a5*z” and “a@*z” are all matched. Only strings of length four, where the first character is “a”, the third “*”, and the fourth “z”, are matched.

  a\++z


Matches any string starting with “a”, followed by a series of plus signs, and terminated by “z”. There must be at least one plus sign between the “a” and the “z”. Thus, “az” is not matched, but “a+z”, “a++z”, “a+++z”, etc. will be matched.
  a\+\+z


Matches only the string “a++z”.
  a+\+z


Matches any string starting with a series of “a”‘s, followed by a single plus sign and ending with a “z”. There must be at least one “a” at the start of the string. Thus “a+z”, “aa+z”, “aaa+z” and so on will match, but “+z” will not.
  a.?e


Matches “ace”, “ale”, “axe” and any other three-character string beginning with “a” and ending with “e”; will also match “ae”.
  a\.?e


Matches “ae” and “a.e”. No other string is matched.
  a.\?e


Matches any four-character string starting with “a” and ending with “?e”. Thus, “ad?e”, “a1?e” and “a%?e” will all be matched.
  a\.\?e


Matches only “a.?e” and nothing else.

Earlier it was mentioned that the backslash can turn ordinary characters into metacharacters, as well as the other way around. One such use of this is the digit metacharacter, which is invoked by following a backslash with a lower-case “d”, like this: “\d“. The “d” must be lower case, for reasons explained later. The digit metacharacter matches exactly one digit; that is, exactly one occurence of “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8” or “9”. For example, the regular expression:
  2,\d-Dimethylbutane

would match “2,2-Dimethylbutane”, “2,3-Dimethylbutane” and so forth. Similarly,
  1\.\d\d\d\d\d

would match any six-digit floating-point number from 1.00000 to 1.99999 inclusive. We could combine the digit metacharacter with other metacharacters; for instance,
  a\d+z

matches any string starting with “a”, followed by a string of numbers, followed by a “z”. (Note that the plus is used, and thus “az” is not matched.)

The letter “d” in the string “\d” must be lower-case. This is because there is another metacharacter, the non-digit metacharacter, which uses the uppercase “D”. The non-digit metacharacter looks like “\D” and matches any character except a digit. Thus,

  a\Dz

would match “abz”, “aTz” or “a%z”, but would not match “a2z”, “a5z” or “a9z”. Similarly,
  \D+

Matches any non-null string which contains no numeric characters.

Notice that in changing the “d” from lower-case to upper-case, we have reversed the meaning of the digit metacharacter. This holds true for most other metacharacters of the format backslash-letter.

There are three other metacharacters in the backslash-letter format. The first is the word metacharacter, which matches exactly one letter, one number, or the underscore character (_). It is written as “\w“. It’s opposite, “\W“, matches any one character except a letter, a number or the underscore. Thus,

  a\wz

would match “abz”, “aTz”, “a5z”, “a_z”, or any three-character string starting with “a”, ending with “z”, and whose second character was either a letter (upper- or lower-case), a number, or the underscore. Similarly,
  a\Wz

would not match “abz”, “aTz”, “a5z”, or “a_z”. It would match “a%z”, “a{z”, “a?z” or any three-character string starting with “a” and ending with “z” and whose second character was not a letter, number, or underscore. (This means the second character must either be a symbol or a whitespace character.)

The whitespace metacharacter matches exactly one character of whitespace. (Whitespace is defined as spaces, tabs, newlines, or any character which would not use ink if printed on a printer.) The whitespace metacharacter looks like this: “\s“. It’s opposite, which matches any character that is not whitespace, looks like this: “\S“. Thus,

  a\sz

would match any three-character string starting with “a” and ending with “z” and whose second character was a space, tab, or newline. Likewise,
  a\Sz

would match any three-character string starting with “a” and ending with “z” whose second character was not a space, tab or newline. (Thus, the second character could be a letter, number or symbol.)


The word boundary metacharacter matches the boundaries of words; that is, it matches whitespace, punctuation and the very beginning and end of the text. It looks like “\b“. It’s opposite searches for a character that is not a word boundary. Thus:
  \bcomput

will match “computer” or “computing”, but not “supercomputer” since there is no spaces or punctuation between “super” and “computer”. Similarly,
  \Bcomput

will not match “computer” or “computing”, unless it is part of a bigger word such as “supercomputer” or “recomputing”.

Note that the underscore (_) is considered a “word” character. Thus,

  super\bcomputer

will not match “super_computer”.

There is one other metacharacter starting with a backslash, the octal metacharacter. The octal metacharacter looks like this: “\nnn“, where “n” is a number from zero to seven. This is used for specifying control characters that have no typed equivalent. For example,

  \007

would find all subjects with an embedded ASCII “bell” character. (The bell is specified by an ASCII value of 7.) You will rarely need to use the octal metacharacter.

There are three other metacharacters that may be of use. The first is the braces metacharacter. This metacharacter follows a normal character and contains two number separated by a comma (,) and surrounded by braces ({}). It is like the star metacharacter, except the length of the string it matches must be within the minimum and maximum length specified by the two numbers in braces. Thus,

  ab{3,5}c

will match “abbbc”, “abbbbc” or “abbbbbc”. No other string is matched. Likewise,
  .{3,5}pentane

will match “cyclopentane”, “isopentane” or “neopentane”, but not “n-pentane”, since “n-” is only two characters long.

The alternative metacharacter is represented by a vertical bar (|). It indicates an either/or behavior by separating two or more possible choices. For example:

  isopentane|cyclopentane

will match any subject containing the strings “isopentane” or “cyclopentane” or both. However, It will not match “pentane” or “n-pentane” or “neopentane.” The last metacharacter is the brackets metacharacter. The bracket metacharacter matches one occurence of any character inside the brackets ([]). For example,
  \s[cmt]an\s

will match “can”, “man” and “tan”, but not “ban”, “fan” or “pan”. Similarly,
  2,[23]-dimethylbutane

will match “2,2-dimethylbutane” or “2,3-dimethylbutane”, but not “2,4-dimethylbutane”, “2,23-dimethylbutane” or “2,-dimethybutane”. Ranges of characters can be used by using the dash () within the brackets. For example,
  a[a-d]z

will match “aaz”, “abz”, “acz” or “adz”, and nothing else. Likewise,
  textfile0[3-5]

will match “textfile03”, “textfile04”, or “textfile05” and nothing else.

If you wish to include a dash within brackets as one of the characters to match, instead of to denote a range, put the dash immediately before the right bracket. Thus:

  a[1234-]z

and
  a[1-4-]z

both do the same thing. They both match “a1z”, “a2z”, “a3z”, “a4z” or “a-z”, and nothing else.

The bracket metacharacter can also be inverted by placing a caret (^) immediately after the left bracket. Thus,

  textfile0[^02468]

matches any ten-character string starting with “textfile0” and ending with anything except an even number. Inversion and ranges can be combined, so that
  \W[^f-h]ood\W

matches any four letter wording ending in “ood” except for “food”, “good” or “hood”. (Thus “mood” and “wood” would both be matched.)

Note that within brackets, ordinary quoting rules do not apply and other metacharacters are not available. The only characters that can be quoted in brackets are “[“, “]“, and “\“. Thus,

  [\[\\\]]abc


Forbidden Characters


Because of the way the searcher works, the following metacharacters should not be used, even though they are valid Perl metacharacters. They are:


^ (allowed within brackets)
$ (allowed within brackets)
\n
\r
\t
\f
\b
( ) (allowed within brackets. Note that if you wish to search for parentheses within text outside of brackets, you should quote the parentheses.)
\1, \2\9
\B
:
!

Things To Remember


Here are some other things you should know about regular expressions.


  1. The archive search software searches only subject lines, and all articles within the same thread will also be displayed.


  2. Regular expressions should be a last resort. Because they are complex, it can be more work mastering a search than just sifting through a long list of matches (unless you’re already familiar with regular expressions).


  3. We limit the number of articles which can be shown to 200 or less. This is to minimize load on our system.


  4. The search is case insensitive; thus
      mopac
    and
      Mopac
    and
      MOPAC
    all search for the same set of strings. Each will match “mopac”, “MOPAC”, “Mopac”, “mopaC”, “MoPaC”, “mOpAc” and so forth. Thus you need not worry about capitalization. (Note, however, that metacharacter must still have the proper case. This is especially important for metacharacters whose case determines whether their meaning is reversed or not.)


  5. Outside of the brackets metacharacter, you must quote parentheses, brackets and braces to get the searcher to take them literally.

TestRegex regexp

 

package net.strong.util;




import org.apache.oro.text.regex.MatchResult;


import org.apache.oro.text.regex.Pattern;


import org.apache.oro.text.regex.PatternCompiler;


import org.apache.oro.text.regex.PatternMatcher;


import org.apache.oro.text.regex.PatternMatcherInput;


import org.apache.oro.text.regex.Perl5Compiler;


import org.apache.oro.text.regex.Perl5Matcher;


import org.apache.oro.text.regex.Perl5Substitution;


import org.apache.oro.text.regex.Util;




public class TestRegex {


public TestRegex() {}


public void parseLog() throws Exception {


String log1=“172.26.155.241 – – [26/Feb/2001:10:56:03 -0500] \”GET /IsAlive.htm HTTP/1.0\” 200 15 “;




String regexp=“(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\s-\\s-\\s\\[([^\\]]+)\\]”;




PatternCompiler compiler=new Perl5Compiler();


Pattern pattern=compiler.compile(regexp);




PatternMatcher matcher=new Perl5Matcher();


if (matcher.contains(log1,pattern)) {


MatchResult result=matcher.getMatch();


System.out.println(“IP: “+result.group(1));


System.out.println(“Timestamp: “+result.group(2));


}


}


public void parseHTML() throws Exception {


String html=“<font face=\”Arial, Serif\” size=\”+1\”color=\”red\”>”;




String regexpForFontTag=“<\\s*font\\s+([^>]*)\\s*>”;


String regexpForFontAttrib=“([a-z]+)\\s*=\\s*\”([^\”]+)\””;




PatternCompiler compiler=new Perl5Compiler();


Pattern patternForFontTag=compiler.compile(regexpForFontTag,Perl5Compiler.CASE_INSENSITIVE_MASK);


Pattern patternForFontAttrib=compiler.compile(regexpForFontAttrib,Perl5Compiler.CASE_INSENSITIVE_MASK);




PatternMatcher matcher=new Perl5Matcher();


if (matcher.contains(html,patternForFontTag)) {


MatchResult result=matcher.getMatch();


String attrib=result.group(1);




PatternMatcherInput input=new PatternMatcherInput(attrib);


while (matcher.contains(input,patternForFontAttrib)) {


result=matcher.getMatch();


System.out.println(result.group(1)+“: “+result.group(2));


}


}


}


public void substitutelink() throws Exception {


String link=“<a href=\”http://widgets.acme.com/interface.html#How_To_Trade\”>”;


String regexpForLink=“<\\s*a\\s+href\\s*=\\s*\”http://widgets.acme.com/interface.html#([^\”]+)\”>”;




PatternCompiler compiler=new Perl5Compiler();


Pattern patternForLink=compiler.compile(regexpForLink,Perl5Compiler.CASE_INSENSITIVE_MASK);




PatternMatcher matcher=new Perl5Matcher();




String result=Util.substitute(matcher,


patternForLink,


new Perl5Substitution(“<a href=\”http://newserver.acme.com/interface.html#$1\”>”),


link,


Util.SUBSTITUTE_ALL);




System.out.println(result);


}


public static void main(String[] args) throws Exception {


TestRegex test=new TestRegex();


System.out.println(“\n\nLog Parsing Example”);


test.parseLog();


System.out.println(“\n\nHtml Example 1”);


test.parseHTML();


System.out.println(“\n\nHtml Example 2”);


test.substitutelink();


}


}






PERL5 Regular Expression Description

Why is Perl so useful for sysadmin and WWW and text hacking? It has a lot of nice little features that make it easy to do nearly anything you want to text. A lot of perl programs look like a weird synergy of C and shell and sed and awk. For example:


    #!/usr/bin/perl
    # manpath — tchrist@perl.com
    foreach $bindir (split(/:/, $ENV{PATH})) {
        ($mandir = $bindir) =~ s/[^\/]+$/man/;
        next if $mandir =~ /^\./ || $mandir eq ”;
        if (-d $mandir && ! $seen{$mandir}++ ) {
            ($dev,$ino) = stat($mandir);
            if (! $seen{$dev,$ino}++) {
                push(@manpath,$mandir);
            }
        }
    }
    print join(“:”, @manpath), “\n”;


Can anyone see what that does? I’d like to think it’s not too hard, even devoid of commentary. It does have some naughty bits, like using side effect operators of assignment operators as expressions and double-plus postfix autoincrement. C programmers don’t have a problem with it, but a lot of others do. That’s why Guido banned such things in Python (a rather nice language in many ways), and why I don’t advocate using them to non-C programmers, whom it generally confuses whether it be done in C or in Perl or C++ or any such language.
By far the most bizarre thing is that dread punctuation lying within funny slashes. Often folks call Perl unreadable because they don’t grok regexps, which all true perl wizards — and acolytes — adore. The slashes and their patterns govern matching and splitting and substituting, and here is where a lot of the Perl magic resides: its unmatched 🙂 regular expressions. Certainly the above code could be rewritten in tcl or python or nearly anything else. It could even be rewritten in more legible perl. 🙂


So what’s so special about perl’s regexps? Quite a bit, actually, although the real magic isn’t demonstrated very well in the manpath program. Once you’ve read the perlre(1) and the perlop(1) man pages, there’s still a lot to talk about. So permit me, if you would, to now explain Far More Than Everything You Ever Wanted to Know about Perl Regular Expressions… 🙂


Perl starts with POSIX regexps of the “modern” variety, that is, egrep style not grep style. Here’s the simple case of matching a number


    /Th?om(as)? (Ch|K)rist(ia|e)ns{1,2}s[eo]n/


This avoids a lot of backslashes. I believe many languages also support such regular rexpressions.
Now, Perl’s regexps “aren’t” — that is, they aren’t “regular” because backreferences per sed and grep are also supported, which renders the language no longer strictly regular and so forbids “pure” DFA implementations.


But this is exceedingly useful. Backreferences let you refer back to match part of what you just had. Consider lines like these:


    1. This is a fine kettle of fish.
    2. The best card is Island Fish Jasconius.
    3. Is isolation unpleasant?
    4. That’s his isn’t it?
    5. Is is outlawed?


If you’d like to pick up duplicate “is” strings there, you could use the pattern
    /(is) \1/           # matches 1,4


As written, that will match sentences 1 and 4. The others fail due to mixed case. You can’t fix it just by saying
    /([Ii]s) \1/        # still matches 1,4


because the \1 refers back to the real match, not the potential match. So what do we do? Well, POSIX specifies a REG_ICASE flag you can pass into your matcher to help support “grep -i” etc. To get perl to do this, affix an i flag after the match:
    /(is) \1/i          # matches 1,2,3,4,5


And now all 5 of those sentences match. If you only wanted them to match legit words, you might use the \b notation for word boundaries, making it
    /\b(is) \1/i        # matches 2,3,5
    /(is) \1\b/i        # matches 1,5
    /\b(is) \1\b/i      # matches 5


This means you will see Perl code like
    if ( $variable =~ /\b(is) \1\b/i ) {
        print “gotta match”;
    }


One might argue that is “should” be written more like
    if ( rematch(variable, ‘\b(is) \1\b’, ‘i’) ) {
        print “gotta match”;
    }


but that’s not how Perl works. I suspect that other languages could make it work that way.
If you’d like to know where you matched, you might want to use these:


        $MATCH                  full match
        $PREMATCH               before the match
        $POSTMATCH              after the match
        $LAST_PAREN_MATCH       useful for alternatives


Although the most normal case is just to use $1, $2, etc, which match the first, second, etc parenthesized subexpressions.
Another nice thing that Perl supports are the notions from C’s ctype.h include file:


        C function      Perl regexp


        isalnum         \w
        isspace         \s
        isdigit         \d


That means that you don’t have to hard-code [A-Z] and have it break when someone has some interesting locale settings. For example, under charset=ISO-8859-1, something like “façade” properly matches /^\w+$/, because the c-cedille is considered an alphanum. In theory, LC_NUMERIC settings should also take, but I’ve never tried.
This quickly leads to a pattern that detects duplicate words in sentences:


    /\b(\w+)(\s+\1)+\b/i


In fact, that one matches multiple duplicates as well. If if if you read in your input data a paragraph at a time, it will catch dups crossing line boundaries as as well. For example, using some convenient command line flags, here’s a
    perl -00 -ne ‘if ( /\b(\w+)(\s+\1)+\b/i ) { print “dup $1 at $.\n” }’


which when used on this article says:
    dup Is at 10
    dup If at 33


the $. variable ($NR in English mode) is the record number. I set it to read paragraph records, so paragraphs 10 and 33 of this posting contain duplicate words.
Actually, we can do something a bit nicer: we can find multiple duplicates in the same paragraph. The /g flag causes a match to store a bit of state and start up where it last left off. This gives us:


    #!/usr/bin/perl -00 -n
    while ( /\b(\w+)(\s+\1)+\b/gi ) {
        print “dup $1 at paragraph $.\n”;
    }


This now yields:
    dup Is at paragraph 10
    dup if at paragraph 33
    dup as at paragraph 33


Of course, we’re getting a bit hard to read here. So let’s use the /x flag to permit embedded white space and comments in our pattern — you’ll want 5.002 for this (the white space worked in 5.000, but the comments were added later :-). For legibility, instead of slashes for the match, I’ll embrace the real m() function, Since /foo/ and m(foo) and m{foo} are all equivalent.
    #!/usr/bin/perl -n
    require 5.002;
    use English;
    $RS = ”;


    while (
       m{                       # m{foo} is like /foo/, but helps vi’s % key


                 \b             # first find a word boundary


                 (\w+)          # followed by the biggest word we can find
                                # which we’ll save in the \1 buffer
                 (
                   \s+          # now have some white space following it
                   \1           # and the word itself
                 )+             # repeat the space+word combo ad libitum


                 \b             # make sure there’s a boundary at the end too


        }xgi                    # /x for space/comment-expanded patterns
                                # /g for global matching
                                # /i for case-insensitive matching
    )
    {
        print “dup $1 at paragraph $NR\n”;
    }


While it’s true that someone who doesn’t know regular expressions won’t be able to read this at first glance, this is not a problem. So even though we can build up rather complex patterns, we can format and comment them nicely, preserving understandability. I wonder why no one else has done this in their regexp libraries?
I actually wrote a sublegible version of this many years ago. It runs even on ancient versions of Perl. I’d probably to that a bit differently these days — my coding style has certainly matured. It violates several of my own current style guidelines.


    #!/usr/bin/perl
    undef $/; $* = 1;
    while ( $ARGV = shift ) {
        if (!open ARGV) { warn “$ARGV: $!\n”; next; }
        $_ = <ARGV&gt$$
        s/\b(\s?)(([A-Za-z]\w*)(\s+\3)+\b)/$1\200$2\200/gi || next;
        split(/\n/);
        $NR = 0;
        @hits = ();
        for (@_) {
            $NR++;
            push(@hits, sprintf(“%5d %s”, $NR, $_)) if /\200/;
        }
        $_ = join(“\n”,@hits);
        s/\200([^\200]+)\200/[* $1 *]/g;
        print “$ARGV:\n$_\n”;
    }


here’s that will output when run on this article up to this current point:
   51     5. [* Is is *] outlawed?
  124 In fact, that one matches multiple duplicates as well.  [* If
  125 if if *] you read in your input data a paragraph at a time, it will
  126 catch dups crossing line boundaries [* as as *] well.  For example, using


Which is pretty neat.
Speaking of ctype.h macros, Perl borrows the vi notation of case translation via \u, \l, \U, and \L. So you could say


    $variable = “façade niño coöperate molière renée naïve hæmo tschüß”;
and then do a


    $variable =~ s/(\w+)/\U$1/g;


and it would come out
    FAÇADE NIÑO COÖPERATE MOLIÈRE RENÉE NAÏVE HÆMO TSCHÜß


Oh well. My clib doesn’t know to turn ß -> SS. That’s a harder issue.
This is much better than writing things like


    $variable =~ tr[a-z][A-Z];


because that would give you:
    FAçADE NIñO COöPERATE MOLIèRE RENéE NAïVE HæMO TSCHüß


which isn’t right at all.
Actually, perl can beat vi and do this:


    $variable =~ s/(\w+)/\u\L$1/g;


Yielding:
    Façade Niño Coöperate Molière Renée Naïve Hæmo Tschüß


which is somewhat interesting.
Speaking of substitutes, we can use a /e flag on the substitute to get the RHS to evaluate to code instead of just a string. Consider:


    s/(\d+)/8 * $1/ge;              # multiple all numbers by 8
    s/(\d+)/sprintf(“%x”, $1)/ge;   # convert them to hex


This is nice when renumbering paragraphs. I often write
    s/^(\d+)/1 + $1/


or from within vi, just
    %!perl -pe ‘s/^(\d+)/1 + $1/’


Here’s a more elaborate example of this. If you wanted to expand %d or %s or whatnot, you might just do
    s/%(.)/$percent{$1}/g;


given a %percent definition like this:
    %percent = (
                ‘d’     => ‘digit’,
                ‘s’     => ‘string’,
    );


But in fact, that’s got quite enough. You might well want to call a function, like
    s/%(.)/unpercent($1)/ge;


(assuming you have an unpercent() function defined.)
You can even use /ee for a double-eval, but that seems going overboard in most cases. It is, however, nice for converting embedded variables like $foo or whatever in text into their values. This way a sentence with $HOME and $TERM in it, assuming there were valid variables, might become a sentence with /home/tchrist and xterm in it. Just do this:


   s/(\$\w+)/$1/eeg;


Ok, what more can we do with perl patterns? split takes a pattern. Imagine that you have a record stored in plain text as blank line separated paragraphs with FIELD: VALUE pairs on each line.
    field: value here
    somefield: some value here
    morefield: other value here


    field: second record’s value here
    somefield: some value here
    morefield: other value here
    newfield: other funny stuff


You could process that this way. We’ll put it into key value pairs in a hash, just as though it had been initialized as
    %hash = (
        ‘field’         => ‘value here’,
        ‘somefield’     => ‘some value here’,
        ‘morefield’     => ‘other value here’,
    );


I’ll use a few command line switches for short cuts:
    #!/usr/bin/perl -00n
    %hash = split( /^([^:]+):\s*/m );
    if ( $hash{“somefield”} =~ /here/) {
        print “record $. has here in somefield\n”;
    }


The /m flag governs whether ^ can match internally. I believe this is the POSIX value REG_NEWLINE. Normally perl does not have ^ match anywhere but the beginning of the string. (
Or you could eschew shortcuts and write:


    #!/usr/bin/perl
    use English;
    $RS = ”;
    while ( $line = <ARGV> ) {
        %hash = split(/^([^:]+):\s*/m, $line);
        if ( $hash{“somefield”} =~ /here/) {
            print “record $NR has here in somefield\n”;
        }
    }


Actually, in the current version of perl, you can use the getline() object method on the predefined ARGV file handle object:
    #!/usr/bin/perl
    use English;
    $RS = ”;
    while ( $line = ARGV->getline() ) {
        %hash = split(/^([^:]+):\s*/m, $line);
        if ( $hash{“somefield”} =~ /here/) {
            print “record $NR has here in somefield\n”;
        }
    }


This can be especially convenient for handling mail messages.
Here, for example, is a bair-bones mail-sorting program:


    #!/usr/bin/perl -00
    while (<>) {
        if ( /^From / ) {
            ($id) = /^Message-ID:\s*(.*)/mi;
            $sub{$id} = /^Subject:\s*(Re:\s*)*(.*)/mi
                            ? uc($2)
                            : $id;
        }
        $msg{$id} .= $_;
    }
    print @msg{ sort { $sub{$a} cmp $sub{$b} } keys %msg};


Now, I still haven’t mentioned a couple of features which are to my mind critical in any analysis of the strengths of Perl’s pattern matching. These are stingy matching and lookaheads.
Stingy matching solves the problem greedy matching. A greedy match picks up everything, as in:


       $line = “The food is under the bar in the barn.”;
       if ( $line =~ /foo(.*)bar/ ) {
           print “got <$1>\n”;
       }


That prints out
    <d is under the bar in the >


Which is often not what you want. Instead, we can add an extra ? after a repetition operator to render it stingy instead of greedy.
       if ( $line =~ /foo(.*?)bar/ ) {
           print “got <$1>\n”;
       }


That prints out
       got <d is under the >


which is often more what folks want. It turns out that having both stringy and greedy repetition operators in no way compromises a regexp engines regularity, nor is it particularly hard to implement. This comes up in matching quoted things. You can do tricks like using [^:] or [^”] or [^”‘] for the simple cases, but negating multicharacter strings is hard. You can just use stingy matching instead.
Or you could just use lookaheads.


This is other important aspect of perl matching I wanted to mention. These are 0-width assertions that state that what follows must match or must not match a particular thing. These are phrased as either (?=pattern) for the assertion or (?!pattern) for the negation.


    /\bfoo(?!bar)\w+/


That will match “foostuff” but not “foo” or “foobar”, because I said there must be some alphanums after the word foo, but these may not begin with bar.
Why would you need this? Oh, there are lots of times. Imagine splitting on newlines that are not followed by a space or a tab:


    @list_of_results = split ( /\n(?![\t ])/, $data );


Let’s put this all together and look at a couple of examples. Both have to do with HTML munging, the current rage. First, let’s solve the problem of detecting URLs in plaintext and highlighting them properly. A problem is if the URL has trailling punctuation, like ftp://host/path.file. Is that last dot supposed to be in the URL? We can probably just assume that a trailing dot doesn’t count, but even so, most scanners seem to get this wrong. Here’s a different approach:
  #!/usr/bin/perl
  # urlify — tchrist@perl.com
  require 5.002;  # well, or 5.000 if you see below


  $urls = ‘(‘ . join (‘|’, qw{
                http
                telnet
                gopher
                file
                wais
                ftp
            } )
        . ‘)’;


  $ltrs = ‘\w’;
  $gunk = ‘/#~:.?+=&%@!\-‘;
  $punc = ‘.:?\-‘;
  $any  = “${ltrs}${gunk}${punc}”;


  while (<>) {
      ## use this if early-ish perl5 (pre 5.002)
      ##  s{\b(${urls}:[$any]+?)(?=[$punc]*[^$any]|\Z)}{<A HREF=”$1″>$1</A>}goi;
      ## otherwise use this — it just has 5.002ish comments
      s{
        \b                          # start at word boundary
        (                           # begin $1  {
          $urls     :               # need resource and a colon
          [$any] +?                 # followed by on or more
                                    #  of any valid character, but
                                    #  be conservative and take only
                                    #  what you need to….
        )                           # end   $1  }
        (?=                         # look-ahead non-consumptive assertion
                [$punc]*            # either 0 or more puntuation
                [^$any]             #   followed by a non-url char
            |                       # or else
                $                   #   then end of the string
        )
      }{<A HREF=”$1″>$1</A>}igox;
      print;
  }


Pretty nifty, eh? 🙂
Here’s another HTML thing: we have an html document, and we want to remove all of its embedded markup text. This requires three steps:


    1) Strip <!– html comments –>
    2) Strip <TAGS>
    3) Convert &entities; into what they should be.


This is complicated by the horrible specs on how html comments work: they can have embedded tags in them. So you have to be way more careful. But it still only takes three substitutions. 🙂 I’ll use the /s flag to make sure that my “.” can stretch to match a newline as well (normally it doesn’t).
    #!/usr/bin/perl -p0777
    #
    #########################################################
    # striphtml (“striff tummel”)
    # tchrist@perl.com
    # version 1.0: Thu 01 Feb 1996 1:53:31pm MST
    # version 1.1: Sat Feb  3 06:23:50 MST 1996
    #           (fix up comments in annoying places)
    #########################################################
    #
    # how to strip out html comments and tags and transform
    # entities in just three — count ’em three — substitutions;
    # sed and awk eat your heart out.  🙂
    #
    # as always, translations from this nacré rendition into
    # more characteristically marine, herpetoid, titillative,
    # or indonesian idioms are welcome for the furthering of
    # comparitive cyberlinguistic studies.
    #
    #########################################################


    require 5.001;      # for nifty embedded regexp comments


    #########################################################
    # first we’ll shoot all the <!– comments –>
    #########################################################


    s{ <!                   # comments begin with a `<!’
                            # followed by 0 or more comments;


        (.*?)           # this is actually to eat up comments in non
                            # random places


         (                  # not suppose to have any white space here


                            # just a quick start;
          —                # each comment starts with a `–‘
            .*?             # and includes all text up to and including
          —                # the *next* occurrence of `–‘
            \s*             # and may have trailing while space
                            #   (albeit not leading white space XXX)
         )+                 # repetire ad libitum  XXX should be * not +
        (.*?)           # trailing non comment text
       >                    # up to a `>’
    }{
        if ($1 || $3) { # this silliness for embedded comments in tags
            “<!$1 $3>”;
        }
    }gesx;                 # mutate into nada, nothing, and niente
   
    #########################################################
    # next we’ll remove all the <tags>
    #########################################################


    s{ <                    # opening angle bracket


        (?:                 # Non-backreffing grouping paren
             [^>'”] *       # 0 or more things that are neither > nor ‘ nor “
                |           #    or else
             “.*?”          # a section between double quotes (stingy match)
                |           #    or else
             ‘.*?’          # a section between single quotes (stingy match)
        ) +                 # repetire ad libitum
                            #  hm…. are null tags <> legal? XXX
       >                    # closing angle bracket
    }{}gsx;                 # mutate into nada, nothing, and niente


    #########################################################
    # finally we’ll translate all &valid; HTML 2.0 entities
    #########################################################


    s{ (
            &              # an entity starts with a semicolon
            (
                \x23\d+    # and is either a pound (# == hex 23)) and numbers
                 |         #   or else
                \w+        # has alphanumunders up to a semi
            )
            ;?             # a semi terminates AS DOES ANYTHING ELSE (XXX)
        )
    } {


        $entity{$2}        # if it’s a known entity use that
            ||             #   but otherwise
            $1             # leave what we’d found; NO WARNINGS (XXX)


    }gex;                  # execute replacement — that’s code not a string
   
    #########################################################
    # but wait! load up the %entity mappings enwrapped in
    # a BEGIN that the last might be first, and only execute
    # once, since we’re in a -p “loop”; awk is kinda nice after all.
    #########################################################


    BEGIN {


        %entity = (


            lt     => ‘<‘,     #a less-than
            gt     => ‘>’,     #a greater-than
            amp    => ‘&’,     #a nampersand
            quot   => ‘”‘,     #a (verticle) double-quote


            nbsp   => chr 160, #no-break space
            iexcl  => chr 161, #inverted exclamation mark
            cent   => chr 162, #cent sign
            pound  => chr 163, #pound sterling sign CURRENCY NOT WEIGHT
            curren => chr 164, #general currency sign
            yen    => chr 165, #yen sign
            brvbar => chr 166, #broken (vertical) bar
            sect   => chr 167, #section sign
            uml    => chr 168, #umlaut (dieresis)
            copy   => chr 169, #copyright sign
            ordf   => chr 170, #ordinal indicator, feminine
            laquo  => chr 171, #angle quotation mark, left
            not    => chr 172, #not sign
            shy    => chr 173, #soft hyphen
            reg    => chr 174, #registered sign
            macr   => chr 175, #macron
            deg    => chr 176, #degree sign
            plusmn => chr 177, #plus-or-minus sign
            sup2   => chr 178, #superscript two
            sup3   => chr 179, #superscript three
            acute  => chr 180, #acute accent
            micro  => chr 181, #micro sign
            para   => chr 182, #pilcrow (paragraph sign)
            middot => chr 183, #middle dot
            cedil  => chr 184, #cedilla
            sup1   => chr 185, #superscript one
            ordm   => chr 186, #ordinal indicator, masculine
            raquo  => chr 187, #angle quotation mark, right
            frac14 => chr 188, #fraction one-quarter
            frac12 => chr 189, #fraction one-half
            frac34 => chr 190, #fraction three-quarters
            iquest => chr 191, #inverted question mark
            Agrave => chr 192, #capital A, grave accent
            Aacute => chr 193, #capital A, acute accent
            Acirc  => chr 194, #capital A, circumflex accent
            Atilde => chr 195, #capital A, tilde
            Auml   => chr 196, #capital A, dieresis or umlaut mark
            Aring  => chr 197, #capital A, ring
            AElig  => chr 198, #capital AE diphthong (ligature)
            Ccedil => chr 199, #capital C, cedilla
            Egrave => chr 200, #capital E, grave accent
            Eacute => chr 201, #capital E, acute accent
            Ecirc  => chr 202, #capital E, circumflex accent
            Euml   => chr 203, #capital E, dieresis or umlaut mark
            Igrave => chr 204, #capital I, grave accent
            Iacute => chr 205, #capital I, acute accent
            Icirc  => chr 206, #capital I, circumflex accent
            Iuml   => chr 207, #capital I, dieresis or umlaut mark
            ETH    => chr 208, #capital Eth, Icelandic
            Ntilde => chr 209, #capital N, tilde
            Ograve => chr 210, #capital O, grave accent
            Oacute => chr 211, #capital O, acute accent
            Ocirc  => chr 212, #capital O, circumflex accent
            Otilde => chr 213, #capital O, tilde
            Ouml   => chr 214, #capital O, dieresis or umlaut mark
            times  => chr 215, #multiply sign
            Oslash => chr 216, #capital O, slash
            Ugrave => chr 217, #capital U, grave accent
            Uacute => chr 218, #capital U, acute accent
            Ucirc  => chr 219, #capital U, circumflex accent
            Uuml   => chr 220, #capital U, dieresis or umlaut mark
            Yacute => chr 221, #capital Y, acute accent
            THORN  => chr 222, #capital THORN, Icelandic
            szlig  => chr 223, #small sharp s, German (sz ligature)
            agrave => chr 224, #small a, grave accent
            aacute => chr 225, #small a, acute accent
            acirc  => chr 226, #small a, circumflex accent
            atilde => chr 227, #small a, tilde
            auml   => chr 228, #small a, dieresis or umlaut mark
            aring  => chr 229, #small a, ring
            aelig  => chr 230, #small ae diphthong (ligature)
            ccedil => chr 231, #small c, cedilla
            egrave => chr 232, #small e, grave accent
            eacute => chr 233, #small e, acute accent
            ecirc  => chr 234, #small e, circumflex accent
            euml   => chr 235, #small e, dieresis or umlaut mark
            igrave => chr 236, #small i, grave accent
            iacute => chr 237, #small i, acute accent
            icirc  => chr 238, #small i, circumflex accent
            iuml   => chr 239, #small i, dieresis or umlaut mark
            eth    => chr 240, #small eth, Icelandic
            ntilde => chr 241, #small n, tilde
            ograve => chr 242, #small o, grave accent
            oacute => chr 243, #small o, acute accent
            ocirc  => chr 244, #small o, circumflex accent
            otilde => chr 245, #small o, tilde
            ouml   => chr 246, #small o, dieresis or umlaut mark
            divide => chr 247, #divide sign
            oslash => chr 248, #small o, slash
            ugrave => chr 249, #small u, grave accent
            uacute => chr 250, #small u, acute accent
            ucirc  => chr 251, #small u, circumflex accent
            uuml   => chr 252, #small u, dieresis or umlaut mark
            yacute => chr 253, #small y, acute accent
            thorn  => chr 254, #small thorn, Icelandic
            yuml   => chr 255, #small y, dieresis or umlaut mark
        );


        ####################################################
        # now fill in all the numbers to match themselves
        ####################################################
        for $chr ( 0 .. 255 ) {
            $entity{ ‘#’ . $chr } = chr $chr;
        }
    }
   
    #########################################################
    # premature finish lest someone clip my signature
    #########################################################


    # NOW FOR SOME SAMPLE DATA — Switch ARGV to DATA above
    # to test


    __END__


    <title>Tom Christiansen’s Mox.Perl.COM Home Page</title>
    <!– begin header –>
<A HREF=”http://perl-ora.songline.com/universal/header.map”><IMG SRC=”http://perl-ora.songline.com/graphics/header-nav.gif” HEIGHT=”18″ WIDTH=”515″ ALT=”Nav bar” BORDER=”0″ usemap=”#header-nav”></A>


<map name=”header-nav”>
<area shape=”rect” alt=”Perl.com” coords=”5,1,103,17″ href=”http://www.perl.com/index.html“>
<area shape=”rect” alt=”CPAN” coords=”114,1,171,17″ href=”http://www.perl.com/CPAN/CPAN.html“>
<area shape=”rect” alt=”Perl Language” coords=”178,0,248,16″ href=”http://language.perl.com/“>
<area shape=”rect” alt=”Perl Reference” coords=”254,0,328,16″ href=”http://reference.perl.com/“>
<area shape=”rect” alt=”Perl Conference” coords=”334,0,414,17″ href=”http://perl-conf.songline.com“>
<area shape=”rect” alt=”Programming Republic of Perl” coords=”422,0,510,17″ href=”http://republic.perl.com“>
</map>


<!– end header –>
<BODY BGCOLOR=#ffffff TEXT=#000000>


    <!–


    <BODY BGCOLOR=”#000000″ TEXT=”#FFFFFF”
          LINK=”#FFFF00″ VLINK=”#22AA22″ ALINK=”#0077FF”>


    !–>


    <A NAME=TOP>


    <CENTER>
    <h3>
    <A HREF=”#PERL”>perl</a> /
    <A HREF=”#MAGIC”>magic</a> /
    <A HREF=”#USENIX”>usenix</a> /
    <A HREF=”#BOULDER”>boulder</a>
    </h3>
    <BR>
    The word of the day is <i>nidificate</i>.
    </CENTER>


    Testing: &#69; &#202; &Auml;
    </a>


    <HR NOSHADE SIZE=3>


    <A NAME=PERL>
    <CENTER>
    <h1>
    <IMG SRC=”/deckmaster/gifs/camel.gif” ALT=””>
    <font size=7>
    Perl
    </font>
    <IMG SRC=”/deckmaster/gifs/camel.gif” ALT=””>
    </h1>
    </a>


    DOCTYPE START1
    <!DOCTYPE  HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”
      — This is an annoying comment > —
    >
    END1


    DOCTYPE START2
    <!DOCTYPE  HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”
      — This is an annoying comment  —
    >
    END2


    <I>
    <BLOCKQUOTE>
    <DL><DT>A ship then new they built for him
    <DD>of mithril and of elven glass…
    </DL>
    </I>
    </BLOCKQUOTE>
    </CENTER>


    <HR size=3 noshade>


    <BLOCKQUOTE>
        Wow!  I really can’t believe that anyone has read this far
        in this very long news posting about irregular expressions. 🙂
        Is anyone really still with me?  If so, make my day and
        drop me a piece of email.
    </BLOCKQUOTE>


    <UL>
    <LI>
    <A HREF=”/CPAN/README.html”>CPAN
    (Comprehensive Perl Archive Network)</a> sites are replicated around the world; please ch
oose
    from <A HREF=”/CPAN/CPAN.html”>one near you</a>.
    The <A HREF=”/CPAN/modules/01modules.index.html”>CPAN index</a
>
    to the <A HREF=”/CPAN/modules/00modlist.long.html”>full module
s file</a>
    are also good places to look.


    <LI><IMG SRC=”/deckmaster/gifs/new.gif” WIDTH=26 HEIGHT=13 ALT=”NEW”>
    Here’s a table of perl and CGI-related books and publications, in either
    <A HREF=”/info/books.html”><SMALL>HTML</SMALL> 3.0 table format</a>
    or else in
    <A HREF=”/info/books.txt”>pre-formatted</a> for old browsers.


What’s missing from Perl’s regular expressions? Anything? Well, yes. The first is that they should be first-class objects. There are some really embarassing optimization hacks to get around not having compiled regepxs directly-usable accessible. The /o flag I used above is just one of them. (I’m *not* talking about the study() function, which is a neat thing to turbo-ize your matching.) A much more egregious hack involving closures is demonstrated here using the match_any funtion, which itself returns a function to do the work:
    $f = match_any(‘^begin’, ‘end$’, ‘middle’);
    while (<>) {
        print if &$f();
    }


    sub match_any {
        die “usage: match_any pats” unless @_;
        my $code = <<EOCODE;
    sub {
    EOCODE
        $code .= <<EOCODE if @_ > 5;
        study;
    EOCODE
        for $pat (@_) {
            $code .= <<EOCODE;
        return 1 if /$pat/;
    EOCODE
        }
        $code .= “}\n”;
        print “CODE: $code\n”;
        my $func = eval $code;
        die “bad pattern: $@” if $@;
        return $func;
    }


That’s the kind of thing I just despise writing: the only thing worse would be not being able to do it at all. 🙁 1st-class compiled regexps would surely help a great deal here.
Sometimes people expect backreferences to be forward references, as in the pattern /\1\s(\w+)/, which just isn’t the way it works. A related issue is that while lookaheads work, these are not lookbehinds, which can confuse people. This means /\n(?=\s)/ is ok, but you cannot use this for lookbehind: /(?!foo)bar/ will not find an occurrence of “bar” that is preceded by something which is not “foo”. That’s because the (?!foo) is just saying that the next thing cannot be “foo”–and it’s not, it’s a “bar”, so “foobar” will match.


There isn’t really much support for user-defined character classes. You see a bit of that in the urlify program above. On the other hand, this might be the most clear way of writing it.


Another thing that would be nice to have is the ability to someone specify a recursive match with nesting. That ways you could pull out matching parens or braces or begin/end blocks etc. I don’t know what a good syntax for this might be. Maybe (?{…) for the opening one and (?}…) for the closing one, as in:


    /\b(?{begin)\b.*\b(?}end)\b/i


Finally, while it’s cool that perl’s patterns are 8-bit clean, will match strings even with null bytes in them, and have support for alternate 8-bit character sets, it would certainly make the world happy if there were full Unicode support.

Escape Mission 逃脫任務

Escape Mission 逃脫任務

軟體:Escape Mission(版本:N/A)
類別:益智遊戲
性質:Freeware()

【編輯/宗文】

這是一款益智遊戲,玩家的目標是要推開擋住主角的箱子,然後找出一條可以前往出口處的通道,當主角走到出口處便能順利過關。(會呈現閃動狀態的棕色格子便是出口處。)遊戲中玩家可以看到畫面下方有一個「MOVES」字樣,其底下有許多小白點,每當玩家移動一次就會扣一白點,當關卡結束後留有愈多白點可以獲得更多積分。

遊戲中玩家一次只能推動一個箱子,而且如果箱子推到牆壁邊緣或者路徑的旁邊時就無法再推動,因此玩家必須先經過縝密思考再來推動箱子,否則很可能會困住自己。另外遊戲中還會出現一些障礙物,例如鐵製轉門,當轉門旁邊有箱子時,將不能推動轉門,玩家必須先將旁邊的箱子移走。又例如一些帶有三角形圖案的地板,必須是特定的主角才能通過,這些限制都增加了遊戲的困難度,讓玩家更加傷腦筋。遊戲中有些關卡是要多人走到出口才能過關,因此有可能要多人合作,才能清出一條通往出口的通道。



遊戲操控說明:
1.利用四個方向鍵移動主角。
2.空白鍵可以切換不同主角。
3.滑鼠左鍵點擊「RESET!」可以重玩本關卡,不過會扣一生命值。

下載:

Super Pirate Isle 海盜之島

Super Pirate Isle 海盜之島

軟體:Super Pirate Isle(版本:N/A)
類別:動作遊戲
性質:Freeware()

【編輯/宗文】

玩家將會隨著遊戲的進行,前往各處不同的島嶼,然後引導海盜來找到藏寶箱,只有在限定的時間之內找完關卡中的全部藏寶箱,才能順利過關,並且可以有資格來挑戰更艱難的下一個關卡。而如果無法在時間之內找完,則整個遊戲都會結束。愈早過關,可以獲得時間積分會愈多。

遊戲中玩家會遇到許多敵人,他們會到處走動,阻擾玩家找到藏寶箱。玩家可以利用炸彈來攻擊他們,不過再放置炸彈之後,要迅速躲避,要不然可能會被炸彈所波及。不管是碰觸到敵人或者被炸彈所炸傷,這些都會扣一生命值,玩家要小心才能順利過關。當玩家要走到地圖的另一側時要注意,因為敵人有能就躲在邊邊角角的地方,一不注意就會碰觸到。



遊戲操控說明:
1.利用四個方向鍵來移動主角。
2.空白鍵可以放置炸彈。


下載:

Panik in Platform Peril 潘尼克冒險記

Panik in Platform Peril 潘尼克冒險記

軟體:Panik in Platform Peril(版本:N/A)
類別:動作遊戲
性質:Freeware()

【編輯/宗文】

這是一款動作遊戲,而玩家的目標是先找到鑰匙,然後尋找出口處來用鑰匙開啟出口,如此才能順利過關,並且可以來挑戰更艱難的下一關。

遊戲中玩家會發現一路上會有許多魚骨頭出現,玩家可以盡量來收集它們,將可獲得更多的積分。當主角遭受敵人攻擊,或者碰觸到各種機關時,畫面正下方的力量值會減少,如果玩家能找到胡蘿蔔的話,將可以補充部分減少的力量值。遊戲中玩家可以丟擲武器來攻擊敵人,將它們暫時冰凍住,但要小心一會兒後他們又可以開始自由行動了。

遊戲中除了會出現敵人之外,還會有各種機關,例如會刺人的仙人掌,或者可怕的機械拳擊手套等等,玩家要小心避開它們。另外跳躍能力是玩家要過關所倚重的能力,許多地方必須來連續跳躍,例如某些地方必須藉由跳過多顆氣球,才能到達高處,而這些氣球又很容易破損,所以動作要快,才能順利到達目的地。



遊戲操控說明:
1.利用方向鍵中的左右鍵移動主角。
2.方向鍵中的上鍵可以進行跳躍,下鍵則是蹲下。
3.空白鍵可以丟出攻擊武器,暫時冰凍住敵人。

下載:

Asteroids Revenge 3 行星的復仇行動

Asteroids Revenge 3 行星的復仇行動

軟體:Asteroids Revenge 3(版本:N/A)
類別:動作遊戲
性質:Freeware()

【編輯/宗文】

遊戲中玩家將要控制一顆行星,與眾多敵人對抗。攻擊的方式是利用行星本身來撞擊敵人,或者也可以利用周邊的小行星來攻擊敵人。敵人的種類繁多,有些會成群結隊出現,發射出大量子彈來攻擊主角,有些則是非常會閃躲,要打倒他們可是要費一番功夫的。另外有些類似炸彈,會產生大爆炸,如果太靠近爆炸區域可是會受到重傷害的。有些則是會產生排擠的力量,讓主角很難靠近來攻擊他們。因此要順利打敗這些敵人可是不容易的喔!



遊戲中玩家必須保護自己的主要行星,盡量不讓他受傷害,而要達到此目的,可以利用周邊的小行星來抵擋各式子彈的攻擊。另外每次過關後,會有一些增強我方各式能力的選項,玩家可以選擇一個項目來增強能力,例如讓行星的速度加快,或者讓行星變的更大等等,這些將是過關斬將的利器。



遊戲操控方面:
1.利用滑鼠移動或四個方向鍵來移動我們的主角行星。
2.Z鍵可以讓周邊的小行星靠攏,X鍵則是讓小行星與行星距離拉大。
3.C鍵可以讓行星與小行星分離。

下載:

stay the distance 賽馬

stay the distance 賽馬

軟體:stay the distance(版本:N/A)
類別:動作遊戲
性質:Freeware()

【編輯/宗文】

這是一款賽馬的遊戲,玩家的目標是能夠達成第一個跑回終點站的騎士。不過要當冠軍可不簡單喔!必須要考慮眾多因素,每個環節都能注意才能順利達成。玩家可以看到畫面右上角有一些指示的訊息,綠色部分是代表距離終點站還有多少距離,紅色部分則代表此匹馬的體力多寡程度,當沒有體力時,馬匹的移動速度會相當緩慢。最靠近右上角的「PACE」代表馬匹移動的速度,玩家控制的馬移動速度快的話,下方體力則會消耗的快,因此要如何搭配得當,就要靠玩家的智慧了!

遊戲中有一個項目「WHIPS」,這就是用鞭子抽打馬匹,這可使馬匹的速度急速增加,不過只能支撐一會兒的時間,很快的速度又會降回來,另外此功能只有三次機會,玩家要慎選時機來利用。遊戲中遇到障礙物,必須要操控馬匹跨欄,這個時間點可要選好,否則可是會摔下馬的喔!

遊戲操控說明:
1.利用方向鍵中的上下鍵增加或減少馬匹移動速度。
2.利用方向鍵中的左右鍵使馬匹左右橫向移動。
3.Ctrl鍵可使用「WHIPS」功能。
4.空白鍵可以使馬匹跨欄。

下載:http://www.miniclip.com/games/stay-the-distance/en/