Punchcard Reader: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 36: | Line 36: | ||
! shiftCards !! Action | ! shiftCards !! Action | ||
|- | |- | ||
| false || Returns the contents of the card in the reader slot, or errors if none exists | | <code>false</code> || Returns the contents of the card in the reader slot, or errors if none exists | ||
|- | |- | ||
| true || Shifts the cards downwards if reader slot is empty, then performs a regular read, then shifts again. If a card was already in the slot, the initial shift is skipped | | <code>true</code> || Shifts the cards downwards if reader slot is empty, then performs a regular read, then shifts again. If a card was already in the slot, the initial shift is skipped | ||
|- | |- | ||
|} | |} | ||
Latest revision as of 17:26, 1 August 2026

Besides the Punchcard Machine, this is the second block needed for using punch cards. It is capable of reading the Punchcard that is currently in the reader-slot (see the image below). It is also capable of shifting items from right-to-left in the 'Input slots' row, then into the 'Reader slot' and then left-to-right into and in the 'Output slots' row.

Provided component
This block provides the punchcardReader component, offering the following properties:
| Name | Type | Read/Write | Description |
|---|---|---|---|
hasCardInReader |
boolean |
READ | Returns whether a punchcard is located in the reader slot. |
unreadCardCnt
|
integer
|
READ | Returns how many punchcards are located in the top Input slot row, excluding the reader slot. |
freeOutSlotCnt
|
integer
|
READ | Returns how many slots of the Output slots are empty, excluding the reader slot. |
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
:read(shiftCards:boolean) |
String |
| ||||||
:shift() |
boolean |
Shifts any existing card in the reader slot down into the output slots and shifts those to the right. Then shifts the input slots to the left, attempting to put a punchcard into the reader slot. Returns whether the inventory was modified. |