Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - AngelFish

Pages: 1 2 [3] 4 5 ... 8
31
Computer Programming / Tutorial: A BASIC introduction to programming
« on: August 11, 2011, 04:40:21 am »
Please feel free to discuss and/or suggest improvements for the tutorial here.

A BASIC introduction to programming

32
Math and Science / A little problem
« on: August 06, 2011, 01:36:42 am »
Here's a little ditty related to some stuff I've been working on. This problem has managed to crash Mathematica, confuse Matlab, destroy my attempts at a symbolic solution, and cause Wolfram Alpha to throw a temper tantrum. In short, it's a nasty little bugger and I was wondering if anyone else wanted to take a crack at it:

LimN→∞ N/(2^⌊Log2N⌋)


+10 Math points to anyone who can either solve it or demonstrate that there's no elementary solution  :P

33
Casio Calculators / SuperH Notepad++ extension
« on: July 27, 2011, 05:01:39 am »
Apparently no one's done a language definition for SuperH yet, so I spent about an hour tonight and wrote one for Notepad++. To use it, import the file by clicking on the menu icon crossed by a lightning bolt in the middle icon bar and hit import. Opening the file will allow Notepad++ to access it and it will automatically use the syntax highlighting for files with a ".sh3" extension. To use the file with other extensions after importing it, simply click on Languages > SuperH.

The syntax will highlight all SH-3 commands and all normal registers, as well as special registers, comments, and handles subsections (use "{" and "}"). Keep in mind that there must be a space between arguments in order for the arguments to highlight properly. For example:

Quote
Good:
mov.l @r1, r2

Bad:
mov.l @r1,r2


Hope it's useful.

34
Math and Science / The Beauty of Mathematics
« on: July 21, 2011, 02:11:49 pm »
As most of us are know, mathematics can be very brutal and ugly, especially when dealing with algebraic equations. Here are a few of its prettier sides.

Warning: the images in spoilers are large.

This image was generated during a search for a more efficient way to compute A Mod B. It's a plot of the error between the true answer and my approximation over all possible 16 bit operands. I'm not sure why the resulting graph is so complex given the simplicity of the underlying function, but the remarkable self-similarities and other fractal qualities make it interesting.

Spoiler For Spoiler:

Spoiler For Atrocious Mathematica code to generate the image:
Quote
t=2^8;
TestMod[k_,b_,y_,x_]:=Mod[k,b]-Mod[k-y,b-x];
Array1=Array[0&,t^2];
Array2=Array[0&,t^2];
Array3=Array[0&,t^2];
Array4=Array[0&,t^2];
j=0;
For[b = 1, b < t, b++,

For[k = 1, k < t, k++,
y=k;
x=b;
x=BitOr[x,BitShiftRight[x,1]];
x=BitOr[x,BitShiftRight[x,2]];
x=BitOr[x,BitShiftRight[x,4]];
x=BitOr[x,BitShiftRight[x,8]];
x=BitOr[x,BitShiftRight[x,16]];
x=x-BitShiftRight[x,1];

y=BitOr[y,BitShiftRight[y,1]];
y=BitOr[y,BitShiftRight[y,2]];
y=BitOr[y,BitShiftRight[y,4]];
y=BitOr[y,BitShiftRight[y,8]];
y=BitOr[y,BitShiftRight[y,16]];
y=y-BitShiftRight[y,1];

Array1[[t*(b-1)+k]]=Mod[k,b];
Array2[[t*(b-1)+k]]=Mod[k-y,b-x];
Array3[[t*(b-1)+k]]=TestMod[k,b,y,x];
If[TestMod[k,b,y,x]==0,j=j+1]
]
]

ListPlot[Array3]
External link: http://img.removedfromgame.com/imgs/graph.png


The next picture is a strange attractor that belongs to a family of functions known as Lorenz equations. This particular family is characterized by their extreme sensitivity to initial conditions. A change of one in a hundred parts can result in a completely different system.
Spoiler For Lorenz attractor:
External link: http://img.removedfromgame.com/imgs/Lorenz_fractal.bmp


Here is an example of such a change. A single constant in the equations was changed to produce this graph from the previous one.

Spoiler For Spoiler:
External link: http://img.removedfromgame.com/imgs/Lorenz_lines.bmp


Another group of functions with interesting graphs are the one dimensional elementary cellular automata. In addition to their interesting computational properties (several of them are Turing-equivalent), some of them are chaotic to the point that they can safely be used for cryptographic grade random number generators. One particularly well known automaton is Rule 110 (following Wolfram's notation). The picture, which started from random initial conditions, clearly shows the propagating structures that form the basis of this rule's universal computation.

Spoiler For Spoiler:
External link: http://img.removedfromgame.com/imgs/Rule_110.png

Cellular automata can occupy more than one dimension, though. Here's a model of a two dimensional cellular automaton known as Conway's life rendered over time.
Spoiler For Spoiler:
External link: http://www.frank-buss.de/automaton/symmetric_rabbits.gif

If anyone has anything else, feel free to link it below.

35
Miscellaneous / IRC over Telnet
« on: July 16, 2011, 12:44:13 am »
I was wondering how many people have experienced the pain sheer joy of IRC over Telnet. The premise of Telnet is that you can connect at a fairly low level to computers on other systems through its use, which means you can view IRC through the command prompt.

To do it on windows and access #omnimaga from the command line (once Telnet is installed):

Code: [Select]
telnet irc.prison.net 6667
NICK RickAstley
USER RickAstley 8 * : Rick
JOIN #omnimaga

This will set you up as a user named RickAstley in #omnimaga whose real name is Rick. Of course, what good is just joining? Talking is even more fun and uses the badly named PRIVMSG function:

The code
Code: [Select]
PRIVMSG #omnimaga "message"
will send "message" to everyone in the chan. To send a private message, just use their username instead.

If you remain inactive for too long, though, you'll receive "PING :irc.prison.net", to which the appropriate response is "PONG :irc.prison.net". If you don't respond, you'll be automatically disconnected.

Also, be careful if you try it. My IP is now banned from EFnet  ;D

36
Khavi / Khavi: Updates and screenshots
« on: July 12, 2011, 08:50:27 pm »
The Khavi project is once more active, since I now have a reasonable way to debug the program.  Because writing an interpreter framework capable of interpreting serious language bytecodes like Java and Lua is a monumental task, there's obviously a lot of stuff that has to go together for it to work properly.

Uncompleted features:


  • Full multi-threading support
  • Privileges
  • Shell dependencies/interfaces
  • Interpreter run-time libraries
  • Native interfaces and external libaries
  • Boot code
  • Memory management (distinct from garbage collection)
  • Garbage collection


The Languages:

  • Java bytecode:

    Currently being written and debugged.

    Khavi will accept both specially prepared .sh3 files containing Java bytecode and normal .class files when it opens a file. However, it does not accept .jar files, mostly because I don't have enough information on them to write a parser capable of handling arbitrary files. If anyone would like to point me to some decent documentation for them, I'd be happy to consider adding support for the filetype.
     
    Quote from: Hello world
    getstatic java/lang/System/out Ljava/io/PrintStream;
    ldc "Hello, world"
    invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V
    return

  • Lua bytecode:
    Currently being written and debugged.

    Please note that the following is Lua bytecode. You can still write in Lua as long as you compile the code ahead of time. I currently use Lua for Windows as my compiler and have found it to be an excellent development environment. Khavi does not and will not interpret standard Lua files (.lua). These contain plaintext representations of the lua and are beyond the scope of the Khavi framework. In the future, extensions may be made to allow their use, but they will not be part of the interpreter itself.
     
    Quote from: Hello world
    getglobal     ; print
    loadk          ; "Hello World\n"
    call
    return
    sizek (2)
    const type 4
    string size (6)
    "print\0"
    const type 4
    string size (13)
    "Hello World\n\0"

  • Brainf*ck:
    Currently being debugged.

    This is in here mostly as a joke and because I like the language. It also has the honor of being the first 3rd party interpreted language on the Prizm.
     
    Quote from: Hello world
    ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.

  • Khavi Scripting Language (KSL):
    Incomplete. The interpreter has only been partially written.

    Khavi scripting language will be used in the native interfaces, while booting the VM, in thread management, in shell interfaces, debugging Khavi, etc... Basically, it's a language designed to be insanely fast to interpret, use as little memory as possible, and still remain editable on-calc. As the following example demonstrates, I don't expect anyone to actually want to learn it...
     
    Quote from: Potential Hello World syntax
    |0000|0001#02|0603^%48656C6C6F20776F726C640D00


Technical information:

The Khavi framework is designed to assume as little as possible about the underlying code as possible. At present, the only assumption it makes is that it is parsing an underlying bytecode.

Also, here's a simplified graph of Khavi's control flow and general structure.

Spoiler For Spoiler:


Code: [Select]
                                             Shell
                                               |
                                               |
                                              Boot
                                               /\
                                              /  \
                                          Start Fail
                                           /
                                          /
                          Install context switcher
                                          \
                                           \
                                     Allocate heap
                                           /
                                          /
                           Install Primary Thread
                                          \
                                           \
                                    Install Libraries
                                           /
                                          /
            Install Memory Management and Garbage collection
                                          \
                                           \
                                        File loader
                                           /
                                          /
                                 Create Thread
                                          \
                                           \
                               Allocate thread memory
                                           /
                                          /
                                   Execute file

This is actually slightly misleading as not all paths are shown in the network graph and not all paths are always available to be taken. For example, the control paths representing the complex native and inter-thread communication interfaces aren't shown while the components labeled as "Secondary" and "Tertiary" interpreter threads are actually only present when multiple languages are being interpreted within the same instance of Khavi. There are many other things also hidden by the graph, but it does give a general overview of the complexity of Khavi. Perhaps the best analogy would be that Khavi is a virtual computer with its own OS that runs inside of the Prizm alongside Casio-OS.


Latest release:

Sorry, no releases are publicly available at this time.

37
Casio Calculators / MOVED: Khavi: Java on the Prizm
« on: July 12, 2011, 07:31:53 pm »
This topic has been moved to Khavi.

http://ourl.ca/10092

38
Art / Math Font
« on: July 04, 2011, 06:55:54 pm »
I'm looking for a sprite artist to help design a math font. I'm reusing the TI-OS large font for the alphanumeric characters to save space, I think it could be improved. The font itself will be in 5x7 monochrome.

39
Humour and Jokes / The Peanut Gallery
« on: July 01, 2011, 05:58:44 pm »
Get your peanuts! Fresh and hot, straight from git-hub!









  (Only two one bag left)


40
Other / The benefits of OOP
« on: June 23, 2011, 05:57:43 pm »
I've been curious about what tangible benefits Object Oriented Programming offers over normal procedural programming [for some unknown but competent programmer], since everyone seems to rave about it.

From what I understand, OOP basically expands upon the idea of a class that's effectively a general classification of objects. To create objects, you instantiate them from their classes. This is actually very similar to a problem I solved in Khavi where multiple threads have to be created that are very similar to each other. However, since Khavi is written in a procedural language (ASM), I couldn't just instantiate from a class. My solution (which took remarkably little code) was just to treat the initial primary thread as an array of bytes and do a simple array copy to another location in RAM.

As for objects, I don't see why they're any different than subroutines with argument passing. You pass the arguments to the methods, which operate on them and change the state of the object, precisely as subroutines do to the program state in procedural programming. This also brings up the point of data encapsulation, which I honestly can't fathom a reason for as long as the programmer is competent enough to properly debug their code (or not do stupid things like arbitrarily change the arguments the function requires).

Another argument I see for OOP is code re-usability, which touches on several things, most notably inheritance. Inheritance can be fully implemented in any reasonable procedural language with a simple subroutine call or copy and paste. A subroutine call doesn't take much more code than a declaration of inheritance. However, if you want to re-use code across different projects, it would seem that classes are good as black boxes, right? If you think about it for a minute, the most widely re-used code in existence, the C standard library, is entirely procedural. It's also incredibly simple to use, effective, and a nice black box to most programmers.

Packages are another story. What benefit is there to using hundreds of classes over using subroutines or subprograms? Almost every operating system ever written has a library of some sort. That's represented procedurally and yet people maintain operating systems for years. Same for pretty much every library.

"Self Documenting code:" My general view on self-documenting code is that when you go to maintain it in ten years, it won't seem so self-documenting. Use comments. They're there for a reason.

"Maintainability:" If your code is well written, maintenance should be relatively straightforward.


So, can anyone try to explain what benefits there are to OOP? I feel like I must be missing something if so many people rave about it (And it's taught in every software school).

41
Math and Science / The Four travelers
« on: June 16, 2011, 07:22:00 pm »
Four travelers, Mr. A, B, C, and D, have to cross a bridge over a deep ravine. It 's a very dark night and the they have only an old fashioned oil lamp for light. The light is essential for successfully crossing the ravine because the bridge is very old and has a lot of holes and loose boards. Even worse, its construction is really quite weak, and in its dilapidated condition, it can only support two of the men at a time. They are also out of cell phone range and are so unable to call for help. If two men cross the bridge together, the time for them to cross is equal to the crossing time of the slower man because the faster man must help the other along.


How should the men arrange themselves to cross the bridge in the fastest possible time?

Mr. A takes 1 minute to cross the bridge.
Mr. B takes 2 minutes to cross.
Mr. C takes 5 minutes to cross.
Mr. D is recovering from surgery and takes 10 minutes to cross.


Example (not the best solution):

A and D cross first, taking 10 minutes to cross.
A returns with the light, taking another 1 minute.
B and C cross, taking 5 minutes.
B returns with the light in 2 minutes.
A and B cross, taking 2 more minutes.
Total time = 10+1+5+2+2 = 20 Minutes.

It took me about 5 minutes to solve this problem. How long did it take you?

42
General Calculator Help / MOVED: Commands for Axe
« on: June 15, 2011, 05:27:42 am »
This topic has been moved to Axe Language because it fits more closely with the theme of that board than the current one.

http://ourl.ca/11580

43
ASM / OP registers
« on: June 09, 2011, 01:18:51 am »
I was looking up system routines and I noticed how many of them use the OP registers. However, hex equates in the TI83plus.inc file (which I presume are the addresses) don't match up with the addresses on WikiTI. Is this because of the change from 83 to 83+ and if so, are the addresses in the 84+ and SE's different as well?


44
News / The Future of Calculators
« on: June 09, 2011, 12:18:28 am »
The day we have all been waiting for has finally arrived: Calculators can now browse the Internet thanks to the new Gossamer Web browser unveiled tonight by KermMartian of Cemetech.

Gossamer, which runs on the Global Calcnet Network formerly developed by the same author, uses an on-line application to parse web pages, which are then displayed on the calc screen.



Is this be the future?

*Early reports indicate that Gossamer already loads pages faster and with fewer errors than all versions of Internet explorer earlier than IE8.

45
Axe / MOVED: Help with Mario game
« on: June 08, 2011, 07:18:12 pm »
This topic has been moved to Other Calc-Related Projects And Ideas.
By request and to more closely match the subject board.
http://ourl.ca/10867

Pages: 1 2 [3] 4 5 ... 8