In this tutorial-link(Algorand Blockchain Development using Reach Part 2 RPS | Algorand Developer Portal) I put …/reach init. It created two files index.rsh and index.mjs.Then I edit these default files with the tutorial 2 code given.
Edited index.rsh:
'reach 0.1';
const Player = {
getHand:Fun([],UInt),
seeOutcome:Fun([UInt],Null)
};
export const main = Reach.App(
{}, [['Alice', Player], ['Bob', Player]], (A, B) => {
A.only(() => {
const handA = declassify(interact.getHand());
});
A.publish(handA);
commit();
B.only(() => {
const handB = declassify(interact.getHand());
});
B.publish(handB);
const outcome = (handA + (4 - handB)) % 3;
commit();
each([A, B], () => {
interact.seeOutcome(outcome);
});
});
Edited index.mjs:
import {loadStdlib} from '@reach-sh/stdlib';
import * as backend from './build/index.main.mjs';
(async () => {
const stdlib = await loadStdlib();
const startingBalance = stdlib.parseCurrency(100);
const alice = await stdlib.newTestAccount(startingBalance);
const bob = await stdlib.newTestAccount(startingBalance);
const ctcAlice = alice.deploy(backend);
const ctcBob = bob.attach(backend, ctcAlice.getInfo());
const HAND = ['Rock', 'Paper', 'Scissors'];
const OUTCOME = ['Bob wins', 'Draw', 'Alice wins'];
const Player = (Who) => ({
getHand: () => {
const hand = Math.floor(Math.random() * 3);
console.log(`${Who} played ${HAND[hand]}`);
return hand;
},
seeOutcome: (outcome) => {
console.log(`${Who} saw outcome ${OUTCOME[outcome]}`);
},
});
await Promise.all([
backend.Alice(
stdlib, ctcAlice,
Player('Alice'),
),
backend.Bob(
stdlib, ctcBob,
Player('Bob'),
),
]);
})();
But I compile these command …/reach compile.It shows
harish030@harish:~/reach/AlgoReach/re$ ../reach compile
WARNING: Declaring Participants with a tuple is now deprecated. Please use `Participant(name, interface)` or `ParticipantClass(name, interface)` at /app/index.rsh:7:8:tuple
WARNING: Declaring Participants with a tuple is now deprecated. Please use `Participant(name, interface)` or `ParticipantClass(name, interface)` at /app/index.rsh:7:27:tuple
Verifying knowledge assertions
Verifying for generic connector
Verifying when ALL participants are honest
Verifying when NO participants are honest
Verifying when ONLY "Alice" is honest
Verifying when ONLY "Bob" is honest
Checked 10 theorems; No failures!
This is the default files output. I want the current edited code output. Can anyone help me, please?