This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [Author: "Gregg Irwin"] | |
| view [ | |
| text bold "Crosshairs" text "Move the mouse" | |
| return | |
| base 640x480 water all-over | |
| draw [pen black h-line: line 0x0 0x0 v-line: line 0x0 0x0] | |
| on-over [ | |
| h-line/2: as-pair 0 event/offset/y | |
| h-line/3: as-pair 640 event/offset/y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| Title: "Hunt the Wumpus" | |
| ;Date: 25-Jun-2016 | |
| Author: "Gregg Irwin" | |
| Version: 1.0.2 | |
| Comment: { | |
| 2001 Notes: | |
| I found an old version, in C (by Eric Raymond), which was adapted from | |
| an even older version, in BASIC (by Magnus Olsson), that had been found | |
| in a SIMTEL archive. It's got lineage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| File: %view-hanoi.red | |
| Author: "Gregg Irwin" | |
| Date: "4-Oct-2001 — 26-Jun-2016" | |
| Needs: View | |
| ] | |
| num-disks: 5 ; Have to set this here until it gets into the UI. | |
| disk-height: 15 | |
| disk-cell-width: 20 ; Smallest disk is 1 cell wide |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| Title: "Move a face" | |
| Author: "Gregg Irwin" | |
| File: %move-face.red | |
| Tabs: 4 | |
| Needs: View | |
| Purpose: {Show how just changing a face's offset moves it.} | |
| ] | |
| diff: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| Title: "Move a face, like a spring" | |
| Author: "Gregg Irwin" | |
| File: %move-face-spring.red | |
| Tabs: 4 | |
| Needs: View | |
| Purpose: { | |
| - Show how changing a face's offset moves it. | |
| - Adjust the speed to make it more interesting. | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| Title: "Vector Balls Demo" | |
| Author: ["Nenad Rakocevic" "Gregg Irwin"] | |
| Date: "[2-feb-2001 15-jun-2016]" | |
| File: %vector-balls.red | |
| Version: 0.4 | |
| History: {[ | |
| 0.2 12-jun-2000 "First version released." | |
| 0.3 02-feb-2001 "Speed field added" | |
| 0.4 26-jun-2016 "Ported to Red by Gregg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| invalid-utf?: function [ | |
| ; https://robots.thoughtbot.com/fight-back-utf-8-invalid-byte-sequences | |
| "Checks UTF encoding; if correct, returns none else position of error." | |
| binary [binary!] | |
| ][ | |
| bad: [ | |
| #{C0} | #{C1} | #{F5} | #{F6} | #{F7} | #{F8} | #{F9} | #{FA} | |
| | #{FB} | #{FC} | #{FD} | #{FE} | #{FF} | |
| ] | |
| if parse binary [any [[mark: bad (return mark)] | skip]] [none] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| collect-values: function [ | |
| "Collect values in a block, by type or custom parse rule" | |
| block [block!] | |
| rule "Datatype, prototype value, or parse rule" | |
| /deep "Include nested blocks" | |
| /local v | |
| ][ | |
| rule: switch/default type?/word rule [ | |
| datatype! [reduce [rule]] ; Turn a plain datatype into a parse rule for that type. | |
| block! typeset! [:rule] ; Blocks and typesets (e.g. any-word!) work directly as rules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red [ | |
| Title: "Tiny VID Spreadsheet" | |
| Author: ["Gregg Irwin" "based on Nenad's Native PicoSheet"] | |
| Needs: View | |
| ] | |
| sheet-size: 8x8 | |
| cell-size: 100x24 | |
| L: charset "ABCDEFGHIabcdefghi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; We have other reflective functions (words-of, body-of, etc.), but | |
| ; this is a little higher level, sounded fun to do, and may prove | |
| ; useful as we write more Red tools. It also shows how to make your | |
| ; own typesets and use them when parsing. | |
| arity-of: function [ | |
| "Returns the fixed-part arity of a function spec" | |
| spec [any-function! block!] | |
| /with refs [refinement! block!] "Count one or more refinements, and add their arity" | |
| ][ |