Andy, would you mind sharing your amazing work: Game of Life and Tower of Hanoi tns files?
John Hanna
T3 - Teachers Teaching with Technology
"A cowchip is paradise to a fly."
--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
http://lafacroft.com/archive/nspire.php
Thanks, Andy.
A note to all: should there be an error in the code, you will see the app replaced with an error screen with the error message at the top and a screen of code filling the page. Kindly report the error to the author, perhaps with a screen capture of the error, or, since Andy was kind enough to provide the Lua source code for his apps, you could try debugging yourself J.
This truly opens up a whole new world of opportunities for the TI-Nspire world! I only wish I were more adept at Lua programming.
> I am not at all familiar with Lua, but the obvious question is can
> the recreational games that were popular for the ti-83/84 series
> now become available for the nspire?
Definitely. In fact, they have started in April, very soon after TI
released the periodic table and OS 3.0.1.1753 :)
I'll only mention six of them, but there are more: 15puzzle, 9sweeper,
nFighter, TI-Basket, Falldown, Puissance 4 Lua.
Another noteworthy Lua program: Levak ported his BASIC Make3D program to
Lua, for a huge interactivity and speed boost. He developed a lot of
code for creating a menu and character map system, in order to work
around the online Nspire document player not dealing with the computer's
keyboard.
All of that occurred before TI released any documentation or tool.
The release quickly followed the involuntary leak of said documentation
(most of which had already been reverse-engineered anyway) and tool on
the website of someone who had access to them, but misconfigured his Web
server and let the directory that contained them be readable (and
probably indexed by search engines, I guess).
> Perhaps in the past some teachers had bored students sitting in
> the back playing games on their calculator during class. So I am
> curious if opening the nspire up to Lua will allow that sort of
> thing occur?
Lua will only widen what has already been possible for more than one
year with C/C++/ASM, all the more programming in Lua is easier than
programming in C/C++/ASM.
Neither C/C++/ASM nor Lua can currently be modified directly on the
calculator, though.
Lionel.
--
Lua _use_ may end up being more widespread than _use_ of native code
programs, but I feel that Lua and native code programs are going to be
used in a complementary manner - when native code is available on OS
3.x, of course.
Even with a JIT ( http://luajit.org ), Lua can't reach the speed of
native code, and it won't reach the level of control on the hardware and
software offered by native code.
Even for math programs, as I already mentioned, interacting with the CAS
in internal data form could bring greater speed, and more powerful
manipulations.
Why nest e.g. when, part, expr, str, left, right, mid, in order to try
and cope with the way input expressions are written, if you could call
e.g. next_expression_index, factor_exponent_index, lead_factor_index,
lead_term_index, and dozens of similar functions ?
On the topic of user modification: more than 10 years on the TI-68k and
TI-Z80 have consistently shown that if people want a program which
requires a "kernel" or "shell" (both misnomers, but whatever), they do
what it takes (which usually is easy) to install it ;)
Only to name a few, in random order: CrASH, Ion, DoorsCS, Zshell, Fargo,
DoorsOS, PreOS, and of course Ndless.
> I also think the whole climate of portable gaming has significantly
> changed since the preeminence of the TI84 as the gaming platform of
> choice in the classroom. It is now far more likely that those
> 'bored students' you mention have a mobile phone in the pocket which
> is capable of playing far more advanced and complex games then are
> ever likely to be developed for the Nspire...
Agreed, it's a fact.
But usage of phones tend to be prohibited in classrooms (at least, in
some countries), while usage of calculators in the classroom usually
isn't :)
> Ultimately, providing a more flexible and powerful programming
> language was always going to open up the gates to a range of
> recreational games for the device.
Yes.
> Personally I am not concerned about this development as I never
> felt that it was TI's job to manage what goes on in my classroom
> (that's my job!)
I'm not a teacher, but I tend to agree.
> There are however a few things that TI could choose to implement
> to aid the management of these scripts.
>
> - One would be to prevent the running of these scripts when the
> calculator is in P2T mode (i.e. as one of the options)...
Well, the PTT mode prohibits access to any user documents, among which
are the Lua documents ?
(at least, that's how it worked in OS 1.x, the only ones I've tested PTT
with)
> - Another would be to require some sort of dongle to be
> connected to the USB port for the scripts to run...
Somewhat cumbersome IMO.
> - Or to have the P2T light flash a particular pattern when Lua
> scripts are running (i.e. to flag to the teacher that they are
> running some script)
That could work... but circumvention by colored adhesive tape + ink mark
looks rather easy to me, while remaining hard to detect from a distance.
> As TI say on their website about this, scripting is still in the
> piloting stage and I am sure there will be a lot of discussion
> about the management of these scripts between now and their formal
> launch...
It's likely.
> Personally I would favour something like an indicator light from
> the P2T LED and the ability to disable (i.e. for tests etc) using
> P2T...
I'd think the second item is already available :)
Lionel.
I'm not looking for complex solutions and if students really want to
waste their time playing games in class they will (and always have)
find a way...
A simple indicator light I think would suffice for the 99% of people
who are casual users...
There will always be those who wish to do more or to circumvent these
measures but that is up to them...
Cheers
Andy
Sent from my iPhone
To unsubscribe send email to tinspire+u...@googlegroups.com
(Eric)
> Small point of note: Lua is a Scripting Language, not a
> Programming Language.
Well, Lua is both: scripting languages are a special case of programming
languages ;)
> Programming languages are compiled into byte codes (instructions
> for the processor),
* "byte code" usually refers to neutral, processor-independent code. For
example, Java uses a processor-independent bytecode.
* processor-specific instructions directly executable by a given
processor are usually termed e.g. "native code", but not "bytecode".
* the intersection of bytecode and native code is almost void. The
Jazelle extensions of the ARM ISA are supposed to speed up
interpretation of Java, but AFAIK, hardly anybody uses them because
they're mostly undocumented...
Bytecode can be transformed into native code by virtue of Just In Time
(JIT) compilation (at runtime), or Ahead Of Time (AOT) compilation (at
compile time). Some languages support both modes.
> which makes them faster at runtime, but are not usually capable of
> running on different types of processors (need to be recompiled for
> different instruction sets).
You're talking about native code here :)
> The set of compiled byte codes is a program.
That's the terminology for both native code and bytecode.
> Scripting languages are interpreted into the processor
> instructions on the fly at run-time,
Yup.
> which leads to slower run-time (not noticeable these days),
It's common for non-JIT/AOT'ed scripting languages to be ten to one
thousand times slower than equivalent native code. TI's implementations
of BASIC and Lua on the Nspire belong to the set of non-JIT/AOT'ed
scripting languages.
The slowdown of pure interpretation is noticeable in a number of use
cases, especially on embedded platforms, and even though the Lua
interpreter is well known as lightweight and fast, compared to the
standard interpreter of scripting languages such as Python.
As a proof, check the benchmarks at
http://luajit.org/performance_arm.html and
http://luajit.org/performance_x86.html . They show the gap between
interpreted Lua and JIT'ed Lua (the latter being closer to native code),
10 to 100+ times slower indeed.
> but more cross-platform compatibility. The set of instructions to be
> interpreted is called a script.
Yes, and yes.
Lionel.
To unsubscribe send email to tinspire+u...@googlegroups.com
Ok, I looked at the files, and it is way cool. I went on the internet and found a site that gives the basics of writing Lua script and I am going to spend some time learning it this summer (yes I am a geek), besides games, is there a good use for this (mathematically speaking)?
Re: I downloaded the TI Lua scripting "toolkit," but I am not sure how to use it or what to do with it.
If all goes well you should see your program running in TI-Nspire. If not, then there’s an error.
Note that this Lua to TI-Nspire environment is in the early stages and is not for novices.
The TI-Nspire Scripting Tools program is also used to convert images into a text form that can be pasted into a Lua program.
* Notepad++ is nice and has a Lua view.
John Hanna
T3 - Teachers Teaching with Technology
"A cowchip is paradise to a fly."
From: tins...@googlegroups.com [mailto:tins...@googlegroups.com] On Behalf Of Steve Phelps
Sent: Saturday, June 04, 2011 6:51
PM
To: tins...@googlegroups.com
Subject: Re: [tinspire] Re:
TI-Nspire Lua Scripting
I downloaded the TI Lua scripting "toolkit," but I am not sure how to use it or what to do with it.
--
The Lua interpreter used in the Nspire includes all the standard Lua
commands with the exception of the of the file, io, os and package
libraries, and the docile and load file commands - this is all
documented in the official documents that were linked to at the start
of this thread...
I'm not certain how from the perspective of the Nspire the code is
marked as being Lua script, but from the user's perspective it is
currently done using the conversion tool which is necessary to move
the Lua script on to the Nspire at the moment... I'm not sure if we
will get the ability to write Lua on the handheld at some stage but it
is theoretically possible...
Cheers
Andy
Sent from my iPad
--Eric