CR 北斗無双1/319 Javaで作ってみた。

2019/4/1からポリテクセンターでJavaを1ヶ月学び、パチンコの北斗無双をJavaで作ってみました。
クラスはHMusouクラスとmainクラスの二つのみ。
mainクラスでHMusouインスタンス生成時に、引数の2番目が通常時の回転数、三番目が1000円当たりの回転数となるので、こちらの条件を変えれば、北斗無双のシュミレートが出来ます。
条件としては、等価交換の設定で、全て現金投資で行い、最終的に

結果 = (出玉を4円で交換した金額) ー (使った金額)

としています。 

--------------------------------------------------------------------------------------------
import java.util.Random;

public class HMusou {

Random r1 = new Random();
Random r2 = new Random();
Random r3 = new Random();
Random r4 = new Random();
Random r5 = new Random();
Random r6 = new Random();

//スペック
final static int R4 = 500; //4R出玉入力
final static int R6 = 800; //6R出玉
final static int R8 = 1100;//8R出玉
final static int R16 = 2300;//16R出玉
final static int lucky=320; //初当たり確率
final static int STrush = 50; //ST突入率
final static int STcount = 130; //ST回数
final static int STcontinuation = 80; //ST継続率
final static int SThit = 81; //ST中当選確率
final static int fourRR = 36; //幻闘BONUS 4R 割合%
final static int charge4 = 6; //七星CHARGE 4R 割合
final static int charge8 = 7;//七星CHARGE 8R 割合
final static int charge16 = 1; //七星CHARGE 16R%
final static int sixteenRR = 50; //北斗無双BONUS %

//データカウンタ
static int MaxST =0;
static int totalST = 0;
static int totalThrough =0;
static int mochidama=0;
static int total=0; //通常初当たり回数
static int Rtotal=0; //時短引き戻し回数
static int K =0; //ST初当たり回数

//シュミレート条件
static int n ; //通常時の合計回転数
static int m ; //1000円当たりの回転数

public HMusou(int mochidama,int n,int m) {

this.mochidama = mochidama;
this.n = n;
this.m= m;
}

//通常時の処理
public void normal() {

for(int i = 1;i<n;i++) {
if(r1.nextInt(lucky) == r2.nextInt(lucky) ) {
total += 1;
System.out.println("初当たり。当選ゲーム数は"+i+"です。");
mochidama += R6;
if(r3.nextInt(100/STrush) == r4.nextInt(100/STrush)) {
System.out.print("確変突入。");
K ++;
ST();
}else {
System.out.println("時短でした");
for(int t=1;t<101;t++) {

if(r5.nextInt(lucky) == r6.nextInt(lucky) ) {
   Rtotal += 1;
   System.out.print("時短中に"+t+"Gで当選。");
           System.out.println("時短中に当たりなので確変突                                                     入");
   mochidama += R6;
   K ++;
   ST();
}
}

}
}
}
}

//ST中の処理
public void ST () {

Random v = new Random();
Random w = new Random();
Random x = new Random();
int i =0;

for(int n =1;  n<STcount;n ++) {
int s= v.nextInt(SThit);
int u= w.nextInt(SThit);

if(s == u ) {
//System.out.println("  "+s +":"+ u +"  ST中に当たり");
int t = x.nextInt(101);
if(t<=fourRR) {
System.out.println("幻闘BONUS 4R");
mochidama += R4;
}else if (t<=(fourRR+charge4)) {
System.out.println("七星CHRGE 4R");
mochidama += R4;
}else if (t<=(fourRR +charge4 +charge8)) {
System.out.println("七星CHRGE 8R");
mochidama += R8;
}else if(t<=(fourRR + charge4 + charge8 +charge16)) {
System.out.println("七星CHRGE 16R");
mochidama += R16;
}else {
System.out.println("北斗無双BONUS 16R");
mochidama += R16;
}
totalST ++;
i ++;
n=1;
}
}

if(i==0) {
System.out.println();
System.out.println("しかし、"+STcontinuation+"%をスルーしました。");
totalThrough ++;
System.out.println();
}else {
System.out.println("STを抜けました");
if(MaxST < i) {
MaxST = i;
}
}
System.out.println("ST中に獲得した累計玉数は"+mochidama+"です");
System.out.println();
}

public void show() {

System.out.println();
System.out.println("初当たり回数は"+ total +"です。");
System.out.println("確変突入回数は"+K + "です。");
System.out.println("時短中当選回数は"+Rtotal + "です。");
System.out.println("合計当たり回数は"+ (total+totalST) +"です。");
System.out.println("ST中最大連チャン数は"+MaxST+"です");
System.out.println("ST中のスルー回数は"+totalThrough+"でした");
System.out.println("ST中の平均継続回数は"+(totalST/K)+"でした");
System.out.println();
System.out.println("結果は"+(mochidama*4-n/m*1000) + "円です。");
System.out.println("初当たりは1/"+(String.format("%.0f",(double)n/total)) + "です。");
}
}
--------------------------------------------------------------------------------------------

public class main {

public static void main(String[] args) {

HMusou musou = new HMusou(0,2000,16); //(初期の持ち玉、通常時の回転数、1000円当たりの回転数)

musou.normal();
musou.show();

}
}
--------------------------------------------------------------------------------------------


コメント