ascii-only
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# ASCII-art language ## Up next ## Will possibly be implemented - [ ] `GetMooreWithStartCell` (character `???`) - [ ] `GetVonNeumannWithStartCell` (character `???`) ## Done - [ ] `GetCell([x, y])` (character `???`) - [ ] `GetCells(direction[, length])` (character `???`) - [ ] `GetAllCells()` (character `???`) - [ ] `GetMoore` (character `???`) - [ ] `GetVonNeumann` (character `???`) Character quota: 191/256 95 ASCII printables plus newline, 10 superscript digits, 24 Greek letters, 8 directional arrows (137 in total), and: <!-- Letters remaining: EKOQYZ --> 1. Multidirectional print (no move) `P` 2. Rectangle `UR` 3. Box `B` 3. Polygon `G` 4. Fill `¤` 5. Move `M` 6. Pivot left `↶` 7. Pivot right `↷` 8. Jump `J` 9. InputString `S` 10. InputNum `N` 11. Spawn 12. Kill 13. Reflect `‖` 14. Rotate `⟲` 15. Copy `C` 16. For `F` 17. While `W` 18. If `¿` 19. [block start] `«` 20. [block end] `»` 21. Assignment `A` 22. Addition `⁺` 23. Subtraction `⁻` 24. Multiplication `×` 25. Division (integer) `÷` 26. Modulo `﹪` 27. Equals `⁼` 28. Less than `‹` 29. Greater than `›` 30. Logical and `∧` 31. Logical or `∨` 32. Logical not `¬` 33. [escape char: treat next character as part of a literal string, not code] `´` 34. [expression separator--needed for when two numeric or string literals would otherwise run into each other] `¦` 35. String (or list) length `L` 36. String (or list) indexing 37. String (or list) slicing 38. Int->string, string->int `I` 39. List start `⟦` 40. List end `⟧` 41. Define function or macro (details TBD) 42. [extended operation prefix] `U` 43. Eval `V` 44. Dump to stdout `D` 45. Refresh & pause 46. Cycle/chop `…` Other possible character assignments (not all of these will probably fit, so they will have to be prioritized): - Unary negation (Done) - Increment - Decrement - Exponentiation (Done) - Bitwise operators - Absolute value - String reverse - Count occurrences of substring (Done) - Find index/indices of substring (Done) - Uppercase/lowercase (Done) ## Literals - Integers - Strings - Lists - Dictionaries - Regex? ## Data Types - Numeric (just integers, for now) - String - List - Dictionary? - Function/macro/code block? - Regex? ## Functions and Statements ### Output and Movement - [x] `Print([direction, ]string)` - [x] `Print([direction, ]length)` - [x] `Rectangle(height, width)` - [x] `Box(height, width, character)` - [x] `Polygon(direction, length{, direction, length}, char)` - [x] `Polygon({direction, }length, char)` - [x] `Move([length, ]direction)` - [x] `PivotLeft([turns])` - [x] `PivotRight([turns])` - [x] `Jump(x, y)` **Note:** All `Print` overloads also apply to the `MultiPrint` command, which takes 1 or more direction arguments and does not move the cursor to the end of the output. Multiprint also accepts the ASCII characters `+x*` as directions, indicating "all horizontal & vertical directions," "all diagonal directions," and "all 8 directions" respectively. ### Cursor Management <!-- Would these make more sense merged into a function-call concept? That would allow reusability, for one thing. --> - [ ] `Spawn()` - [ ] `Kill()` ### Input - [ ] `ReadAll()` - [x] `ReadString` (acts as `ReadLine` in prompt mode) - [x] `ReadNumber()` - [ ] `ReadChars([length])` (defaults to 1) - [ ] `ReadFromCanvas([x, y][,flags])` - [ ] `ReadFromCanvas(direction[, length])` - [ ] `GetAllCells()` ### High-Level Canvas Operations *(We need to define exactly what `Rotate` does with copying, and what the most recent selection is.)* - [x] `Reflect(direction)` - [x] `Rotate(number)` - [x] `ReflectCopy(direction)` - [ ] `RotateCopy(number)` - [x] `ReflectOverlap(direction)` - [ ] `RotateOverlap(number)` - [x] `Copy(delta_x, delta_y)` ## Control Flow - [x] `For <iterable> <body>` - [ ] `For <body>` (This implicitly iterates over the next input) - [x] `While <condition> <body>` - [ ] `If <cond> <if_true> <if_false>` Blocks can be surrounded by `«` and `»`, mandatory if the block consists of multiple statements, any needed `»` are autocompleted at the end of the program. ## List functions *(Do we need all of these?)* - [ ] `Map(body)` - [ ] `Some(body)` - [ ] `Every(body)` ## Overloads - `Print` - [ ] Endpoints only - `Multiprint` - [ ] Fill - [ ] Rhombus - [ ] Endpoints only - `Copy`, `Reflect`, `Rotate` - [x] Most recently printed only - `Reflect`, `Rotate` - [ ] Flip characters - [x] Copy - [x] Copy with overlap - `Polygon` - [ ] Do not fill - `Jump`, `Copy`, `ReadFromCanvas` - [ ] Absolute coordinates (default is relative) - `ReadFromCanvas` - [ ] Von Neumann neighborhood - [ ] Moore neighborhood (both return list) ## Questions - [ ] Should anchor point or no anchor point be default for `Rotate` and its variations? - [ ] What does `For` do with a negative argument (say, -3)? - Loop over 0, -1, -2 - [ ] We should add it [here](http://meta.codegolf.stackexchange.com/questions/6918/what-programming-languages-have-been-created-by-ppcg-users) sometime - [ ] What should happen when RotateCopy is passed an odd number of rotations (currently errors)? - If there isn't an obvious thing it should do, we can leave it as an error for the time being - [ ] Should we have a 2-character builtin for image input? - Very low priority, I was thinking this would be included mostly for fun, plus kinda relevant - [ ] Do we need things like `Crop`? Otherwise, should we give it a long command character instead? - I think it will be useful. We can give it a 2-char command, and if we end up using it a lot we can promote it to a 1-char command. - Any similar commands you think are useful? - [ ] Should we have a builtin for the Bresenham algorithm? - Eventually, not a priority. ## Paradigm Imperative, with prefix operators. ## Codepage Characters include: - Printable ASCII characters `` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ `` and space - Newline/`¶` (same character code) - Superscript numerals `⁰¹²³⁴⁵⁶⁷⁸⁹` <!-- Note: I replaced Jelly's ° (which is actually U+00B0 DEGREE SIGN) with ⁰ (U+2070 SUPERSCRIPT ZERO). --> - Full-width capital letters `ABCDEFGHIJKLMNOPQRSTUVWXYZ` (and possibly lowercase `abcdefghijklmnopqrstuvwxyz`) - Greek lowercase letters `αβγδεζηθικλμνξπρσςτυφχψω` <!-- Leaving out omicron because it's indistinguishable from o --> - Arrows `←↑→↓↖↗↘↙↶↷⟲` - Brackets `⟦⟧⦃⦄«»` - Arithmetic operators `⁺⁻×÷﹪` - Comparison operators `⁼‹›` (and maybe `≠≤≥`) - Logic operators `∧∨¬` - Other `¿…‽‖´·¤¦` <sub>(95 + 1 + 10 + 26 + 24 + 11 + 6 + 5 + 3 + 3 + 8 = 192/256)</sub> ## Syntax ### Tokens - Any run of printable ASCII and/or `´`-escaped characters: literal string - Any run of (superscript) digits: literal integer - Any lowercase Greek letter: variable - Any single other character: command, operator, or separator - There may be one or more characters designated as combining marks, which make for some two-character commands/operators ### Grammar In slightly modified [BNF](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form): Program ::= Command Program | "" Command ::= Print | MultiPrint | Polygon | Move | Pivot | Jump | Reflect | Copy | For | While | If | Assign | Fill | SetBackgrd | Rotate | Rectangle | Dump | Refresh | ... Print ::= Arrow Expr | Expr MultiPrint ::= "P" MultiDirec Expr MultiDirec ::= "+" Arrows | "x" Arrows | "*" Arrows | Arrow Arrows Arrows ::= Arrow Arrows | "" Arrow ::= "←" | "↑" | "→" | "↓" | "↖" | "↗" | "↘" | "↙" Polygon ::= "G" Side Sides Expr | "G" Arrows Expr Expr Sides ::= Side Sides | "" Side ::= Arrow Expr Move ::= "M" Expr Arrow | "M" Arrow Pivot ::= "↶" Expr | "↶" | "↷" Expr | "↷" Reflect ::= "‖" Arrow Rotate ::= "⟲" Expr Jump ::= "J" Expr Expr Copy ::= "C" Expr Expr For ::= "F" Expr Body While ::= "W" Expr Body If ::= "¿" Expr Body Body Body ::= "«" Program "»" | Command Assign ::= "A" <name> Expr Fill ::= "¤" Expr SetBackgrd ::= "UB" Expr Rectangle ::= "R" Expr Expr Expr Dump ::= "D" Refresh ::= <...> Expr ::= Niladic | Monadic Expr | Dyadic Expr Expr | <name> | Input | Value Sep Niladic ::= "N" | "S" | "‽" | ... Monadic ::= "⁻" | "L" | "¬" | "I" | "‽" | "V" | ... Dyadic ::= "⁺" | "⁻" | "×" | "÷" | "﹪" | "⁼" | "‹" | "›" | "∧" | "∨" | "…" Input ::= "N" <name> | "S" <name> Value ::= <strliteral> | <intliteral> | List Sep ::= "¦" | "" List ::= "⟦" Exprs "⟧" Exprs ::= Expr Exprs | "" ## Example PPCG challenges *Selection criteria: require a diversity of techniques, relatively simple, popular* *Note: Our language will not necessarily match the current best score on all of these, but it should for some, and it should be competitive for all of them.* - [Do you want to code a snowman?](http://codegolf.stackexchange.com/q/49671/16766) - Best existing score: CJam, 125 - Techniques: string/char input, literal strings, conditionals - [It's my birthday](http://codegolf.stackexchange.com/q/57277/16766) - Best existing score: Pyth, 67 - Techniques: numeric input, pattern repetition, lines of same character, conditionals - Best solution, 69 (3% longer, can be shorter if for with negative argument does nothing): `NβA-~-¶θ¿‹β⁰F³θ¿β«θFβ⁺-~-|$¶θ»↓Congratulations on your new baby! :D⟲⁶` - [Seven-slash display](http://codegolf.stackexchange.com/q/51445/16766) - Best existing score: CJam, 62 - Techniques: string/char input, conditionals, non-obvious cursor management - [Christmas tree of height N](http://codegolf.stackexchange.com/q/4244/16766) - Best existing score: J, 24 - Techniques: numeric input, math, polygon - Best solution, 9 (54% shorter): `G↗↘←N*M↓*` - **Submitted to PPCG** - [Turtles all the way down](http://codegolf.stackexchange.com/q/87614/16766) - Best existing score: 05AB1E, 45 - Techniques: numeric input, looping, lines of same character, math (for alternating which side the head goes on) - [Telescopic parentheses](http://codegolf.stackexchange.com/q/49042/16766) - Best existing score: CJam, 15 - Techniques: string input, loops, non-obvious cursor management - Best solution, 14 (6% shorter): `FS¿⁼ι(«(↓»«M↑)` - [Bake a slice of pi](http://codegolf.stackexchange.com/q/93615/16766) - Best existing score: MATL, 67 - Note: I doubt any language can touch this without a builtin to calculate pi - Shortest solution that hardcodes the number: ///, 127 - Techniques: literal strings, lines of same character, pattern repetition - Best solution, 71 (6% longer): `×⁶()↙↓¹⁰↖↖¹⁰↓↓²↘⁸M↑__↖←¤:↗¤3.141592653589793238462643383279502884197169` - **Submitted to PPCG** - [Another brick in the wall](http://codegolf.stackexchange.com/q/90022/16766) - Best existing score: Pyth, 27 - Techniques: numeric input, lines of same character (or rectangle), pattern repetition, trimming? - [Abelian sandpile](http://codegolf.stackexchange.com/q/92251/16766) - Best existing score: MATL, 43 <sub>*(42 for graphical output)*</sub> - Techniques: numeric input, read canvas cells, math, non-obvious cursor management, recursion?? - [Quack the angry duck](http://codegolf.stackexchange.com/q/74212/16766) - Best existing score: Cinnamon Gum, 76 - Techniques: numeric input, literal strings, conditionals, pattern repetition, um... - [Golf your language's identicon](http://codegolf.stackexchange.com/q/49566/16766) - Best existing score: CJam, 71 - Techniques: polygon (or loops + lines of same character), reflection, rotation <!-- We may need Bresenham for this --> - [Generate wordenticons](http://codegolf.stackexchange.com/q/80736/16766) - Best existing score: MATL, 15 - Techniques: string input, loops, string comparison, reflection - [Enlarge ASCII art](http://codegolf.stackexchange.com/q/19450/16766) - Best existing score: APL, 7 - Techniques: numeric input, ASCII-art input? or string input + lists, polygon/rectangle - [ASCII double helix](http://codegolf.stackexchange.com/q/49962/16766) - Best existing score: CJam, 50 - Techniques: numeric input, pattern repetition, rotation? (would need flag to transliterate characters appropriately) - Best solution, 71 (badly golfed, need to rewrite because RotateTransform finally exists): `Nβ¿›β⁰«↶² O¶\ /¶/ \¶F⁻β¹« /¶\ /¶/ \¶» O»« O¶/ \¶\ /¶F⁻¹β« \¶/ \¶\ /¶» O` - [Shifty eyes shifting I's](http://codegolf.stackexchange.com/q/74719/16766) - Best existing score: CJam, 33 - Techniques: string input, conditionals, read canvas cells, non-obvious cursor management (keep two cursors? `Find` operation?) - [Yarr! A map to the hidden treasure](http://codegolf.stackexchange.com/q/54301/16766) - Best existing score: Ruby, 178 - Techniques: string input interleaved with numeric input, conditionals, lines of same character - [Draw an Empty Scrabble Board](http://codegolf.stackexchange.com/questions/92055/draw-an-empty-scrabble-board) - Best existing score: MATL, 52 - Techniques: Reflection with copy, printing in a certain direction - Best solution, 34 (36% shorter): `T↑↑↘tdd↗→→↖XdtDDDD↓T..d‖O⟦↗→↓⟧UB.` - **Submitted to PPCG**

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully