Fix notify

This commit is contained in:
shashkevichfrida 2023-12-16 20:26:51 +03:00
parent ef68d904ab
commit a85d8b4a97
12 changed files with 63956 additions and 20 deletions

View file

@ -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":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":[{"pubkey":"027171df30177d401c638fb2ddc14f9dbda323291e363ba4f7c3b19a8b44c8ba0a","signature":"BK6YPJGG/GLKsVxdPra+Ti4p7Q2D502dzz8FXV8kYntGrd4IigAyXR4do0pUPLRBnZHUqZXpPo7+jkQko/hCIQ=="}],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
{"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":[{"name":"Crup number","parameters":[{"name":"int","type":"Integer"}]},{"name":"Random number","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}

View file

@ -43,17 +43,15 @@ func PlayCraps(bet int, firstSum int, secondSum int) {
}
func isWinner(firstSum int, secondSum int) bool {
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")
if (!((firstSum >= 2 && firstSum <= 12) && (secondSum >= 2 && firstSum <= 12))){
panic("first and second sum should be from 2 to 12")
}
sum := 0
for i:=0; i<3; i++ {
for i:=0; i<2; i++ {
crap := (runtime.GetRandom() % 6) + 1
runtime.Notify(crupNumber, i+1, rundomNumber, crap)
runtime.Notify("Crup number", i+1)
runtime.Notify("Random number", crap)
sum += crap
}

Binary file not shown.

View file

@ -1,5 +1,15 @@
name: Craps
supportedstandards: []
events:
- name: "Crup number"
parameters:
- name: "int"
type: "Integer"
- name: "Random number"
parameters:
- name: "int"
type: "Integer"
permissions:
- methods: '*'
- methods: '*'
events:
- "Crup number"

View file

@ -42,9 +42,8 @@ func PlayRoulette(bet int, selectedNumber int) {
}
func isWinner(selectedNumber int) bool {
rouletteNumberMes := "Roulette number: "
rouletteNumber := (runtime.GetRandom() % 36) + 1
runtime.Notify(rouletteNumberMes, rouletteNumber)
runtime.Notify("rouletteNumber", rouletteNumber)
return rouletteNumber == selectedNumber
}

View file

@ -1 +1 @@
{"name":"Roulette","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":225,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playRoulette","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"selectedNumber","type":"Integer"}],"returntype":"Void","safe":false}],"events":[]},"features":{},"groups":[{"pubkey":"027171df30177d401c638fb2ddc14f9dbda323291e363ba4f7c3b19a8b44c8ba0a","signature":"FcCvRQaSYi8vaeDWGYxyHVclTxuuvTX5SagRGaoz018rX579K1GGi13EVJHix9iADDni/QSYOPNxH6Y2RzxXpA=="}],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
{"name":"Roulette","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":220,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playRoulette","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"selectedNumber","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"rouletteNumber","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}

Binary file not shown.

View file

@ -1,5 +1,11 @@
name: Roulette
supportedstandards: []
events:
- name: "rouletteNumber"
parameters:
- name: "int"
type: "Integer"
permissions:
- methods: '*'
- methods: '*'
events:
- "rouletteNumber"

View file

@ -1 +1,2 @@
{"name":"SlotMashine","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":548,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"rollSlot","offset":95,"parameters":[{"name":"bet","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"wheelNumber","parameters":[{"name":"int","type":"Integer"}]},{"name":"value","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}

View file

@ -34,7 +34,7 @@ func _deploy(data interface{}, isUpdate bool) {
func RollSlot(bet int) {
ctx := storage.GetContext()
playerOwner := runtime.GetScriptContainer().Sender
res := Roll()
res := roll()
if (res == 0){
changePlayerBalance(ctx, playerOwner, -bet)
} else {
@ -43,17 +43,19 @@ func RollSlot(bet int) {
}
}
func Roll() int {
wheelNumber:="Wheel number: "
value:=" Value: "
func roll() int {
firstWheel := (runtime.GetRandom() % 8) + 1
runtime.Notify(wheelNumber, 1, value, firstWheel)
runtime.Notify("wheelNumber", 1)
runtime.Notify("value", firstWheel)
secondWheel := (runtime.GetRandom() % 8) + 1
runtime.Notify(wheelNumber, 2, value, secondWheel)
runtime.Notify("wheelNumber", 2)
runtime.Notify("value", secondWheel)
thirdWheel := (runtime.GetRandom() % 8) + 1
runtime.Notify(wheelNumber, 3, value, thirdWheel)
runtime.Notify("wheelNumber", 3)
runtime.Notify("value", thirdWheel)
if (firstWheel == secondWheel && firstWheel == thirdWheel){
return firstWheel

Binary file not shown.

63920
log.log Normal file

File diff suppressed because it is too large Load diff