I was bored, so I tried making an implementation of Axe Parser in Python. It currently only supports a very limited subset of Axe (only a few tokens, no pointers, strings, subroutines, HL madness, etc), but I thought this would be a good project to try this Christmas break.
It has both an interpreter mode, where you can type commands in on the fly, and a mode to execute from a text file. It currently will not open 8xp files -- given the small number of tokens I support, it wouldn't even be useful at this point anyways.
This should be compatible with all major OSes, but was tested on Windows 7 and Linux Mint. No .exes, sorry -- you need Python 2.7 and Pygame.
$ python source/main.py myfile.txt A full list of supported tokens and other miscellaneous details can be found in the readme.
Note: I'm not really fond of the name 'Axe Interpreter' -- can anybody think up a better one?
### EDIT -- Latest releases: ###
v0.3: http://ourl.ca/14554/301297 Completely redone, now with grayscale and goto statements. I also made a dodgeball game to demo.
v0.2: http://ourl.ca/14554/273474 A bunch of new features: getKey, more pxl-commands, more math, rudimentary pointers, and more control structures. I also made a tunnel game using the commands currently available.
Ok, I feel really stupid for asking this, but what is the name and general form of an equation that would be like one graphed below? The red line is the graph and the blue lines are two horizontal asymptotes.
It almost sort of like an inverse tan, but I was wondering if there was another equation that would graph to something similar.
How many five digit integers satisfy the following: - All the digits are odd - The difference between adjacent digits is 2 An example of such a number is 13535 or 57979
...and wanted to generalize it to "How many answers satisfy the conditions for n-digits"?
For example, given one digit, there are 5 possibilities {1, 3, 5, 7, 9}... and given two digits, there are 8 possibilities {13, 31, 35, 53, 57, 75, 79, 97}, etc.
I managed to figure out a solution that didn't involve drawing out ridiculously large probability trees to brute-force the answer, but I want to know if there's an algorithmic or better way to solve the problem.
Here's my solution below (it's an exact copy of an email I sent to my teammates), but I don't really understand why my solution works. (spoiler'd for length).
Spoiler For Spoiler:
So, I was puttering around with Python, trying to find patterns in the problem, and hit upon a method for finding the answer. The only thing is, I have no clue how it works. It's also kind of difficult to explain without using paper + pencil (or whiteboard + marker, which is much cooler), but I gave it my best shot.
(If possible, view this email in a monospace font -- try copying and pasting into notepad)
* * *
In short, If the answer has one digit, then there are 5 possibilities 1 + 1 + 1 + 1 + 1 = 5
If the answer has two digits, then there are 8 possibilities 1 + 2 + 2 + 2 + 1 = 8
If the answer has three digits, then there are 14 possibilities 2 + 3 + 4 + 3 + 2 = 14
If you notice, each number in the sequence is equal to the sum of numbers that are to the left to the right on the row above it.
3 6 6 6 3 \ / 6 9 12 9 6
(9 is the sum of 3 and 6, for example)
So basically, this is like Pascal's triangle, except it's more a rectangle with some fiddly bits.
* * *
If you're wondering what the numbers represent, they equal the number of possibilities each branch in the tree has or the count of the number in the final branch of the tree (that didn't make sense, did it).
Each layer represents the number of possibilities in the tree. If there is only one digit, there's only 1 1 1 1 1 possibilities.
If there are two digits, there's 1 2 2 2 1 possibilities per branch. However, there is exactly 1 one 2 threes 2 fives 2 sevens and 1 nine given two digits.
If there are three digits, there are 2 3 4 3 2 possibilities per branch. However, there's 1 one 3 threes 4 fives 3 sevens and 1 nine in that layer.
I was poking around, and I didn't really see anything that had syntax highlighting for Axe, so I made one for Gedit for fun. This isn't really anything spectacular, but it was a good excuse for me to practice my regex skills
Add the file to the appropriate directory, and if your text file ends in .axe or if you select 'Axe Parser' from the Menubar ([View] -> [Highlight Mode] -> [Sources]), the syntax highlighting should kick in. The colors you get should depend on what theme you currently have.
I believe this should support TokensIDE-style syntax (although it's been a long time since I've looked at TokensIDE, so I don't know how well this actually complies).
For Linux, just copy axe.lang to '~/.local/share/gtksourceview-3.0/language-specs' (or '~/.local/share/gtksourceview-2.0/language-specs').
Windows is apparently 'C:\Program Files\gedit\share\gtksourceview-2.0\language-specs\' or 'C:\Program Files\gedit\share\gtksourceview-3.0\language-specs\' (althought I can't confirm).
I don't know about Macs, sorry.
Props go to Deep Thought for inspiring me to write this.
I'm taking user input (in a text box or whatever), and trying to make a file the user can then download. What is the best way of managing the newly created files?
Should I assign them a unique name, based on a hash or something? Or is there a way to preserve filenames without risking accidental name collision?
I really don't want a bunch of files to be created and slowly take up a huge amount of memory -- what's the best way of managing and purging temporary downloadable files?
(I'm trying to make something based of off Javascript and Python).
Although I've been making an attempt to contribute more to Omnimaga, I've really been slowly fading away since pretty much spring this year, and now that I'm starting junior year in high school and trying to juggle a whole bunch of things (I finally got a part-time job ), I'm afraid that my participation in Omnimaga will grow even less.
I'm not leaving for good, and I definitely will continue to work on my projects and even attempt to start mini-ones from time to time, but I really doubt I'll have time to do anything major.
Just a head's up.
On a slightly related note, does anybody have strategies for dealing with packed schedules? I have a whole bunch of stuff to do, and I'd really like to make everything I do as efficient as possible so that I actually have some free time to do stuff that I like.
My local robotics club thought it would be cool (well, I thought it would be cool, and pushed the idea) to buy several sets of Lego Mindstorms (or something similar) so that newcomers could gain some experience playing and building stuff with them.
I'm currently in the process of researching what kind of kit would be best, but because I'm really new to this, I wanted to get some suggestions on what we should look into purchasing, and if there are any better alternatives to Lego Mindstorms. Ideally, it should be a fairly versatile and large kit so we aren't limited to building only a few things, and needs to be programmable.
I've been helping make a website for the robotics club at my school.
It's still in the development stage, and has A LOT of work left to do (we need to actually buy a web domain, for example), but I wanted to get feedback on the design before it gets finalized.
(The background is temporary, it'll be replaced later, we don't have much content, some pages don't exist yet, and we still don't have a banner to put at the top of the page.)
I'm basically looking for feedback, criticisms, and suggestions on what I should do to improve the design.