Help us understand the problem. What is going on with this article?

ズンドコキヨシ with D 供養

More than 3 years have passed since last update.

三番煎じです

ズンドコキヨシ with D by @kotet
ズンドコキヨシ with D by @cedretaber

コードゴルフ(目標:Twitterでpaiza_run可能)の残骸

※下記のコードは、見やすいように改行とインデントをつけてます。

D言語にパターンマッチがほしいよ編

見やすくて気に入ったけど
非推奨のmatchまで使うも縮まらず

D
import std.stdio,std.random,std.regex;
void main(){
  string s;
  while(!match(s,"(.ン){4}ド.$"))
    s~=dice(1,1)?"ドコ":"ズン";
  writeln(s,"キ・ヨ・シ!");
}

あと4文字が縮まらないよ編

必要最小限の標準ライブラリでやってみた
Twitterには貼れるけど、paiza_runまでは縮められず

D
//#paiza_run d:  ←コレガハイラナイ
import std.stdio,std.random;
void main(){
  dstring s;
  while(s[$>9?$-10:$..$]!="ズンズンズンズンドコ")
    s~=dice(1,1)?"ドコ":"ズン";
  writeln(s,"キ・ヨ・シ!");
}

番外編(UFCSしたいマン)

untilを見つけるまで、無限レンジを適当な所で切っていたよ
なかなかきれいに書けたけど文字数

D
import std.stdio,std.random,std.range,std.algorithm;
void main(){
  auto s=[0,0,0,0,1];
  writeln(
    generate!(()=>dice(1,1))
      .until(s)
      .chain(s)
      .map!`a?"ドコ":"ズン"`
      .join,
    "キ・ヨ・シ!"
  );
}

まとめ

こーどごるふを めざしたけど むしろ わんらいなーに ちかづいたよ
ふぉぼすが ぜんぶはいる import std みたいなのほしいよ(小並感)

nak2yoshi
D言語勉強中/ネコが好き
https://twitter.com/nak2yoshi
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした