equal
deleted
inserted
replaced
36 |
36 |
37 protected ArrayList<Batch> numberIntoSlotField(Slot targetSlot, int number) |
37 protected ArrayList<Batch> numberIntoSlotField(Slot targetSlot, int number) |
38 { |
38 { |
39 ArrayList<Batch> retArray = new ArrayList<Batch>(); |
39 ArrayList<Batch> retArray = new ArrayList<Batch>(); |
40 |
40 |
41 retArray.addAll(smartAlg(0, number, targetSlot)); |
41 if(number == 0){ |
42 |
42 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), targetSlot)); |
|
43 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), targetSlot)); |
|
44 }else{ |
|
45 retArray.addAll(smartAlg(0, number, targetSlot)); |
|
46 } |
43 return retArray; |
47 return retArray; |
44 } |
48 } |
45 |
49 |
46 |
50 |
47 protected ArrayList<Batch> stupidAlg(int begin, int end, Slot targetSlot){ |
51 protected ArrayList<Batch> stupidAlg(int begin, int end, Slot targetSlot){ |
62 |
66 |
63 if(begin == 0){ |
67 if(begin == 0){ |
64 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), targetSlot)); |
68 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Put(), targetSlot)); |
65 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), targetSlot)); |
69 retArray.add(new Batch(OperationType.SLOT_TO_CARD, new Zero(), targetSlot)); |
66 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Succ(), targetSlot)); |
70 retArray.add(new Batch(OperationType.CARD_TO_SLOT, new Succ(), targetSlot)); |
|
71 |
|
72 if(end == 0) |
|
73 return retArray; |
67 } |
74 } |
68 |
75 |
69 List<Batch> list1 = buildNumberOperations(0, end, targetSlot); |
76 List<Batch> list1 = buildNumberOperations(0, end, targetSlot); |
70 List<Batch> list2 = buildNumberOperations(begin, end, targetSlot); |
77 List<Batch> list2 = buildNumberOperations(begin, end, targetSlot); |
71 if (list1.size() <= list2.size()) |
78 if (list1.size() <= list2.size()) |