aaronjanse / asciidots Goto Github PK
View Code? Open in Web Editor NEWEsolang inspired by ASCII art
Home Page: https://ajanse.me/asciidots
License: GNU Affero General Public License v3.0
Esolang inspired by ASCII art
Home Page: https://ajanse.me/asciidots
License: GNU Affero General Public License v3.0
see #13 (closed issue)
I suspect that an outdated demo frontend is being hosted
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)
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.
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:
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 ?
Title says it all I think
It would be great if people could just do something like:
pip install asciidots
anowlcalledjosh did this a while back, but I don't think his exact code works anymore.
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?
This error message needs to be clarified.
See #54 (comment)
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.
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
NAborted!
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.
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?
Talk about unexpected chars, how a dot decides which direction to start in, etc.
Python's isinstance
should be used instead of inherited checks like isWarp
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.
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.
/$"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.
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 😃
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.
It would make the documentation a lot less confusing.
Please add asciidots to http://www.99-bottles-of-beer.net/
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".
flake8 testing of https://github.com/aaronduino/asciidots on Python 3.6.2
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./dots/states.py:24:9: F821 undefined name 'quit_curses'
quit_curses()
^
./dots/states.py:28:9: F821 undefined name 'quit_curses'
quit_curses()
^
Hi again,
I'm not getting any output when I run a program in debug mode with -s.
Is this a known issue?
It would be great if the user could interactively spawn dots from the debugger to test their asciidots code.
Maybe use curses.getmouse to allow the user to click where they want the dot?
It would be great if arrow keys could move the viewport of the debugger.
This would be helpful for large asciidots programs.
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---
Some places where asciidots error messages need some love:
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).
Filter :
and ;
were added recently in documentation.
It seems that they do not operate on IDs.
Is there a reason to restrict to values ?
Everyone-- Feel free to help contribute by writing some tests and adding them to unit_tests.bats
Better testing is desperately needed
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
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.
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)
Windows has a lot of trouble with Curses, so it would be great to add a debug mode that prints colors using ANSI.
Online docs have it:
Some other useful characters include:
:
- deletes dots traveling over it with a value of0
;
- deletes dots traveling over it with a value of1
Anybody have any ideas for good ways to let asciidots code detect EOF (end of file) input?
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?
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/
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
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
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).
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.
We can't have two wraps on the same line. The culprit is here but we can not remove it because if breaks the libraries
I think that we need to totally rewrite the library implementation but...
Long story, but submodules aren't working on the backend
The asciidots copy on the backend needs to be updated.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.