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.


Messages - Rhombicuboctahedron

Pages: 1 ... 33 34 [35]
511
TI-Nspire / Re: TI-nspire Hold 'em - Basic and Lua
« on: October 13, 2012, 07:07:52 pm »
I stole (borrowed) some of Jim’s Klondike code, and made what I thought a general template might be. The code is very inefficient, but it gets the job done.

I also looked at your plan
1. Determine what type of hand a player has.
Well, if you understand the code that the BASIC version used, you should just be able to transcribe this. Otherwise, just compare the seven cards, and return the rank of the hand (1 for straight flush, 2 for four of a kind, ect) and the highest card of that set (1 for ace, 2 for king) and compare the ranks, and if the same, the highest card

I made a general template that shows two random (and I believe never the same) cards, and then the five cards one at a time. If I remember how to play the game.


512
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: October 13, 2012, 03:30:05 pm »
I guess free software and a slow computer are good then.
I used some software I downloaded off of the internet to take a video minecraft of my computer. That video already had a slow frame rate. Then when I used xacto’s automatic converter, and put it on my calculator, it was even slower. But the film was real. I did have an image of minecraft on my calculator. You can believe that because you can see the reflection of the camera.

513
Lua / Re: Hitboxes
« on: October 13, 2012, 02:46:02 pm »
I have only ever used lists with single values, and not classes, but would you be able to use lists to define the hitboxes
Code: [Select]
hitBox={}
hitBox[1] = HitBoxSquare(x, y, widht, height)
hitBox[2] = HitBoxSquare(x, y, widht, height)
hitBox[3] = HitBoxSquare(x, y, widht, height)
That way you could efficiently do something to all of them
Code: [Select]
for num=1,10 do
something
end

514
TI-Nspire / Re: TI-nspire Hold 'em - Basic and Lua
« on: October 13, 2012, 12:52:08 pm »
Okay, I changed it a little to get it to work, but a big problem was that you were trying to compare a number and a string.
However, I noticed that if you multiply the string of a number by one, it makes it that number.
Also, I moved the congrats and correcting strings into the function on.paint(gc) section
My changes are probably w=quite ugly and inefficient, but it gets all the way to the “lets get rolling” string

Code: [Select]
--[[TI-nspire Hold 'em - A Lua Remake
History:
v0.01 Created 2012/09/23 really started working 2012/10/07
Buggy can hardly do anything, currently can change Chips, Big Blind, Small Blind]]--

function init_variables()
  cc=0
  bb=0
  sb=0
  gopt=1
  scrn=1
  message=""
end

init_variables()
 
 function on.paint(gc)
    gc:setFont("sansserif","r",10)
    gc:setColorRGB(0,0,0)
  -- gc:setPen("thin","smooth")  Is this necessary?
  if scrn==1 then
   gc:drawString("[c] Chips        " .. cc,10,10,"top")
   gc:drawString("[b] Big Blind    " .. bb,10,25,"top")
   gc:drawString("[s] Small Blind  " .. sb,10,40,"top")
   gc:drawRect(10,70,20,20)
   if message=="wrong" then
       gc:drawString("Check these conditions",10,70,"top")
    gc:drawString("Chips between 100 and 10 million",10,85,"top")
    gc:drawString("Big blind between 0.001 and 0.1 Chips",10,100,"top")
    gc:drawString("Small blind between 0.01 and 0.5 Big Blind",10,115,"top")
    end
  elseif scrn==3 then
   gc:drawString("Right let's get rolling!",10,10,"top")
  end
  if scrn==2 then
   if message=="congrats" then
    gc:drawString("Congrats! Settings set up correctly",10,70,"top")
   end
   end
 end

function on.charIn(ch)
  if ch >= "0" and ch <= "9" then    -- checking for digit inputs
   if scrn==1 then
    if gopt==1 then
     if string.len(cc) <= 7 then   -- limit string length
      cc = cc .. ch            -- concatenate
      platform.window:invalidate()   -- screen refresh
     end
    elseif gopt==2 then
     if string.len(bb) <= 6 then -- and sb <= 0.1bb then   -- limit string length and bb to <= 0.1cc (now moved)
      bb = bb .. ch            -- concatenate
      platform.window:invalidate()   -- screen refresh
     end
    elseif gopt==3 then
     if string.len(sb) <= 6 then -- and sb <= 0.1bb then   -- limit string length and sb to <= 0.1bb (now moved)
      sb = sb .. ch            -- concatenate
      platform.window:invalidate()   -- screen refresh
     end
    end
   end
  end
--Game settings keys
  if scrn==1 then
   if ch=="c" then     --Ok there must be a way to optimise this block
    gopt = 1   
  elseif ch=="b" then
    gopt = 2
   elseif ch=="s" then
    gopt = 3
   end
   platform.window:invalidate()
  end
end

function on.enterKey()
cc=1*cc
bb=1*bb
sb=1*sb
  if scrn==2 then
   scrn=3
  end
  if scrn==1 and cc >= 100 and cc <= 10000000 and bb >= 0.001*cc and bb <= 0.1*cc and sb >= 0.01*bb and sb <= 0.5*bb then
    message="congrats"
    scrn=2
    gopt=0
   else
    message="wrong"
   end
   
end

function on.backspaceKey()
  if gopt==1 then     --Ok there must be a way to optimise this block. Again.
   cc = string.usub(cc,0,-2)  -- deleting last char
    elseif gopt==2 then
   bb = string.usub(bb,0,-2)  -- deleting last char
 elseif gopt==3 then
   sb = string.usub(sb,0,-2)  -- deleting last char
 end
    platform.window:invalidate() 
end

platform.window:invalidate()

515
Other Calc-Related Projects and Ideas / Re: Weekly Programming Challenges
« on: October 13, 2012, 11:51:01 am »
I believe this would be very easy to do with OS 3.2 Lua Physics.
That allows for weight and springs, and a lot of other things too.
But I am still learning the functions, so I can’t program this.

516
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: October 13, 2012, 11:46:35 am »
Yeah, I did some quick Google searches, and I think the cx is good on memory and cpu, but its about 960 MB shy of the required ram

517
TI-Nspire / Re: TI-nspire Hold 'em - Basic and Lua
« on: October 13, 2012, 11:37:26 am »
Well, when I ran it with the script editor, pressing c, b and s works fine, as well as backspace and typing numbers, and not typing letters.
However, when I press enter, it just goes blank, instead of displaying congrats or the other four strings. I tried using some functions, such as var.recall or var.recallStr, that I thought should convert strings to values, like “0” to 0. That did not work.

In the end, I found the problem

plat form . gc ( )
Returns a dummy graphics context. It is typically used to measure pixel lengths and
heights of strings when a normal graphics context is not available. This may be the case
when creating new text elements when the script app is initialized. A graphics context
is available only during paint events, and that may be too late to create and size the
containers for text _elds.
This graphics context should not be used to draw graphics because it is not guaranteed to
be associated with a window.
Introduced in platform.apiLevel = "1.0"
Removed in platform.apiLevel = "2.0"

So, I was using level 2.0, and it also says not to use it for drawing graphics such as strings.
It may still work on OS 3.1, but if I’m not mistaken, I believe you changed to OS 3.2 in the OS compatibility post.

518
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: October 13, 2012, 11:13:00 am »
Oh, sorry if I actually fooled anyone. I was actually using the Nspire Movie Player. I thought it might have been funny to make a video like this.

519
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: October 12, 2012, 08:36:45 pm »
I changed some of the code to add more textures and items, and added a further view distance
However, this made the program lag more
http://youtu.be/H858JBR6SJc

520
TI-Nspire / Re: Nspire Movie Player - alternative to nPlayer
« on: October 10, 2012, 10:47:17 pm »
Hey, I thought I’d finally make an account to tell you it works.
http://youtu.be/lZ6twVbhzpg
Not the fastest, or the best quality, but half of the quality is due to my camera.
Thanks for making the converter.

Pages: 1 ... 33 34 [35]