{
  "id": "elmsley-count",
  "description": "Four-beat false count: on the second beat the counted card goes secretly under the packet while the next block of cards is taken as one; presents as an honest count of four",
  "labels": {
    "en": "Elmsley Count"
  },
  "atlas_ref": "technique:elmsley-count",
  "family_ref": "false-counts",
  "requires": [
    "source",
    "target"
  ],
  "parameters": {
    "block": {
      "required": false,
      "description": "Cards taken as one on beat two; source holds block + 2",
      "domain": "integer >= 2",
      "default": 2
    },
    "side": {
      "required": false,
      "description": "Side seen at each beat",
      "domain": [
        "face",
        "back",
        "visible"
      ],
      "default": "visible"
    }
  },
  "body": [
    {
      "verb": "registry:count",
      "source": "source",
      "target": "target",
      "arguments": {
        "count": 1,
        "side": {
          "param": "side"
        }
      }
    },
    {
      "simultaneous": [
        {
          "verb": "registry:load",
          "source": "target",
          "target": "source",
          "visibility": "hidden",
          "arguments": {
            "source_position": "bottom",
            "position": "bottom"
          }
        },
        {
          "verb": "registry:double-lift",
          "source": "source",
          "hand": "target",
          "arguments": {
            "count": {
              "param": "block"
            }
          }
        }
      ]
    },
    {
      "verb": "registry:display",
      "target": "target",
      "arguments": {
        "position": "top",
        "count": 1,
        "side": {
          "param": "side"
        },
        "mode": "individual"
      }
    },
    {
      "verb": "registry:count",
      "source": "source",
      "target": "target",
      "arguments": {
        "count": 1,
        "side": {
          "param": "side"
        }
      }
    },
    {
      "verb": "registry:count",
      "source": "source",
      "target": "target",
      "arguments": {
        "count": 1,
        "side": {
          "param": "side"
        }
      }
    }
  ],
  "net_contract": {
    "post_state_invariant": "Every card of source ends in target, in the order: first card, last card, then the block (cards 2..block+1); four single beats are shown: the first card, the block's top card, the last card, the first card again.",
    "post_state": {
      "state_schema_ref": "https://tamaraspec.org/schema/tcs-playing-cards-state-0.1.json",
      "effects": [
        {
          "op": "show",
          "subject": "source",
          "select": {
            "position": "top",
            "count": 2
          },
          "side": {
            "param": "side"
          },
          "mode": "individual"
        },
        {
          "op": "show",
          "subject": "source",
          "select": {
            "position": "bottom",
            "count": 1
          },
          "side": {
            "param": "side"
          },
          "mode": "individual"
        },
        {
          "op": "show",
          "subject": "source",
          "select": {
            "position": "top",
            "count": 1
          },
          "side": {
            "param": "side"
          },
          "mode": "individual"
        },
        {
          "op": "move",
          "select": {
            "all": true
          },
          "from": "source",
          "to": "target",
          "arrival": "block"
        },
        {
          "op": "move",
          "select": {
            "position": "second",
            "count": {
              "param": "block"
            }
          },
          "from": "target",
          "to": "target",
          "arrival": "block",
          "at": "bottom"
        }
      ]
    }
  },
  "presents_as": "count",
  "presents_as_parameters": {
    "count": 4,
    "side": {
      "param": "side"
    }
  },
  "examples": [
    {
      "arguments": {},
      "piles": {
        "source": [
          "A",
          "B",
          "C",
          "D"
        ],
        "target": []
      },
      "expect": {
        "piles": {
          "source": [],
          "target": [
            "A",
            "D",
            "B",
            "C"
          ]
        },
        "shown": [
          "A",
          "B",
          "D",
          "A"
        ],
        "deceptive_in": [
          "state",
          "trace"
        ]
      }
    },
    {
      "arguments": {
        "block": 3
      },
      "piles": {
        "source": [
          "A",
          "B",
          "C",
          "D",
          "E"
        ],
        "target": []
      },
      "expect": {
        "piles": {
          "source": [],
          "target": [
            "A",
            "E",
            "B",
            "C",
            "D"
          ]
        },
        "shown": [
          "A",
          "B",
          "E",
          "A"
        ],
        "deceptive_in": [
          "state",
          "trace"
        ]
      }
    }
  ]
}