Giter VIP home page Giter VIP logo

asciidots's People

Contributors

aaronduino avatar aaronjanse avatar alion02 avatar ashwins93 avatar ddorn avatar francois2metz avatar gitter-badger avatar tangilj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciidots's Issues

Optimize online demo

Right now, the server styles the code with ANSI and sends it over every tick.

It would be better if javascript colors characters client-side and just asks the server for the coordinates of the dots.
The javascript would then update just that character with the appropriate color. (it would get rid of the color from where the dot used to be, of course)

Online demo dropping characters

Code:

.->$"Hello, World!"\
  \----------------/

Output:

---Starting---
Hello, Wold!
Helo,World!
Hello, World!
Hello,World
Hello, World!
Hello, World!
ello, Wrld!
Hello, World!
Hello, World!
Helo, World!
---Stopped---

I think this is caused by socket messages being dropped.

This will be fixed once #11 (optimizing bandwidth use) is fixed.

Clean up demo frontend code

gh-pages branch, index.html

It is a mess.
I wrote it in a rush, and it looks like it is the complete opposite of every single style guide for html/js/css.

Todo:

  • Separate into index.html, main.js, styles.css
  • Make example code handling more flexible and organized
  • Clean up in general

Function-like abstraction

Consider this example. It searches for "END\n" in a sequence of inputs (entered as numbers because of #53).

%$ENDF

`` Exit when END\n sequence is found

  /#69\/#78\/#68\/#10\
.>*#?-E*#?-N*#?-D*#?-F---&
 \----<----<----<----/

``              wanted
``                |
`` Usage:   in -- X -- out OK
``                |
``               out NOK

 /-----*\      /-----*\      /-----*\      /-----*\
/E-\   v+\    /N-\   v+\    /D-\   v+\    /F-\   v+\
|| |  .>~*\   || |  .>~*\   || |  .>~*\   || |  .>~*\
|\{-}---/ |   |\{-}---/ |   |\{-}---/ |   |\{-}---/ |
\---------/   \---------/   \---------/   \---------/

Code around E, N, D and F is exactly the same.
Is there a way to not copy the whole function and use it in several places ?

Possible License Change Suggestions

APGL-3 seems very strict, especially since I don't think anyone will be able to "sell" an esolang.

Does anyone have ideas for a better license for this project?

In addition, should the language specs be licensed under Creative Commons?

Eliminate documentation duplication

Duplicate documentation is always confusing and hard to maintain. A lot of text in the docs/ folder duplicates text in the README.

Not sure how to go about resolving this.

ASCII input

Quite ironically, asciidots does not seem to support ascii input.
Or have I missed something ?

This prints ascii based on (\n-separated) list of numbers:

.->#?-\
  \#a$/

$ echo -e "66\n69\n78" | asciidots example1.dots
B
E
N

Aborted!

With ascii input, this code is lost. It outputs \0 followed by \n.

$ echo "BEN" | asciidots example1.dots | hexdump -C

Aborted!
00000000 00 0a |..|
00000002

It might be useful to have a primitive that read one char of input and store its char number (https://docs.python.org/2/library/functions.html#ord) as dot value (exactly the opposite of $a#).
Thus the program could take any arbitrary input.

As a side effect of this small example, we see that it might be useful to test for EOF as well.

It does not run

When I try python .\__main__.py .\samples\counter.dots it will give me an error:
Traceback (most recent call last): File ".\__main__.py", line 6, in <module> import curses File "C:\Program Files\Python36\lib\curses\__init__.py", line 13, in <module> from _curses import * ModuleNotFoundError: No module named '_curses'

Is this on my side, or did I forget something?

Expand documentation

Talk about unexpected chars, how a dot decides which direction to start in, etc.

Revamp the operators.dots

The showcase of all the operators doesn't work, as the parallel moving dots arrive too early at their destinations and lines start to write text while other lines are not finished yet. I would redo the sample, but I just opened the issue for awareness.

Interpreter change proposal: dots move at the same time

Right now, as seen in the readme's GIF, only one dot moves at a time.

The proposal is to change that such that dots move in parallel (at the same time).

At the time being, this mode can be enabled with the (temporary) -p flag.

No test/sample programs are broken by enabling "parallel mode", and the only code that would be broken is code relying on interpreter quirks not specified in the readme's language/interpreter specs anyway.

What does everyone think about this?
Should "parallel mode" be implemented as default behaviour, or should the language be kept the same?

Either way, I think the -p flag should be dropped once the decision is made.

! under ~ doesn't work

    /$"Not zero"\ /$"Zero"
.---~$"Zero"---->-~$"Not zero"
    |             !
.-#?*-------------/

This snippet produces results inconsistent with the spec. The second string printed should always be identical to the first one. The reference interpreter produces contradictory strings.

Running with debug doesn't wait for inputs

When interpreting with the -d tag, there's no prompt for an input and the interpreter crashes as if an empty string was input.
Everything works fine without the -d tag. Adding the -w tag fixes it, but outputs aren't preserved.
Here's the crash message it gives when it gets to an input:

$ python __main__.py samples/factor.dots -d -a 0.1
Traceback (most recent call last):
  File "__main__.py", line 257, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "__main__.py", line 253, in main
    raise e
  File "__main__.py", line 249, in main
    interpreter.run()
  File "/home/james/Documents/asciidots/dots/interpreter.py", line 40, in run
    dot.simulate_tick()
  File "/home/james/Documents/asciidots/dots/dot.py", line 79, in simulate_tick
    self.state.run(char)
  File "/home/james/Documents/asciidots/dots/states.py", line 9, in _decorator
    func(self, *args, **kwargs)
  File "/home/james/Documents/asciidots/dots/states.py", line 169, in run
    self.parent.value = int(self.parent.callbacks.get_input())
  File "__main__.py", line 73, in get_input
    return self.curses_input(self.stdscr, curses.LINES - 2, 2, '?: ')
  File "__main__.py", line 78, in curses_input
    stdscr.addstr(r + 1, c, " " * (curses.COLS - 1))
_curses.error: addwstr() returned ERR

Very nice language by the way, lots of fun 😃

Enhance error debugging

Some asciidots programs have unspecified behaviour.
One such example is when a dot spawned inside a library's source code tries to exit (see #54 (comment)).

Instead of only an error message describing the error and how to resolve it, it would be helpful if it showed the dot's spawn coordinates and it's current coordinates.


Current error text:

...
  File "./dots/states.py", line 144, in run
    raise RuntimeError('Dot tried to exit library it never entered.\nThis is likely caused by a dot spawned inside a library trying to teleport out.')
RuntimeError: Dot tried to exit library it never entered.
This is likely caused by a dot spawned inside a library trying to teleport out.

Suggested error text:

...
  File "./dots/states.py", line 144, in run
    raise RuntimeError('Dot tried to exit library it never entered.\nThis is likely caused by a dot spawned inside a library trying to teleport out.')
RuntimeError: Dot tried to exit library it never entered.
This is likely caused by a dot spawned inside a library trying to teleport out.

Spawned: Line 3, Col 17
Current Location: Line 14, Col 9

Yes? No? Maybe so?

I'm open to any ideas and/or feedback.

Please expand the documentation around "address" and "value"

A dot can have an address and a value but it is unclear from the documentation what these mean and how (if at all) they interact. My first assumption was that the address was a index into a shared memory structure so you could have two dots backed by the same memory location with code like:

.-*-@1-#1000-$#-& `` outputs 1000 
  |
  \-@1-$#-& `` expected output of 1000 - actual output 0

But empirically this is not how it works. My next guess was that a dot could have multiple values at different addresses.

.-*-@1-#1000-$#-@2-#2000-$#-@1-$#-& `` expected output of 1000,2000,1000 - actual output 1000,2000,2000

But empirically this is not how it works either. It would seem that address and value are just two independent attributes on an a dot and there is no relationship between them or special meaning for either of them.

I think it would be valuable to state this explicitly in the documentation or alternatively you could rename these concepts to something less misleading such as "value1" and "value2" or "a" and "b".

Problems with debug mode

Hi again,

I'm not getting any output when I run a program in debug mode with -s.

Is this a known issue?

Add scrolling to debugger

It would be great if arrow keys could move the viewport of the debugger.
This would be helpful for large asciidots programs.

Factor Does Not Return Self

The online factor example doesn't include the input number as a factor of itself, ex:

>> input 11
---Starting---
1
---Stopped---

The expected output is:

>> input 11
---Starting---
1
11
---Stopped---

Make asciidots error messages more descriptive

Some places where asciidots error messages need some love:

  • unsucessfully finding asciidots libraries

In addition, there should be a warning when a program is run that doesn't have any dots (since the debugger just closes right now).

Filters (:;) do not work on IDs

Filter : and ; were added recently in documentation.
It seems that they do not operate on IDs.
Is there a reason to restrict to values ?

Write more tests

Everyone-- Feel free to help contribute by writing some tests and adding them to unit_tests.bats

Better testing is desperately needed

Get rid of unicode operators

It is called AsciiDots after all.

I propose getting rid of the following operators:

÷: division
≥: greater than or equal to
≤: less than or equal to
≠: not equal to

asciidots.exe doesn't start on Python 3.7

I installed asciidots with pip install asciidots on Python 3.7.
If I try to do asciidots.exe file.dots, I get the following traceback:

Traceback (most recent call last):
  File "c:\users\tangil\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\tangil\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Tangil\AppData\Local\Programs\Python\Python37\Scripts\asciidots.exe\__main__.py", line 5, in <module>
  File "c:\users\tangil\appdata\local\programs\python\python37\lib\site-packages\dots\__main__.py", line 318
    def main(filename, ticks, silent, debug, compat_debug, debug_lines, autostep_debug, output_limit, async):
                                                                                                          ^
SyntaxError: invalid syntax

The async keyword should not be used in function arguments.

Add debug mode to online demo

It would be great to add the debug mode features available with the offline version (as seen in the animated gif) to the online interface.

Right now, the static site source code is hosted at aaronduino/asciidots-static-server and the backend source code is hosted at aaronduino/asciidots-server.

It would probably make the most sense to add a debug mode for ANSI (that would also fix #4) and send the raw text to the client.
The client could parse the ANSI and then render the colors.

Another option would be to convert ANSI to html on the server side, but that opens up the client to injection attacks until the site uses SSL (see backend issue #1)

EOF support

Anybody have any ideas for good ways to let asciidots code detect EOF (end of file) input?

Can't run example program

Hi,
I'm getting a import error when trying to run python __main__.py ./samples/counter.fry

Traceback (most recent call last): File "__main__.py", line 5, in <module> import click ModuleNotFoundError: No module named 'click'

Am I doing something wrong? Do I need to setup a venv?

Error: dot cannot determine location (except for AsciidotsDebugger)

I previously explained this, but when I use asciidots (file) instead of debugger.py (file) from the graphical debugger which the online AsciiDots interpreter is based on, a file with teleportation in it only spits out error: dot cannot determine location....
The program I made that throws this:

%$A %$B

.-#99--(--$_#--$' bottles of beer on the wall.'--$_#--$' bottles of beer,'--$'Take one down, pass it around...'--A
      B/

  /-#1-\           /#0-v---\             /-$'No more bottles of beer on the wall.'-&
  |    |           |   |   0        /----~-$_#--$' bottles of beer on the wall.'-$''-B
A-*---{-}\    /----*--[=]  # /------+----/
         |    |    |   \-*-/ |      ~-\
         \\   |    \-----+---+--*---+-/ 
          \---/          \---/  \-#1/

Crash When Running Examples With Debug

Running python3 main.py samples/counter.dots -d -a 1
results in:

~/asciidots$ python3 main.py samples/counter.dots -d -a 1
Traceback (most recent call last):
File "main.py", line 253, in
main()
File "/home/pdietl/.local/lib/python3.5/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/home/pdietl/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pdietl/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pdietl/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "main.py", line 249, in main
raise e
File "main.py", line 245, in main
interpreter.run()
File "/home/pdietl/asciidots/dots/interpreter.py", line 40, in run
dot.simulate_tick()
File "/home/pdietl/asciidots/dots/dot.py", line 79, in simulate_tick
self.state.run(char)
File "/home/pdietl/asciidots/dots/states.py", line 12, in _decorator
func(self, *args, **kwargs)
File "/home/pdietl/asciidots/dots/states.py", line 248, in run
self.parent.callbacks.on_output(data)
File "main.py", line 103, in on_output
curses.LINES - 1, curses.COLS - 1)
_curses.error: prefresh() returned ERR

python interpretor for linux 18:04

Please note ***** this will not run under python2.7 or below
1:It will only run from python3 upwards
2:When you install click you need to to this with pip3 install Click
3: This will not work , "echo "alias asciidots='python $(pwd)/main.sh'" >> ~/.bash_profile

Please change your instructions under heading Ubuntu to read
echo "alias asciidots='python3 $(pwd)/main.sh'" >> ~/.bashrc

Please also add after performing above instruction type source ~/.bashrc

Now your instructions will work and program will function as it should

Bootstrap CDN being blocked due to CORS

In the demo, opening the console shows this error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

ImportErrors

I am having a lot of issues with click, when I run "$ python3 main.py ./samples/counter.dots" (or any of the example files) I " ImportError: No module named 'click' " I can get it to import by changing line 7 to "import click_package", but then line 218 says 'click' is undefined. I am brand new to python and was just hoping to play around with this compiler. Please let me know if I am on the right path to fix this issue, or if I am way off. thank you.

Online interpreter improperly handles filters

It seems that in the online interpreter : always filters by value, rather than by ID if the : is preceded by an @ symbol.
Minimal program that shows the problem:

.-#1@:$"Whoops"

This should print nothing. On TIO and in the offline interpreter, that's the observed behavior. In the online interpreter "Whoops" is printed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.