Skip to content

Commit

Permalink
初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanmi-s committed Mar 11, 2019
1 parent 518b2db commit bb5391d
Show file tree
Hide file tree
Showing 18 changed files with 12,732 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea
*.iml
Binary file added lib/x64/opencv_java341.dll
Binary file not shown.
Binary file added lib/x86/opencv_java341.dll
Binary file not shown.
42 changes: 42 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mk</groupId>
<artifactId>mahjong</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
<dependency>
<groupId>opencv</groupId>
<artifactId>opencv</artifactId>
<scope>system</scope>
<systemPath>${basedir}/lib/opencv-341.jar</systemPath>
</dependency>
</dependencies>


</project>
45 changes: 45 additions & 0 deletions src/main/java/com/mk/Image.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.mk;

import lombok.Data;

@Data
public class Image {
private boolean[][] RGB;
private int width;
private int height;
private int total;
private int effective;
private float rate;
private String name;

public Image(boolean[][] RGB,String name) {
this.name = name;
this.RGB = RGB;
width = RGB[0].length;
height = RGB.length;
total = width * height;
effective = 0;
for (boolean[] booleans : RGB) {
for (boolean b : booleans) {
if (b)
effective++;
}
}
rate = (float) effective / total;
}

public boolean get(int height, int width) {
return RGB[height][width];
}

@Override
public String toString() {
return "Image{" +
"width=" + width +
", height=" + height +
", total=" + total +
", effective=" + effective +
", rate=" + rate +
'}';
}
}
14 changes: 14 additions & 0 deletions src/main/java/com/mk/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mk;

import com.mk.util.Shoupai;

import java.util.ArrayList;

public class Main {
public static void main(String [] args){
long now =System.currentTimeMillis();
Shoupai shoupai = new Shoupai("1468m24667889p1s1z");
System.out.println(shoupai.getRes());
System.out.println(System.currentTimeMillis() - now);
}
}
76 changes: 76 additions & 0 deletions src/main/java/com/mk/Pai.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.mk;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class Pai implements Comparable{
private int index;
private int xts;
private int jzs;
private Map<Integer,Integer> jz= new HashMap<>();

public Pai(int index) {
this.index = index;
}

@Override
public String toString() {
return map(index) +
" " + xts +
" " + jzs +
" " + jz;
}


@Override
public int compareTo(Object o) {
Pai t = (Pai) o;

if (jzs != t.jzs)
return t.jzs - jzs ;
boolean z = index>30;
boolean tz = t.index>30;
if (z && !tz)
return -1;
else if (!z && tz)
return 1;

int i = index % 10;
int ti = t.index % 10;
return Math.abs(ti - 5) - Math.abs(i - 5) ;
}

public static String map(int index){
int type = index / 10;
int num = index % 10;
switch (type){
case 0:
return num + "万";
case 1:
return num + "筒";
case 2:
return num + "索";
case 3:
switch (num){
case 1:
return " 东";
case 2:
return " 南";
case 3:
return " 西";
case 4:
return " 北";
case 5:
return " 白";
case 6:
return " 发";
case 7:
return " 中";
}
}
return "error";
}
}
Loading

0 comments on commit bb5391d

Please sign in to comment.