daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Apr 22nd, 2018 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. contract makePlayer(return) {
  2.    new getFriends, setFriends in {
  3.       MakeCell!([], *getFriends, *setFriends)
  4.  
  5.       contract endorse(@subject, @level, return) {
  6.           for(@friends <- getFriends) {
  7.             setFriends!([[subject, level], friends], return)
  8.            }
  9.       }
  10.  
  11.      contract myFriends(level, return) {
  12.          for (@friends <- getFriends) {  return!([f for [f, l] in friends if l == level]) }  // IOU rholang comprehension
  13.      }
  14.  
  15.      contract readOnlyFacet (return) {
  16.         return!myFriends
  17.      }
  18. }
  19.  
  20.  
  21. contract makeGameBoard(return) {
  22.    new getPlayers, setPlayers in {
  23.        MakeCell([], *getPlayers, *setPlayers)
  24.  
  25.         contract registerPlayer(player, return) {
  26.             for(players <- getPlayers) { setPlayers([player, players], return) }
  27.          }
  28.  
  29.       contract listPlayers(return) {
  30.           return!getPlayers
  31.       }
  32.  
  33.       contract getCerts(level, return) {
  34.          // ouch.
  35.       }
  36. }
RAW Paste Data
Top