当前位置:   article > 正文

【娱乐向】Java古风玛丽苏诗句生成器_古风词句生成器

古风词句生成器

首先,把常用的古风玛丽苏词汇存到数组...

  1. public static final String [] TWO_CHARS_WORDS =
  2. {"朱砂", "天下", "杀伐", "人家","韶华","风华","繁华", "血染", "墨染", "白衣",
  3. "素衣","嫁衣","倾城", "孤城","空城","旧城","旧人","伊人","春风","心醉","古琴",
  4. "无情","迷离","奈何","断弦","焚尽","散乱","陌路","乱世","笑靥","浅笑","明眸" ,
  5. "轻叹","烟火","一生","三生","浮生","桃花","梨花","落花","烟花","离殇 ","情殇",
  6. "爱殇", "剑殇","灼伤","仓皇","匆忙","陌上","清商","焚香","墨香","微凉","断肠",
  7. "痴狂","凄凉","黄梁","未央","成双","无恙","虚妄"," 凝霜","洛阳 ","长安","江南",
  8. "忘川","千年","纸伞","烟雨","回眸","公子 ","红尘 ","红颜","红衣","红豆","红线 ",
  9. "青丝","青史","青冢","白发","白首","白骨","黄土","黄泉","碧落","紫陌"};
  10. public static final String [] FOUR_CHARS_WORDS = {
  11. "情深缘浅","情深不寿","莫失莫忘","阴阳相隔","如花美眷","似水流年 ","眉目如画",
  12. "曲终人散","繁华落尽","不诉离殇","一世长安"};


常见句型,也不过这几种...


  1. public static final String [] SENTENCE_MODEL = {
  2. "xxxx,xxxx,不过是一场xxxx。","你说xxxx,我说xxxx,最后不过xxxx。",
  3. "xx,xx,许我一场xxxx。 ","你说xxxxxxxx,后来xxxxxxxx。",
  4. "一x一x一xx,半x半x半xx。","xxxx,xxxx,终不敌xxxx。"};


定义一个生产诗句的方法,就是各种随机生成随机匹配,然后将xxxxxx这些给替换掉...

  1. public static String produceSentence() {
  2. Random rand = new Random();
  3. int randNum = rand.nextInt(SENTENCE_MODEL.length);
  4. String model = SENTENCE_MODEL[randNum];
  5. String result = "";
  6. result =
  7. model.replaceFirst("xxxx", FOUR_CHARS_WORDS[rand.nextInt(FOUR_CHARS_WORDS.length)]);
  8. result =
  9. result.replaceFirst("xxxx", FOUR_CHARS_WORDS[rand.nextInt(FOUR_CHARS_WORDS.length)]);
  10. result =
  11. result.replaceFirst("xxxx", FOUR_CHARS_WORDS[rand.nextInt(FOUR_CHARS_WORDS.length)]);
  12. result =
  13. result.replaceFirst("xx", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)]);
  14. result =
  15. result.replaceFirst("xx", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)]);
  16. result =
  17. result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
  18. result =
  19. result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
  20. result =
  21. result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
  22. result =
  23. result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
  24. return result;
  25. }


然后,你就拥有了一个会写22行古风玛丽苏诗句的生成器...

  1. public static void main(String[] args) {
  2. for (int i = 0; i < 22; i++) {
  3. System.out.println(produceSentence());
  4. }
  5. }


好像还不错....

  1. 一离一眸一碧落,半灼半明半迷离。
  2. 你说莫失莫忘繁华落尽,后来阴阳相隔血染墨香。
  3. 阴阳相隔,曲终人散,不过是一场情深缘浅。
  4. 曲终人散,情深不寿,不过是一场曲终人散。
  5. 一浅一发一倾城,半笑半红半黄泉。
  6. 你说如花美眷,我说繁华落尽,最后不过莫失莫忘。
  7. 眉目如画,不诉离殇,不过是一场眉目如画。
  8. 古琴,公子 ,许我一场情深不寿。
  9. 似水流年 ,繁华落尽,终不敌繁华落尽。
  10. 墨染,青丝,许我一场曲终人散。
  11. 一世长安,不诉离殇,不过是一场不诉离殇。
  12. 一世长安,不诉离殇,终不敌眉目如画。
  13. 一公一香一墨香,半人半空半白首。
  14. 风华,虚妄,许我一场情深缘浅。
  15. 如花美眷,繁华落尽,不过是一场情深不寿。
  16. 你说如花美眷,我说似水流年 ,最后不过似水流年 。
  17. 你说繁华落尽,我说繁华落尽,最后不过莫失莫忘。
  18. 莫失莫忘,如花美眷,终不敌似水流年 。
  19. 阴阳相隔,情深不寿,终不敌如花美眷。
  20. 你说情深不寿,我说莫失莫忘,最后不过繁华落尽。
  21. 一忘一洛一旧人,半眸半离半黄土。
  22. 你说眉目如画一世长安,后来不诉离殇春风焚香。

不行了我尴尬癌犯了.. _(:з」∠)_


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/375919
推荐阅读
相关标签
  

闽ICP备14008679号