1- pragma solidity ^ 0.4.25 ;
1+ pragma solidity >= 0.4.25 < 0.6.0 ;
22
33contract Starter
44{
@@ -8,10 +8,10 @@ contract Starter
88
99 string public PingPongGameName;
1010 address public GameStarter;
11- address public GamePlayer;
11+ Player public GamePlayer;
1212 int public PingPongTimes;
1313
14- constructor (string gameName ) public {
14+ constructor (string memory gameName ) public {
1515 PingPongGameName = gameName;
1616 GameStarter = msg .sender ;
1717
@@ -20,30 +20,28 @@ contract Starter
2020 State = StateType.GameProvisioned;
2121 }
2222
23- function StartPingPong (int pingPongTimes ) public
23+ function StartPingPong (int pingPongTimes ) public
2424 {
2525 PingPongTimes = pingPongTimes;
2626
27- Player player = Player (GamePlayer);
2827 State = StateType.Pingponging;
2928
30- player .Ping (pingPongTimes);
29+ GamePlayer .Ping (pingPongTimes);
3130 }
3231
33- function Pong (int currentPingPongTimes ) public
32+ function Pong (int currentPingPongTimes ) public
3433 {
35- currentPingPongTimes = currentPingPongTimes - 1 ;
34+ int remainingPingPongTimes = currentPingPongTimes - 1 ;
3635
37- Player player = Player (GamePlayer);
38- if (currentPingPongTimes > 0 )
36+ if (remainingPingPongTimes > 0 )
3937 {
4038 State = StateType.Pingponging;
41- player .Ping (currentPingPongTimes );
39+ GamePlayer .Ping (remainingPingPongTimes );
4240 }
4341 else
4442 {
4543 State = StateType.GameFinished;
46- player .FinishGame ();
44+ GamePlayer .FinishGame ();
4745 }
4846 }
4947
@@ -62,22 +60,22 @@ contract Player
6260 address public GameStarter;
6361 string public PingPongGameName;
6462
65- constructor (string pingPongGameName ) public {
63+ constructor (string memory pingPongGameName ) public {
6664 GameStarter = msg .sender ;
6765 PingPongGameName = pingPongGameName;
6866
6967 State = StateType.PingpongPlayerCreated;
7068 }
7169
72- function Ping (int currentPingPongTimes ) public
70+ function Ping (int currentPingPongTimes ) public
7371 {
74- currentPingPongTimes = currentPingPongTimes - 1 ;
72+ int remainingPingPongTimes = currentPingPongTimes - 1 ;
7573
7674 Starter starter = Starter (msg .sender );
77- if (currentPingPongTimes > 0 )
75+ if (remainingPingPongTimes > 0 )
7876 {
7977 State = StateType.PingPonging;
80- starter.Pong (currentPingPongTimes );
78+ starter.Pong (remainingPingPongTimes );
8179 }
8280 else
8381 {
0 commit comments