-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backend/shuffle #135 #142
Backend/shuffle #135 #142
Conversation
import java.util.Arrays; | ||
import java.util.Random; | ||
|
||
public class shuffle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要可以支援不同類型的洗牌
import java.util.Random; | ||
|
||
public class shuffle { | ||
static void shuffle(int array[], int a) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通常都是寫 int[] array,但這邊用 List 好了, 然後 a 是什麼XD 命名要注意
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哈 我的意思是放 List XDD,可以支援不同類型
System.out.println(Arrays.toString(array)); | ||
} | ||
|
||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
測試完 這些可以拿掉
array[j] = temp; | ||
} | ||
|
||
System.out.println(Arrays.toString(array)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這個也可以拿掉
import java.util.Arrays; | ||
import java.util.Random; | ||
|
||
public class shuffle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class 叫 CitadelsUtils 好了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這要放在 domain 下?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
放在 domain 可能比較好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
import java.util.List; | ||
import java.util.Random; | ||
|
||
public class CitadelsUtils<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這裡不需要泛型
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這個類別要移動到 domain 那一個 package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
T temp = cards.get(i); | ||
cards.set(i, cards.get(j)); | ||
cards.set(j,temp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要排版一下喔~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.