• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

練習用です。いろんなものがごちゃまぜです。


コミットメタ情報

リビジョン399 (tree)
日時2018-08-04 11:57:18
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- MaxCoins/MaxCoins/CoinsSet.vb (revision 398)
+++ MaxCoins/MaxCoins/CoinsSet.vb (revision 399)
@@ -59,12 +59,12 @@
5959 Next
6060 End Sub
6161
62- Public Sub DecKeta()
62+ Public Sub DecKeta(ByVal useCoin As CoinsSet)
6363 For i As Integer = 0 To typeMaxNum.Count - 1
6464 If 0 < Me._coinNum(i) Then
6565 Me._coinNum(i) = 0
6666 For j = 0 To i - 1
67- Me._coinNum(j) = typeMaxNum(j)
67+ Me._coinNum(j) = useCoin.CoinNum(j)
6868 Next
6969 Exit For
7070 End If
--- MaxCoins/MaxCoins/Generator.vb (revision 398)
+++ MaxCoins/MaxCoins/Generator.vb (revision 399)
@@ -9,8 +9,8 @@
99 Dim chargeCoin = useCoin.subs(moneyCoin)
1010 Dim mcPair = New MoneyChangePair(moneyCoin, chargeCoin)
1111 Register.GetInstance.Regist(mcPair)
12- moneyCoin.DecKeta()
13-
12+ moneyCoin.DecKeta(useCoin)
13+ Console.WriteLine(mcPair)
1414 End While
1515
1616 useCoin.dec()
--- MaxCoins/MaxCoins/Module1.vb (revision 398)
+++ MaxCoins/MaxCoins/Module1.vb (revision 399)
@@ -3,7 +3,7 @@
33 Sub Main()
44 Dim g As New Generator
55 g.generate()
6- Register.GetInstance.Disp()
6+ ' Register.GetInstance.Disp()
77 End Sub
88
99 End Module
--- MaxCoins/MaxCoins/MoneyChangePair.vb (revision 398)
+++ MaxCoins/MaxCoins/MoneyChangePair.vb (revision 399)
@@ -15,6 +15,14 @@
1515 End Function
1616
1717 Public Overrides Function ToString() As String
18- Return $"{money},{change}"
18+ Dim sb = New Text.StringBuilder
19+ sb.Append(Value())
20+ sb.Append(",")
21+ sb.Append(CoinSumNum())
22+ sb.Append(":")
23+ sb.Append(money)
24+ sb.Append("-")
25+ sb.Append(change)
26+ Return sb.ToString
1927 End Function
2028 End Class
--- MaxCoins/MaxCoins/Register.vb (revision 398)
+++ MaxCoins/MaxCoins/Register.vb (revision 399)
@@ -27,10 +27,7 @@
2727
2828 Sub Disp()
2929 For Each p In dic
30- Console.Write(p.Key)
31- Console.Write(",")
32- Console.Write(p.Value.CoinSumNum)
33- Console.WriteLine()
30+
3431 Next
3532 End Sub
3633
--- MaxCoins/UnitTestProject1/CoinsSetTest.vb (revision 398)
+++ MaxCoins/UnitTestProject1/CoinsSetTest.vb (revision 399)
@@ -47,8 +47,8 @@
4747 <TestMethod()> Public Sub ValueTest()
4848 Dim cs1 = CoinsSet.GetMaxCoins()
4949 Assert.AreEqual(1999, cs1.Value)
50- cs1.DecKeta()
51- cs1.DecKeta()
50+ cs1.DecKeta(CoinsSet.GetMaxCoins())
51+ cs1.DecKeta(CoinsSet.GetMaxCoins())
5252 Assert.AreEqual(1994, cs1.Value)
5353 End Sub
5454
@@ -60,8 +60,8 @@
6060 cs2.dec()
6161 Dim cs4 = cs1.subs(cs2)
6262 Assert.AreEqual(1, cs4.Value)
63- cs2.DecKeta()
64- cs2.DecKeta()
63+ cs2.DecKeta(CoinsSet.GetMaxCoins())
64+ cs2.DecKeta(CoinsSet.GetMaxCoins())
6565 Assert.AreEqual(1999, cs1.Value)
6666 Assert.AreEqual(1994, cs2.Value)
6767 Dim cs5 = cs1.subs(cs2)
@@ -68,6 +68,11 @@
6868 Assert.AreEqual(5, cs5.Value)
6969 Assert.AreEqual(1999, cs1.Value)
7070 Assert.AreEqual(1994, cs2.Value)
71+
72+ Dim cs6 = New CoinsSet({4, 1, 4, 1, 4, 1, 1})
73+ Dim cs7 = New CoinsSet({4, 0, 4, 1, 4, 1, 1})
74+ Dim cs8 = cs6.subs(cs7)
75+ Assert.AreEqual(5, cs8.Value)
7176 End Sub
7277
7378 Public Function CoinSetEqual(cs1 As CoinsSet, cs2 As CoinsSet)