Jump to content

User:Lucas Brown: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
mNo edit summary
Line 39: Line 39:




:#define USE_TI89
|#define USE_TI89
|
:
:#define OPTIMIZE_ROM_CALLS
|#define OPTIMIZE_ROM_CALLS
|
:
:#include <tigcclib.h>
|#include <tigcclib.h>
:
:
:
:

Revision as of 23:56, 27 October 2008

Hello all...

I am a sophomore at Rancho Bernardo High School, and my involvement there used to be, in addition to regular classwork, playing the Euphonium their band, the Royal Regiment, as well as the Academic League, in which I was the star player on the Freshman team, but scheduling issues have forced me to drop band. The new season of AL has not yet begun, so I do not know how I shall fare this year. Aside from AL, I am known for being just about the smartest student the school has, seeing as I have eclipsed the highest level of mathematics they have to offer.

That is all for now. I may write more in the future.




|#define USE_TI89 | |#define OPTIMIZE_ROM_CALLS | |#include <tigcclib.h>

void _main(void)
{
static short int A[51][81];
static short int B[51][81];
int s = 0;
int n = 0;
int x = 0;
int y = 0;
int xx = 80;
int yy = 50;
int key = 0;
/*
for(y = 1; y < 50; y++)
{
for(x = 1; x < 80; x++)
{
A[y][x] = 0;
}
}
*/
memset(A, 0, 4131 * sizeof(short));
while (key!=KEY_ESC && key != KEY_F3){
if (kbhit()){
key = ngetchx();
if (key==KEY_UP && yy > 1)(yy--);
if (key==KEY_DOWN && yy < 50-1)(yy++);
if (key==KEY_RIGHT && xx < 80-1)(xx++);
if (key==KEY_LEFT && xx > 1)(xx--);
if (key==KEY_F1)(A[yy][xx]=1);
if (key==KEY_F2)(A[yy][xx]=0);
if (key==KEY_F4)
{
randomize();
for(y=1;y<50;y++){
for(x=1;x<80;x++){
A[y][x] = random(2);
}
}
}
if (key==KEY_F5)
{
memset(A, 0, 4131 * sizeof(short));
}
}
DrawPix(2*xx,2*yy,A_NORMAL);
DrawPix(2*xx+1,2*yy,A_NORMAL);
DrawPix(2*xx,2*yy+1,A_NORMAL);
DrawPix(2*xx+1,2*yy+1,A_NORMAL);
for(y = 1; y < 50; y++)
{
for(x = 1; x < 80; x++)
{
if(A[y][x] == 1)
{
DrawPix(2*x,2*y,A_NORMAL);
DrawPix(2*x+1,2*y,A_NORMAL);
DrawPix(2*x,2*y+1,A_NORMAL);
DrawPix(2*x+1,2*y+1,A_NORMAL);
}
else
{
DrawPix(2*x,2*y,A_REVERSE);
DrawPix(2*x+1,2*y,A_REVERSE);
DrawPix(2*x,2*y+1,A_REVERSE);
DrawPix(2*x+1,2*y+1,A_REVERSE);
}
}
}
}
while (key!=KEY_ESC){
if (kbhit()){
key = ngetchx();
if (key==KEY_UP && yy > 1)(yy--);
if (key==KEY_DOWN && yy < 50-1)(yy++);
if (key==KEY_RIGHT && xx < 80-1)(xx++);
if (key==KEY_LEFT && xx > 1)(xx--);
if (key==KEY_F1)(A[yy][xx]=1);
if (key==KEY_F2)(A[yy][xx]=0);
if (key==KEY_F3)
{
key = 0;
goto input;
}
if (key==KEY_F4)
{
randomize();
for(y=1;y<50;y++){
for(x=1;x<80;x++){
A[y][x] = random(2);
}
}
}
if (key==KEY_F5)
{
memset(A, 0, 4131 * sizeof(short));
}
}
else{
key = 0;
}
DrawPix(2*xx,2*yy,A_NORMAL);
DrawPix(2*xx+1,2*yy,A_NORMAL);
DrawPix(2*xx,2*yy+1,A_NORMAL);
DrawPix(2*xx+1,2*yy+1,A_NORMAL);
for(y = 1; y < 50; y++)
{
for(x = 1; x < 80; x++)
{
n = A[y][x];
s = A[y-1][x-1]+A[y-1][x]+A[y-1][x+1]+A[y][x-1]+A[y][x+1]+A[y+1][x-1]+A[y+1][x]+A[y+1][x+1];
B[y][x] = 0;
if((n == 1 && s == 2) || s == 3)
{
B[y][x] = 1;
}
}
}
for(y=1;y<50;y++){
for(x=1;x<80;x++){
if (B[y][x]==1){
DrawPix(2*x,2*y,A_NORMAL);
DrawPix(2*x+1,2*y,A_NORMAL);
DrawPix(2*x,2*y+1,A_NORMAL);
DrawPix(2*x+1,2*y+1,A_NORMAL);
}
else {
DrawPix(2*x,2*y,A_REVERSE);
DrawPix(2*x+1,2*y,A_REVERSE);
DrawPix(2*x,2*y+1,A_REVERSE);
DrawPix(2*x+1,2*y+1,A_REVERSE);
}
A[y][x] = B[y][x];
}
}
}
memcpy(LCD_MEM, screen, LCD_SIZE);
free(screen);
}