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 - ruler501

Pages: 1 ... 33 34 [35] 36 37 ... 184
511
Site Feedback and Questions / Re: Under 50 posts/day??? Yikes!
« on: July 30, 2012, 05:41:29 pm »
Honestly I think a greater emphasis on more viable programming platforms may help traffic. Prizm's, 83's/84's and computers are pretty unlocked while the nspire periodically gets unlocked and then blocked again a few months later. I am not by any means advocating leaving the nspire but I'm saying that we should emphasize some other kinds of  work also. I still say that if we could get the computer section up and running so that it is used a good amount more then it currently is being used then it would help the whole site. Also as others have said the prizm is here and its open a port of axe or of other languages to it may help it even more so that you could have everyone be able to develop for it.

512
General Discussion / Re: Learning to write music
« on: July 30, 2012, 03:20:03 am »
I'm working on adding this into the solo I'll post the fixed up version tomorrow(well technically today now)

513
General Discussion / Re: Learning to write music
« on: July 30, 2012, 12:14:39 am »
If you could talk about chords that would be nice. I want to learn as much as I can

514
General Discussion / Learning to write music
« on: July 29, 2012, 11:18:41 pm »
I currently play saxophone/clarinet and am going to learn how to play piano probably. I would like to learn how to write good music. What would be a good way to learn how to write good music? I have messed around with musescore before and gotten some success but they never sound quite right. I would also like to know how to understand how music works when listening to it. I would be very thankful for any free online resources for learning.

Attatched is one solo i tried to write about a week ago so you have an idea of what i know(just enough to play the instrument :P )
EDIT temporarily removed pdf so i could remove my real name

515
Casio Calculators / Re: pSDL v1.0.0
« on: July 01, 2012, 09:14:14 am »
Image Loading Cross Post from Cemetech

I couldnt get 8 bit working but heres the function that correctly loads 16 bit
Code: [Select]
SDL_Surface* LoadSCImage(Uint16* image, int x, int y)
{
SDL_Surface  *rimage, *tempsurf =  SDL_CreateRGBSurfaceFrom(image, x, y, 16, 2*x, PZM_RMASK16,PZM_GMASK16,PZM_BMASK16,0);
rimage = SDL_DisplayFormat(tempsurf);
SDL_FreeSurface(tempsurf);
return rimage;
}

I'll compile this and a few things from hoffa's nSDL to a seperate library when i came back to work on this in August

517
Casio Calculators / Re: pSDL v0.1.0
« on: June 30, 2012, 03:33:29 pm »
I think I will implement that too.
I'll be putting these in a second library called pSDLlib so that my pSDL port remains SDL and pSDLlib is an addition for easier use
thanks hoffa.

518
Casio Calculators / Re: pSDL v0.1.0
« on: June 30, 2012, 12:36:30 pm »
I need some help getting basic image loading working. I use the two arrays from sourcecoders conversion to 8 bit to create the surface. the image appears to be blue shifted on everything.

Code: [Select]
SDL_Color rgb16to24(Uint16 x)
{
SDL_Color newcolor;
newcolor.b= (x & 0x1F) * 8;
        newcolor.g = ((x >> 5) & 0x2F)* 4;
    newcolor.r = ((x >> 11) & 0x1F)* 8;
return newcolor;
}

SDL_Surface* LoadSCImage(Uint16* pallete, int paletteSize, unsigned char* image, int x, int y)
{
int i, j;
SDL_Color newColors[paletteSize];
for (i = 0; i < paletteSize; i++)
{
newColors[i] = rgb16to24(pallete[i]);
}
SDL_Surface  *tempsurf = SDL_CreateRGBSurface( SDL_SWSURFACE, x, y, 8, 0,0,0,0);
for (i = 0; i < y; i++)
{
for (j=0; j < x; j++)
{
*(Uint8 *)(tempsurf->pixels + i*tempsurf->pitch + j) = image[i*x + j];
}
}
SDL_SetColors(tempsurf, newColors, 0, paletteSize);
return tempsurf;
}

519
Casio Calculators / Simon: The first pSDL game
« on: June 30, 2012, 12:03:16 pm »
I created Simon the memory game for prizm using pSDL to show the basics of what it can currently do(I'm working on image loading and I may be able to finish before I leave tomorrow).
At the first menu heres what you can do
Press 1 to start it with text at the bottom for which arrow it maps to
press AC/ON to start without the help
press esc to exit

while it is running it will who each color/help if you enabled it for 3/4 of a second and then once all are shown it will go to black and you can start inputing arrows and the screen will change to the appropriate color
if you manage to get to 25 correct you win(the game)

My code is not exactly the best example of SDL code but here it is...
Spoiler For code:
Code: [Select]
#include <SDL.h>
#include <fxcg_syscalls.h>
#include <fxcg/display.h>
#include <stdlib.h>
#include <string.h>

static unsigned long next = 1;
/* RAND_MAX assumed to be 32767 */
int sys_rand(void) {
    next = next * 1103515245 + 12345;
    return((unsigned)(next/65536) % 32768);
}

void sys_srand(unsigned seed) {
    next = seed;
}


int main()
{
SDL_Surface *screen;
int i, j, k, width, height, bpp, done=0, printCase=0, win=1;
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER);
width = 384;
height = 216;
bpp = 8;
SDL_Color palette[5];
palette[0].r=255; palette[1].g=0; palette[1].r=0;
palette[1].r=0; palette[2].g=255; palette[2].b=0;
palette[2].r=0; palette[3].g=0; palette[3].b=255;
palette[3].r=255; palette[0].g=255; palette[0].b=255;
palette[4].r=0; palette[4].g=0; palette[4].b=0;
screen = SDL_SetVideoMode(width, height, bpp, SDL_SWSURFACE);
SDL_SetColors(screen, palette, 0, 4);
if (screen == NULL) return -1;
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_UpdateRect(screen, 0, 0, 0, 0);
PrintXY(1, 1, "XXPress AC/ON to start", 0x20, TEXT_COLOR_WHITE);
PrintXY(1, 2, "XXPress Esc to Exit", 0x20, TEXT_COLOR_WHITE);
PrintXY(1, 3, "XXPress 1 for help", 0x20, TEXT_COLOR_WHITE);
Bdisp_PutDisp_DD();
while (!done)
{
while(SDL_PollEvent(&event)) {
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
return 0;

case SDLK_POWER:
done = 1;
break;

case SDLK_1:
printCase = 1;
done = 1;
break;

default:
break;
}
}
}
if (SDL_GetTicks() > 10000) return 0;
    }
    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));
    SDL_UpdateRect(screen, 0, 0, 0, 0);
    unsigned char set[25];
    unsigned char choice[25];
    sys_srand(SDL_GetTicks());
    for ( i=0; i<25; i++)
    {
set[i] = sys_rand() % 4;
}
for (i=0; i<25; i++)
{
for (j=0; j<i; j++)
{
memset(screen->pixels, set[j], width*height);
SDL_UpdateRect(screen, 0, 0, 0, 0);
if (set[j] > 3)
return -1;
if (printCase)
{
switch (set[j])
{
case 0:
PrintXY(18, 7, "XXUP", 0, TEXT_COLOR_BLACK);
break;

case 1:
PrintXY(16, 7, "XXRIGHT", 0, TEXT_COLOR_BLACK);
break;

case 2:
PrintXY(16, 7, "XXDOWN", 0, TEXT_COLOR_BLACK);
break;

case 3:
PrintXY(16, 7, "XXLEFT", 0, TEXT_COLOR_BLACK);
break;
}
Bdisp_PutDisp_DD();
}
SDL_Delay(750);
}
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0,0,0));
SDL_UpdateRect(screen, 0,0,0,0);
k=0;
while (k<i)
{
while(SDL_PollEvent(&event)) {
if (event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_UP:
choice[k]=0;
memset(screen->pixels, 0, width*height);
SDL_UpdateRect(screen, 0, 0, 0, 0);

k+=1;
break;

case SDLK_RIGHT:
choice[k]=1;
memset(screen->pixels, 1, width*height);
SDL_UpdateRect(screen, 0, 0, 0, 0);
k+=1;
break;

case SDLK_DOWN:
choice[k]=2;
memset(screen->pixels, 2, width*height);
SDL_UpdateRect(screen, 0, 0, 0, 0);
k+=1;
break;

case SDLK_LEFT:
choice[k]=3;
memset(screen->pixels, 3, width*height);
SDL_UpdateRect(screen, 0, 0, 0, 0);
k+=1;
break;

case SDLK_ESCAPE:
win=0;
i=100;
k=105;
break;


default:
break;
}
}
}
}
for (j=0; j<i; j++)
{
if (set[j] != choice[j])
{
win=0;
i=100;
}
}
}
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_UpdateRect(screen, 0, 0, 0, 0);
if (win == 0) PrintXY(1, 1, "XXSorry You have lost", 0x20, TEXT_COLOR_WHITE);
else PrintXY(1, 1, "XXYou have won the game!", 0x20, TEXT_COLOR_WHITE);
Bdisp_PutDisp_DD();
SDL_Delay(2000);
return 0;
}

EDIT: fixed error where esc could lock up calc



520
Minecraft Discussion / Re: Cracked Minecraft Hunger Games Server!
« on: June 28, 2012, 12:01:12 am »
I'll play just I lose computer access till august starting sunday...

521
Math and Science / Re: Least amount of change
« on: June 26, 2012, 10:12:01 pm »
I brute forced it too to see if that might show something other then the bring nothing

heres the code it runs with the standard C lib
Code: [Select]
#include <stdio.h>

typedef struct ChangeStruct
{
int pennies;
int nickels;
int dimes;
int quarters;
int amount;
} Change;

Change calculateChange(int amount)
{
int tempamount = amount;
Change result = {0,0,0,0,amount};
if (tempamount >= 25)
{
result.quarters = amount / 25;
tempamount -= result.quarters * 25;
}
if (tempamount >= 10)
{
result.dimes = tempamount / 10;
tempamount -= result.dimes * 10;
}
if (tempamount >= 5)
{
result.nickels = 1;
tempamount -= 5;
}
if (tempamount > 0)
{
result.pennies = tempamount;
}
return result;
}

int countCoins(Change counted)
{
int total;
total = counted.pennies + counted.nickels + counted.dimes + counted.quarters;
return total;
}

Change subtractChange(Change first, int second)
{
if (first.amount > second) return calculateChange(first.amount - second);
else return calculateChange(second - first.amount);
}

void printCoins(Change printNeeded)
{
printf("%d pennies\n%d nickels\n%d dimes\n%d quarters\n", printNeeded.pennies, printNeeded.nickels, printNeeded.dimes, printNeeded.quarters);
}

int main()
{
int smallestTotal, smallestE, currentE, smallestL, currentL, total;
Change smallestCoins, currentCoins, subtractCoins, returnCoins;
double smallestAverage=100.0, currentAverage;
for ( int i=0; i<100; i++)
{
total = 0;
currentCoins = calculateChange(i);
currentE = countCoins(currentCoins);
for ( int j=0; j<100; j++)
{
currentL = countCoins(subtractChange(currentCoins, j));
total += currentL + currentE;
}
currentAverage = total / 100.0;
if (currentAverage < smallestAverage)
{
smallestAverage = currentAverage;
smallestTotal = currentL + currentE;
smallestE = currentE;
smallestCoins = currentCoins;
}
}
printCoins(smallestCoins);
printf("With average %f\n", smallestAverage);
printf("Entered with %d coins\n", smallestE);
}

and the result was
0 pennies
0 nickels
0 dimes
0 quarters
With average 4.700000
Entered with 0 coins

This seems wrong to me so please help me find if there is an error in my code

EDIT: I fixed it so that 0 coins was an option

522
Math and Science / Re: Least amount of change
« on: June 26, 2012, 09:06:10 pm »
nitacku you need to reduce the amount entered and left with put together

523
Casio Calculators / Re: pSDL v0.1.0
« on: June 26, 2012, 01:21:07 pm »
Though i think I'll have to port SDL_image so we can use smaller images then bmp(though I'm still not sure if bmp loading works currentlly)

EDIT: since file i/o currently doesnt work I'll find a way to implement the header based images everyone else used for SDL

524
Math and Science / Re: Least amount of change
« on: June 26, 2012, 02:18:36 am »
or you bring 3/4 that will reduce what you get back

525
Math and Science / Re: Least amount of change
« on: June 26, 2012, 01:16:34 am »
time to brute force it :P
I could write a program to do that but i think someone should make the proof first of what is best

Pages: 1 ... 33 34 [35] 36 37 ... 184