I have been trying to make something in lua for the nspire for hours now. I could not make anything at all that came even close to 140 bytes in source size. Anyways, I look forward to the next competition. Hopefully I will be able to do something.
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.
Show posts MenuQuote from: SiphonicSugar on September 22, 2015, 08:33:14 PM
Oh yeah, another depressing thing. (Sorry to mention it but I feel like I should) I keep finding topics and threads here and on Omnimaga especially about RPGs that people are going to make. They all seem like really good ideas, but the creators just drop the idea or something because they have not posted about it in like a year.
int board[][]=new int[8][8];
int playBoard[][]=new int[8][8];
int boardSize=8;//change this for different board sizes
int X=0;
int Y=0;
int maxNum=12;
boolean play=false;
int prevX=-1;
int prevY=-1;
import java.util.Arrays;
void settings(){
size(800,800);
}
void setup(){
board=new int[boardSize][boardSize];
playBoard=new int[boardSize][boardSize];
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
board[i][j]=0;
}
}
}
void fillColor(int i, int j){
int temp;
if(!play)
temp=board[i][j];
else
temp=playBoard[i][j];
if(temp>maxNum)
temp-=maxNum;
switch (temp) {
case 1: fill(255, 0, 0);
break;
case 2: fill(0, 0, 255);
break;
case 3: fill(0, 255, 0);
break;
case 4: fill(255, 255, 0);
break;
case 5: fill(255, 128, 0);
break;
case 6: fill(0, 255, 255);
break;
case 7: fill(128, 0, 0);
break;
case 8: fill(0, 128, 0);
break;
case 9: fill(255, 30, 128);
break;
case 10: fill(128, 15, 128);
break;
case 11: fill(128, 128, 128);
break;
case 12: fill(255, 255, 255);
break;
default: fill(0, 0, 0);
break;
}
}
void mouseClicked(){
if( !play){
if(board[X][Y]<maxNum)
board[X][Y]+=1;
else
board[X][Y]=0;
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
if(board[i][j]>0)
print(Integer.toString(board[i][j]*2-1));
else
print(Integer.toString(0));
if(j<boardSize-1)
print(",");
}
print(" ");
}
println();
}
else{
if(playBoard[X][Y]==0 || playBoard[X][Y]>maxNum){
if(X>=0 && X<boardSize && Y>=0 && Y<boardSize){
if(playBoard[X][Y]==0 && prevX>-1 && prevY>-1)
playBoard[X][Y]=board[prevX][prevY]+maxNum;
}
}
else{
prevX=X;
prevY=Y;
}
}
}
void draw(){
fill(0,0,0);
rect(0,0,width,height);
stroke(250,255,255);
for(int i=0;i<=boardSize;i++){
line(0, i*height/boardSize, width, i*height/boardSize);
line(i*width/boardSize, 0, i*width/boardSize, height);
}
X=mouseX*boardSize/width;
Y=mouseY*boardSize/height;
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
noStroke();
if(!play){
fillColor(i,j);
ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/2, height/boardSize/2);
}
else{
if(playBoard[i][j]>0 && playBoard[i][j]<=maxNum){
fillColor(i,j);
ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/2, height/boardSize/2);
}
else{
fillColor(i,j);
ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/4, height/boardSize/4);
}
}
}
}
}
void keyPressed(){
if(keyCode==RIGHT){
play=true;
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
playBoard[i][j]=board[i][j];
}
}
}
if(keyCode==LEFT){
play=false;
}
}
int board[][]=new int[8][8];
int boardSize=8;//change this for different board sizes
int X=0;
int Y=0;
int maxNum=12;
import java.util.Arrays;
void settings(){
size(800,800);
}
void setup(){
board=new int[boardSize][boardSize];
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
board[i][j]=0;
}
}
}
void mouseClicked(){
if(board[X][Y]<maxNum)
board[X][Y]+=1;
else
board[X][Y]=0;
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
if(board[i][j]>0)
print(Integer.toString(board[i][j]*2-1));
else
print(Integer.toString(0));
if(j<boardSize-1)
print(",");
}
print(" ");
}
println();
}
void draw(){
fill(0,0,0);
rect(0,0,width,height);
stroke(250,255,255);
for(int i=0;i<=boardSize;i++){
line(0, i*height/boardSize, width, i*height/boardSize);
line(i*width/boardSize, 0, i*width/boardSize, height);
}
X=mouseX*boardSize/width;
Y=mouseY*boardSize/height;
for(int i=0;i<boardSize;i++){
for(int j=0;j<boardSize;j++){
noStroke();
switch (board[i][j]) {
case 1: fill(255, 0, 0);
break;
case 2: fill(0, 0, 255);
break;
case 3: fill(0, 255, 0);
break;
case 4: fill(255, 255, 0);
break;
case 5: fill(255, 128, 0);
break;
case 6: fill(0, 255, 255);
break;
case 7: fill(128, 0, 0);
break;
case 8: fill(0, 128, 0);
break;
case 9: fill(255, 30, 128);
break;
case 10: fill(128, 15, 128);
break;
case 11: fill(128, 128, 128);
break;
case 12: fill(255, 255, 255);
break;
default: fill(0, 0, 0);
break;
}
ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/2, height/boardSize/2);
}
}
}
Page created in 0.061 seconds with 31 queries.