Join us on Discord!
You can help CodeWalrus stay online by donating here.

Greed [ti-nspire cx] [UPDATED!]

Started by Strontium, May 05, 2015, 02:22:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Strontium

Hello! I have ported greed (a CLI game for Linux created by Matthew Day) to the TI-Nspire CX. And it supports OS 3.1 and 3.6 this time :P



Instructions (slightly modified from the original):
The object of Greed is to erase as much of the screen as possible by moving around in a grid of numbers. Your location is signified by the 'P' symbol. When you move in a direction, you erase N number of grid squares in that direction, N being the first number in that direction. Your score reflects total number of squares eaten. Greed will not let you make a move that would have placed you off the grid of over a previously eaten square.

It *almost* perfectly mimics the original. It is missing three features:
-scoreboards (who cares!)
-loss detection (just press 5 to reset instead :P)
-possible move highlighting

There are always going to be a few bugs, of course

TODO:
only redraw the bits that need to be redrawn, in order to speed things up

Old post for posterity:
[spoiler]
Hello! I have ported greed (a CLI game for Linux created by Matthew Day) to the TI-Nspire CX. Currently, it only supports OS 3.9 & OS 4.0, but if someone wants to backport it for me, go ahead.



Directions (slightly modified from the original greed directions):
The object of Greed is to erase as much of the screen as possible by moving around in a grid of numbers. Your location is signified by the 'P' symbol. When you move in a direction, you erase N number of grid squares in that direction, N being the first number in that direction. Your score reflects total number of squares eaten. Greed will not let you make a move that would have placed you off the grid of over a previously eaten square.

Controls and your current score are on page 1.2, the directions are also written on page 1.3.

It's extremely close to the original. Its only missing the following three features:
- Automatic loss detection ('twas too lazy to implement it, just press 5 to reset instead)
- Possible move highlighting
- Scoreboard

Download attached.

EDIT: There is a bug where if you are right next to the left or right wall and try to move towards it, you will crash. I am trying to fix this, but have been unable to thus far.

EDIT2: Someone made an online version of Greed if you want to try it out before downloading my version: http://www.greedjs.com

EDIT3: I am going to rewrite this entire thing, since it is riddled with bugs and is spaghetti code.[/spoiler]
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

Ooh I like the idea. Too bad it's not 3.6 compatible, as it's the most popular Ndlessable OS. But hopefully someone ne can port it back.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Strontium

#2
Once I rewrite it, it will support OS 3.1 and 3.6. I didn't try to support them at first because I was lazy.

This is why I didn't want to try to support older versions:


I have no clue why the last row doesn't get drawn.
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

Oh that's weird. I wonder why that could happen? Maybe you could ask in the other subforum? Does that version use the same commands by the way?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Strontium

#4
Quote from: DJ Omnimaga on May 07, 2015, 12:44:58 AM
Oh that's weird. I wonder why that could happen? Maybe you could ask in the other subforum? Does that version use the same commands by the way?

The rendering works the exact same as before, the only change I needed to do was get rid of window.platform:setBackgroundColor() and replace it with a gc:fillRect().

I'm going to test if its a bug on the emulator, first. The emulator sure does have a lot of bugs.
Edit: Not the emulator ):

Edit 2: Its exactly the last two rows of numbers that don't get drawn.
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

Have you managed to fix it yet? Also will it require multiple versions for each OS? Also which emulator do you use?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Strontium

1. I managed to fix it. Some rounding functions in Luas math module thing worked differently between API versions for some reason.
2. Nope!
3. The one in the TI Student Software.
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

Awesome to hear. :D Also how is the speed?

As for TI Student software it's not an emulator but a simulator. It emulates the OS rather than the calc. As a result, like with the HP Prime simulator, some stuff will be different in it. (although it shouldn't happen)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Strontium

#8
Ah. I always thought it was an emulator :P

And I havent tested it on calc yet, soo...

Let me finish the thing and then I'll test it.

-- some time later --

There is a bug I am completely lost on for the cause :P
There is a bug that allows you to escape the grid on the Y axis. I have no clue why it happens, but I've noticed its usually when a move will land you directly outside the grid. I assume this also applies to the X axis.

-- longer time later --

Haha! The grid was just getting rendered to high, and thus causing the top row to be hidden. Its fixed now :P

@DJ Omnimaga There was no problem with math.floor() :P
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

Awesome to hear. I'll definitively give it a try when I have a chance. :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Jonius7

Good to see you are making nice progress on a Lua project :)
  • Calculators owned: Casio CFX-9850, TI-Nspire
  • Consoles, mobile devices and vintage computers owned: HTC One, Huawei Honor 10
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC TI-nspire Hold 'em Health Bar Scissors Paper Rock
TI-nspire Lua Numstrat TI-nspire Hold 'em Lua Transport Chooser Secret Project (at v0.08.2 - 2015/05/08)

Dream of Omnimaga

So any estimate about when an OS 3.1 compatible version will come out? I tried the latest version on it and it tells me I need to upgrade. :(
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Strontium

Really? Thats strange. It uses apiLevel 1.0
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Dream of Omnimaga

Yeah I launched your program and I got told to upgrade. Unless you absolutely have to save the program using OS 3.1 or set its version to 3.1?You might need to ask how in a separate topic.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Strontium

Quote from: DJ Omnimaga on May 18, 2015, 10:37:49 PM
Yeah I launched your program and I got told to upgrade. Unless you absolutely have to save the program using OS 3.1 or set its version to 3.1?You might need to ask how in a separate topic.

Perhaps if I compile it into a .tns with Luna it may work, but I do not have the resources needed atm.
  • Calculators owned: TI Nspire CX, HP Prime
  • Consoles, mobile devices and vintage computers owned: NES

Powered by EzPortal