From 30e837291ab31cd7e420348f2ddaa2ac6e52afb5 Mon Sep 17 00:00:00 2001 From: shashkevichfrida Date: Mon, 11 Dec 2023 17:37:23 +0300 Subject: [PATCH] change func PlayCraps --- Craps/config.json | 2 +- Craps/craps.go | 22 ++++++------ Craps/craps.nef | Bin 482 -> 630 bytes Player/go.mod | 4 --- Player/player.go | 73 ---------------------------------------- Player/player.yml | 11 ------ coin/coin_contract.go | 13 ------- coin/coin_contract.json | 1 - coin/coin_contract.nef | Bin 105 -> 0 bytes coin/config.yml | 5 --- coin/go.mod | 5 --- coin/go.sum | 2 -- 12 files changed, 12 insertions(+), 126 deletions(-) delete mode 100644 Player/go.mod delete mode 100644 Player/player.go delete mode 100644 Player/player.yml delete mode 100644 coin/coin_contract.go delete mode 100755 coin/coin_contract.json delete mode 100755 coin/coin_contract.nef delete mode 100644 coin/config.yml delete mode 100644 coin/go.mod delete mode 100644 coin/go.sum diff --git a/Craps/config.json b/Craps/config.json index dd3c74f..6a19ca8 100755 --- a/Craps/config.json +++ b/Craps/config.json @@ -1 +1 @@ -{"name":"Craps","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":165,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playCraps","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"firstSum","type":"Integer"},{"name":"secondSum","type":"Integer"}],"returntype":"Void","safe":false}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null} \ No newline at end of file +{"name":"Craps","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":313,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playCraps","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"firstSum","type":"Integer"},{"name":"secondSum","type":"Integer"}],"returntype":"Void","safe":false}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null} \ No newline at end of file diff --git a/Craps/craps.go b/Craps/craps.go index 4a06df6..b5def96 100644 --- a/Craps/craps.go +++ b/Craps/craps.go @@ -45,19 +45,19 @@ func PlayCraps(bet int, firstSum int, secondSum int) { } func isWinner(firstSum int, secondSum int) bool { - //if (!((firstSum >= 3 && firstSum <= 18) && (secondSum >= 3 && firstSum <= 18))){ - // panic("first and second sum should be from 3 to 18") - //} + crupNumber:="Crup number: " + rundomNumber:=" Random number: " + if (!((firstSum >= 3 && firstSum <= 18) && (secondSum >= 3 && firstSum <= 18))){ + panic("first and second sum should be from 3 to 18") + } - //sum := 0 + sum := 0 - //for i:=0; i<3; i++ { - // crap := rand.Intn(5) + 1 - // runtime.Notify("Crup number: %d,Random Number: %d", i+1, crap) - // sum += crap - //} - var sum int - sum = runtime.GetRandom() + for i:=0; i<3; i++ { + crap := (runtime.GetRandom() % 6) + 1 + runtime.Notify(crupNumber, i+1, rundomNumber, crap) + sum += crap + } return sum == firstSum || sum == secondSum } diff --git a/Craps/craps.nef b/Craps/craps.nef index a1321a3673312482d47b0889284b05334dff02c5..13c5cb19947f3824f944d49b438968c1827e7db5 100755 GIT binary patch delta 203 zcmaFF{EcOT7n2&(M4!5P9YzKQC7z7TirK-Y3P83)I2#iWuX9mpfkIwsZc=KIl|liJ zfI?7WUP^v0T&S=@*np#gL1>#2Gp8DVC4vLwuTnGM(N4=ODlSm~YEmdpP0j~VrMU{l z8Tq9-DGEuc3TZ_^!;BS5^34A+|_xUP-p#yv&?n;RB@^ ixdDz-8S@jfa^@9f&nZ^AnN^{|o;C6HXBKB+mjD0@r9S}x delta 55 zcmeyy@`!nY7t