赞
踩
首先,把常用的古风玛丽苏词汇存到数组...
- public static final String [] TWO_CHARS_WORDS =
- {"朱砂", "天下", "杀伐", "人家","韶华","风华","繁华", "血染", "墨染", "白衣",
- "素衣","嫁衣","倾城", "孤城","空城","旧城","旧人","伊人","春风","心醉","古琴",
- "无情","迷离","奈何","断弦","焚尽","散乱","陌路","乱世","笑靥","浅笑","明眸" ,
- "轻叹","烟火","一生","三生","浮生","桃花","梨花","落花","烟花","离殇 ","情殇",
- "爱殇", "剑殇","灼伤","仓皇","匆忙","陌上","清商","焚香","墨香","微凉","断肠",
- "痴狂","凄凉","黄梁","未央","成双","无恙","虚妄"," 凝霜","洛阳 ","长安","江南",
- "忘川","千年","纸伞","烟雨","回眸","公子 ","红尘 ","红颜","红衣","红豆","红线 ",
- "青丝","青史","青冢","白发","白首","白骨","黄土","黄泉","碧落","紫陌"};
-
- public static final String [] FOUR_CHARS_WORDS = {
- "情深缘浅","情深不寿","莫失莫忘","阴阳相隔","如花美眷","似水流年 ","眉目如画",
- "曲终人散","繁华落尽","不诉离殇","一世长安"};
- public static final String [] SENTENCE_MODEL = {
- "xxxx,xxxx,不过是一场xxxx。","你说xxxx,我说xxxx,最后不过xxxx。",
- "xx,xx,许我一场xxxx。 ","你说xxxxxxxx,后来xxxxxxxx。",
- "一x一x一xx,半x半x半xx。","xxxx,xxxx,终不敌xxxx。"};
定义一个生产诗句的方法,就是各种随机生成随机匹配,然后将xxxxxx这些给替换掉...
- public static String produceSentence() {
- Random rand = new Random();
- int randNum = rand.nextInt(SENTENCE_MODEL.length);
- String model = SENTENCE_MODEL[randNum];
- String result = "";
- result =
- model.replaceFirst("xxxx", FOUR_CHARS_WORDS[rand.nextInt(FOUR_CHARS_WORDS.length)]);
- result =
- result.replaceFirst("xxxx", FOUR_CHARS_WORDS[rand.nextInt(FOUR_CHARS_WORDS.length)]);
- result =
- result.replaceFirst("xxxx", FOUR_CHARS_WORDS[rand.nextInt(FOUR_CHARS_WORDS.length)]);
- result =
- result.replaceFirst("xx", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)]);
- result =
- result.replaceFirst("xx", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)]);
- result =
- result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
- result =
- result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
- result =
- result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
- result =
- result.replaceFirst("x", TWO_CHARS_WORDS[rand.nextInt(TWO_CHARS_WORDS.length)].charAt(rand.nextInt(2))+"");
- return result;
-
- }
- public static void main(String[] args) {
- for (int i = 0; i < 22; i++) {
- System.out.println(produceSentence());
- }
- }
好像还不错....
一离一眸一碧落,半灼半明半迷离。 你说莫失莫忘繁华落尽,后来阴阳相隔血染墨香。 阴阳相隔,曲终人散,不过是一场情深缘浅。 曲终人散,情深不寿,不过是一场曲终人散。 一浅一发一倾城,半笑半红半黄泉。 你说如花美眷,我说繁华落尽,最后不过莫失莫忘。 眉目如画,不诉离殇,不过是一场眉目如画。 古琴,公子 ,许我一场情深不寿。 似水流年 ,繁华落尽,终不敌繁华落尽。 墨染,青丝,许我一场曲终人散。 一世长安,不诉离殇,不过是一场不诉离殇。 一世长安,不诉离殇,终不敌眉目如画。 一公一香一墨香,半人半空半白首。 风华,虚妄,许我一场情深缘浅。 如花美眷,繁华落尽,不过是一场情深不寿。 你说如花美眷,我说似水流年 ,最后不过似水流年 。 你说繁华落尽,我说繁华落尽,最后不过莫失莫忘。 莫失莫忘,如花美眷,终不敌似水流年 。 阴阳相隔,情深不寿,终不敌如花美眷。 你说情深不寿,我说莫失莫忘,最后不过繁华落尽。 一忘一洛一旧人,半眸半离半黄土。 你说眉目如画一世长安,后来不诉离殇春风焚香。
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。