Add tags

Add tags to the following comment
普通に数えてみました。
再帰処理が使えないので、自前で階層処理(#hier関連)を実装しました。
なので、処理がちょっと冗長に...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$goal="Q";
$pipe[0]="-";
$pipe[1]="|";
#route=1;
#hier=0;
#houkou=0;

    gofiletop;
    while( 1==1 ) {
        if( #houkou==0 || #houkou==1 ) {
            call rightdown #houkou;
            #ret=##return;
            if( #ret==1 ) {
                #rd[#hier]=#houkou;
                #pnt[#hier]=#pnt[#hier]+1;
                #hier=#hier+1;
                #houkou=0;
                continue;
            }
            #houkou=#houkou+1;
        } else {
            if( char(code)!=$goal ) {
                #route = #route+#pnt[#hier]-1;
            }
            #pnt[#hier]=0;
            #hier=#hier-1;
            #houkou=#rd[#hier]+1;
            if( #hier==-1 ) break;
            call gowhere #rd[#hier]+2;
            call gowhere #rd[#hier]+2;
            continue;
        }
    }
    message( str(#route) );
    endmacro;

rightdown:
    call gowhere ##1;
    if( char(code)==$pipe[##1] ) {
        call gowhere ##1;
        return 1;
    }
    call gowhere ##1+2;
    return 0;

gowhere:
    if( ##1==0 ) right;
    if( ##1==1 ) down;
    if( ##1==2 ) left;
    if( ##1==3 ) up;
    return;

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...