2 "Morra" Binary
-
Thursday, January 22, 2009 1:58 PM
Is this code the best ?
'Programma MORRA 2
'Inizializza l'array (V) a 0
N=16
For i=1 to N
Array.SetValue("V",i,0)
EndFor
TextWindow.Write("Gioca 0.., Q per finire:")
G=TextWindow.read()
i=1
While G<>"Q"
x=0
if (Array.GetValue("V",i)<=Array.GetValue("V",i+1)) then
x=-1
EndIf
y=Math.Remainder(G,2)
TextWindow.Write(-x+","+y+" HA VINTO ")
T=0
IF x=-y Then
T=-1
EndIf
TextWindow.Write(text.GetSubText("UC",-t,1))
tc=tc-t
tu=tu+t+1
i=i+y
TextWindow.Write(" ! Vittorie: "+tc+">C "+tu+">U .. RiGioca :")
Array.SetValue("V",i,Array.GetValue("V",i)+1)
i=2*Math.Remainder(i,8)
G=TextWindow.read()
EndWhile
All Replies
-
Tuesday, October 30, 2012 8:07 AMOwner
-
Tuesday, October 30, 2012 1:55 PMAnswerer
How about this?
'Program MORRA 2 TextWindow.Write("Play 0..5, Q to finish:") nu = TextWindow.read() tc = 0 tu = 0 While (nu <> "Q") And (nu <> "q") nc = Math.GetRandomNumber(6) - 1 oc = Math.Remainder(nc, 2) ou = Math.Remainder(nu, 2) TextWindow.Write(nc + "(" + oc + ")," + nu + "(" + ou + ") ") If oc = ou Then TextWindow.Write("C") tc = tc + 1 Else TextWindow.Write("U") tu = tu + 1 EndIf TextWindow.Write(" WON! Wins: " + tc + "=C " + tu + "=U .. Replay:") nu = TextWindow.read() EndWhile
Nonki Takahashi
- Proposed As Answer by litdevMicrosoft Community Contributor, Moderator Tuesday, October 30, 2012 7:57 PM
- Marked As Answer by gungan37Editor Tuesday, November 06, 2012 2:54 AM

