-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
12,732 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} |
Oops, something went wrong.