七行プログラミング (452レス)
七行プログラミング http://medaka.5ch.net/test/read.cgi/php/1036141603/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
1: nobodyさん [] 02/11/01 18:06 ID:umVq3FGM ・7行×79文字 ・Perl どうぞ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/1
7: nobodyさん [0] 02/11/01 18:52 ID:??? #!/usr/local/bin/perl if (>>1 = "バカ") { print "イッテヨシ"; } else { print "マターリしましょう"; } http://medaka.5ch.net/test/read.cgi/php/1036141603/7
27: nobodyさん [sage] 02/11/02 02:08 ID:??? >>1 Perl限定かよ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/27
160: nobodyさん [sage] 03/08/18 07:15 ID:??? ちょっと長くなったけど、初心者質問スレを荒らしている彼に捧げよう。(w #--- br.p --- package P;sub c{bless pop,pop}sub s{$_[0]->{s}}sub n{$_[0]->{n}}sub h{my($s,$c) =@_;$c||return$s->{h};($s->{h}+=$c)>0or$s->{h}=0}sub b{my($s,$e)=@_;my@w=keys%{ $s->{w}};my$w=$w[int rand@w];print$s->n,' は ',$w," で攻撃!\n";my($d,$a)=@{$s-> {w}{$w}}{d,a};$d=(my$n=int rand 101)>$a?0:$n>$a/2?int($d/2)-$e->s:$n>$a/20?$d- $e->s:$d;print$d<=0?"ミス!\n":($e->n,' に ',$d," ポイントのダメージ!\n");$e->h( -$d)||print$e->n," を倒した!\n"}package main;sub p{splice@p,int rand@p,1}@p=map P->c($_),@{do'./p.dat'};while(@p>1){my$o=p;my$d=p;print"\n",$o->n,':',$o->h,' ' ,$d->n,':',$d->h,"\n";$o->b($d);push@p,$o;$d->h>0&&push@p,$d}print(shift(@p)->n , " の 勝利!\n") #--- p.dat --- [{n=>'煽り',h=>400,s=>10,w=>{'キック'=>{d=>60,a=>60},'パンチ'=>{d=>20,a=>70},}} ,{n=>'荒らし',h=>300,s=>0,w=>{'キック'=>{d=>100,a=>60},'パンチ'=>{d=>40,a=>70}} },{n=>'夏厨',h=>200,s=>20,w=>{'キック'=>{d=>80,a=>90},'パンチ'=>{d=>10,a=>100}} }]; http://medaka.5ch.net/test/read.cgi/php/1036141603/160
162: nobodyさん [sage] 03/08/19 11:57 ID:??? 縮めて CGI プログラムにした。これで彼も満足だろう。 #--- br.cgi --- #!/usr/local/bin/perl use CGI':all';put header(-charset=>($c='EUC-JP')),start_html(-lang=>ja,-title=> 'B.R.',-encoding=>$c);@p=@{do'br.dat'};sub e{splice@p,int rand@p,1}while(@p>1){ *o=e;*d=e;put p"$o{N}:$o{H} $d{N}:$d{H}";@w=keys%{$o{W}};$w=$w[int rand@w];($p, $a)=@{$o{W}{$w}}{D,A};put p("$o{N}は$wで攻撃!",(($p=($n=int rand 101)>$a?0:$n> $a/2?int($p/2)-$d{S}:$n>$a/20?$p-$d{S}:$p)>0or$p=0)?"$d{N}に$pポイントのダメー" .'ジ!':'ミス!');($d{H}-=$p)>0or put p"$d{N}を倒した!";push@p,\%o;$d{H}>0&&push @p,\%d}put p(pop(@p)->{N}, 'の勝利!'),end_html #--- br.dat --- [ {N=>'煽り', H=>400,S=>10,W=>{'キック'=>{D=>60, A=>60},'パンチ'=>{D=>20,A=>70 }}}, {N=>'荒らし',H=>300,S=>0, W=>{'キック'=>{D=>100,A=>60},'パンチ'=>{D=>40,A=>70 }}}, {N=>'夏厨', H=>200,S=>20,W=>{'キック'=>{D=>80, A=>90},'パンチ'=>{D=>10,A=>100}}}, ]; http://medaka.5ch.net/test/read.cgi/php/1036141603/162
163: nobodyさん [sage] 03/08/20 07:02 ID:??? メッセージを削るという安直な方法で七行達成。 #!/usr/local/bin/perl use CGI':all';put header(-charset=>($c='EUC-JP')),start_html -lang=>ja,-title=> BR,-encoding=>$c;@p=@{do'br.dat'};while(@p>1){put p map"$_->{N}:$_->{H}",@p;*d= splice@p,int rand@p,1;*o=$p[int rand@p];@w=keys%{$o{W}};($p,$a)=@{$o{W}{$w=$w[ int rand@w]}}{D,A};put p"$o{N}は$d{N}に$wで攻撃!",(($p=($n=int rand 100)>$a?0: $n>$a/2?int($p/2)-$d{S}:$n>$a/20?$p-$d{S}:$p)>0or$p=0)?"$pダメージ!":'ミス!';( $d{H}-=$p)>0?push@p,\%d:put p b"$d{N}を倒した!"}put p"$p[0]{N}の勝利!",end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/163
205: 7uploader [] 03/12/07 09:25 ID:enSfwhvY もっと詰めてからにしようと思ったけど、とりあえず公開します。後はよろしく:) #!/usr/bin/perl use CGI':all';$CGI::POST_MAX=1024*1000;chdir D;if($u=upload u){open F,">./$u"or die;binmode F;while(read$u,$b,1024){print F$b}close F}@f=sort{-M$a<=>-M$b}<*>;( ($_=param d)&&grep/^$_$/,@f)?do{open F,$_;put header(-Content_length=>-s, attachment=>$_,-type=>"application/octet-stream"),<F>}:do{put header,start_html ,start_multipart_form,filefield(u),submit,endform,hr,table({-border=>1},Tr[th([ qw/name size date/]),map{td([a({href,"?d=$_"},$_),-s,''.localtime((stat)[9])])} @f]),end_html} __END__ TODO [ ] 保存するファイル名のチェック。 uploadされたphpやshtmlが実行されるのを防止,や../等の対策。 [*] 出力するファイル名のチェック。 [ ] binary ファイルの取扱。(for windows) [ ] 他のブラウザへの対応。 http://medaka.5ch.net/test/read.cgi/php/1036141603/205
249: 246 [] 04/02/22 02:18 ID:Sgt6pnb3 >ライセンスの件 ... 自分が叩き台を出したとは言え、成果物はこのスレで参加者皆のものなので 出来れば他の方の意見も伺っておきたいのですが。特に異論がなければ、 >>248通り連絡不要/GPLという事にしたいと思います。 # もしくは、保守して下さってるサイトの管理者さんにお任せ。m(_ _ # 7vote use CGI':all';$p=POST;*P=*param;charset$c='EUC-JP';chdir V;($F)=P(f)=~/^(\d+)$/ ;if(open F,"+<$F"){eval{flock F,2};$t=<F>;while(<F>){if(/^(.+)\t(\d+)$/){$D{$1} =$2}}if(request_method==$p){($n=P(n))?$D{$n}||=1:($v=P(v))?$D{$v}++:0;seek F,0, 0;print F join("\n",$t,map{"$_\t$D{$_}"}keys%D)}}for(radio_group(v,[@K=sort{$D{ $b}<=>$D{$a}}keys%D])){$L{$K[$i++]}=$_}put header,start_html(title=>$t,encoding ,$c,lang,ja),h1($t),startform($p),table({},Tr[map{td["$L{$_}($D{$_})",hr{width =>$D{$_}}]}@K]),hr,textfield(n),hidden(f,$F,force=>1),submit,endform,end_html 設定方法 1) ディレクトリV を作る。 mkdir V;chdir V 2) 題名を書いたファイルを作る。echo "What is your native language" > 00001 # ファイル名は番号で。 3) chmod 0666 00001 # 必要に応じてパーミッションの設定 ./7vote.cgi?f=00001 # ブラウザからアクセス http://medaka.5ch.net/test/read.cgi/php/1036141603/249
263: nobodyさん [sage] 04/03/01 02:53 ID:??? >>262 >>1 一応こういうルールでやってます。 横79文字ってのは80文字-改行1文字ね。 http://medaka.5ch.net/test/read.cgi/php/1036141603/263
392: nobodyさん [sage] 2006/01/27(金) 22:18:05 ID:??? 7ナビ 同一階層以下のHTMLにリンクを貼る。携帯用サイトマップみたいなもん。 $d='./';$e='s?html?';$n=10;@l=(['prev',-1],['next',1]);use CGI':all';sub r{my( $d,$e)=@_;map{if(-d){r($_,$e)}elsif(/\.$e$/&&$p<=$c++&&$c<=$p+$n&&open F,$_){-B ||read F,$h,2**16;close F;$h=~/>\s*([^<>]*?)\s*<\/ti/is;[$_,$1||$_]}else{()}} <$d/*>}$p+=param 'p';($d)=$d=~/(.+?)[\\\/]*$/;@r=r$d,$e;if($p<0){$p=$c-$c%$n;$c =0;@r=r$d,$e}elsif(!@r){$p=0;$c=0;@r=r$d,$e}charset '';put header,dl dt(map a({ href=>"?p=".($p+$n*$_->[1])},$_->[0]),@l),dd{style=>'margin:0px'},join"\n",ol({ start=>1+$p},li[map a({href=>$_->[0]},$_->[1]),@r]),p"$c files" http://medaka.5ch.net/test/read.cgi/php/1036141603/392
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
アボンOFF
Google検索
Wikipedia
ぬこの手
ぬこTOP
1.206s*