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

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.

Show posts Menu

Topics - semiprocoder

#1
PC, Mac & Vintage Computers / Color Speedrun[unity]
February 21, 2017, 03:04:58 AM
Well, I decided to make another game.
It is a speedrun game, with the simple goal of reaching anything blue(with rgb of 0, 0, 255. Also opens up possibility of trolling :P)(thinking of having a level with like 1 blue pixel in the beginnning that is hard to get).
Anyways, so yeah, its that simple. Black is regular speed. White makes you go fast. Grey makes you go slow. Yellow is wall, and red kills you. The hitbox is just the center of the circle, so I am planning to have the last level have a one or two pixel gap that you have to pass through.
The levels are just png or tif images, with each color corresponding to something.
So far I have made levels 1-3, and you can see that here:
https://www.youtube.com/watch?v=Qx3WkCaB-8I

EDIT(levels 1-5. And yeah I know I am terrible):
https://www.youtube.com/watch?v=sYQEohVG8iI
#2
So I kind of lost interest in programming for a while, but I can say that, at least for now, I am back(maybe?).
Anyways, I decided to make Conway's Game of Life, but with some modifications. So I originally meant to create a two player game in which each player either would try to snuff out the other or have more of "their own" cells or something along those lines after a certain time limit. However, I have completely changed my direction(might still try making a two player game) when I started to mess around with the physics of game of life.
If you don't know how the game works, I will just quote Wikipedia, as I am bad at explaining things:
QuoteThe universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead, or "populated" or "unpopulated" (the difference may seem minor, except when viewing it as an early model of human/urban behaviour simulation or how one views a blank space on a grid). Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overpopulation.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.

So, as I said, I decided to mess around with the rules a little bit. I decided to change the amount of living cells required to create a living cell, and I decided to change the amount of cells that a living cell can live with. Then I decided to add some color. The color is added by checking how many alive cells are near the cell BEFORE reproduction. I know this is weird, as it means that it is kind of outdated, and I am not sure whether adding color after reproduction will look better, but I am lazy to do that :P.

Anyways, the two attachments show the initial configuration for a system where the a cell can spawn if there are exactly 2 living cells next to it, and a cell can die if there are less than 2 or more that 6 living cells beside it. The color scheme is inverted to what I've generally seen, with dead cells being black, but I think this looks better. The initial configuration does have red lines, which signify walls, but I disabled walls for this game, so imagine them as nonexistent.

EDIT: I think this looks cool, despite a lot of quality being lost after conversions(obs record to mp4, then to mpeg in ffmpeg, then to gif in virtualdub): http://gph.is/2kYk3k3. This was done with the same + configuration, but cells come alive if there are 2-6 adjacent cells, and, as before, they stay alive with 2-6 adjacent cells.

SECOND EDIT: Added some more pictures that I think look pretty cool.
#3
Other / Flickr
January 01, 2017, 04:52:59 AM
Anyone here have a flickr? I just made one and put all my old photos(taken with my somewhat cheap phone) on it in anticipation for my new camera, which is already ordered and should come in 3-5 business days(although who knows what counts as a business day?).
https://www.flickr.com/photos/147393321@N07/with/31640907920/
(andrewk112)

EDIT: Happy new years everyone!
#4
So I recently watched carkh's videos on his evolution simulator, and they really interested me. Thus I have started making an evolution simulator of my own based on neural networks.

I have it partially completed, and I decided to have it simulate the prisoner's dilemma. If you don't know, the prisoner's dilemma goes like this: There are two parterns in crime, but they don't really know each other, and they individually told: "If you both don't confess about each other, you will both go to jail for x years." "If you confess and your partner does not, then you will be set free and your partner will go to jail for y years, and vice versa." "If you both confess, then you will both go to jail for z years."

Generally, x,y,z>0 and y>z>x, but I programmed it so that you are free to play around with the parameters.

So how the evolution part of this simulator works is that there are some amount of creatures(I am currently keeping it at 200 to prevent lag), and, at each step of the simulation, every creature is paired up with one other creature.

These two creatures then battle off in the prisoners dillema. Each creature outputs any number between 0 and 1. If that number is <0.5, then that means the creature confessed, and if it is >=0.5, then that means the creature didn't. After they each go once, they are each fed the ouput from their opponent's previous run(and the rounded outputs). Each pair of creatures plays ten games. At each game, each creature gets a sentence corresponding with the above rules.

Each creature also has two numbers: their total sentence and the number of times they played. The "fitness" of each creature is total sentence/number of times played. The creatures are then sorted by fitness, and the half of the creatures with the highest fitness is killed. The other half is reproduced and modified slightly, with the total sentence equaling the fitness of the parent and the number of times played equaling 1 to not give new creatures too much of a luck advantage.

So, since the normal prisoner's dillema would be boring, as each creature is obviously going to evolve to always confess, I decided to set x(or the sentence for both creatures confessing)<=0.0 to spice things up a bit.

Here is a picture(I can give more explanations, but the main thing is that the bottom graph represents the best fitness of any creature at any moment. The creatures generally tend to all confess or all not confess). In this case, x=-0.01, y=10.0, and z=3.5:



Anyways, my code was written in eclipse with processing and has multiple files(Note that x, y, and z are stored in an array called fitnessSettings in the class Creature):
https://www.dropbox.com/s/b3fl8mvdetp724b/Neural Network.zip?dl=0
#5
I've recently started making a new pebble game that is inspired by the calculator game, phoenix. It is still going to be very different though. Anyways, I've written the very basic player movement and shooting code. Currently I am not releasing the source, but once it gets to an acceptable level, I will release it. Right now there is something going on with the pebble emulator, so I can't really get a screenshot right now, but I sill soon.

Edit: I've decided to make my github public: https://github.com/awesommee333/Arcade-Shooter

Note: this is a crosspost of my blog post on: http://andrewkrapivin.xyz/. I will mainly be posting updates there, but I will post the more major pebble updates here too. Also, should I post this on cemetech?

Edit: Well havent fixed the emulator, but decided to just take a picture of the physical watch:

#6
Hardware / Semiprocoder's Pebble Stuff
August 08, 2016, 12:37:37 AM
I just recently bought myself a pebble time. The battery life(for me) wasn't seven days(it was ~3), but I was using it a lot.
Since the pebble has a really neat sdk, I just finished my first project(pong) after perhaps a day or two of learning the sdk. I suspect that uploading and playing my game quite often wasn't good for battery life.
Anyways, does anyone else here have a pebble, and do you program it?

Here are my published pebble projects(will be updated once I make more):
https://apps.getpebble.com/applications/57a77b4022f5994a8f000af7
#7
I havent programmed for a while, so I decided to program another game: minesweeper. Another minesweeper game already exists, but it only supports 9x9 boards(I think), and it doesnt have any settings.

Thus here is the minesweeper I have made(temporarily called nSweeper). I have almost finished it. It is just missing a better gui for the game, a readme, and saving the games properly(so that you could open the game again and keep the games, as it only keeps the games in RAM as of right now).
#8
I havent really been active here for a while, so I just decided to post a small project I made just for fun, but wasn't going to release(as there are multiple other snake games already available). However, I decided to release it anyways(because why not?). Anyways, attached are the game and a gif of it.
#9
So, I've been trying to create plausible 3d, but I have no idea really how to, so I've just guessed at my own way of doing so.
Also, I've decided to make the only game I can with it(as rotation isn't really well done): curveball. It is a type of 3d pong.
Attached are a gif of the game and of a cube being rotated(note: right now curveball is at like 5-10 fps on calc, so I will need to so something about that).
#10
So I know there already exists a tunnel for the nspire, but it is really flashy and annoying and the difficulty doesnt progress(at least not noticeably).
Thus I decided to create my own tunnel game for the nspire. It is made it blocks, with each block being 10 pixels rather than one.
The only real issue I have right now with my game is that the movement is by presses and it isnt smooth. If there is any way to make it so that holding down the key is registered and releasing the key is registered, that would make making movement smooth so much easier, but unfortunately, I do not see any way to do that.
Attached are screenshots and the source.
#11
Now that I am done with the contest, I have decided to start making a new game-nationstates!
Currently it is practically featureless, and has two issues copied directly from nationstates(with @@RANDOMNAME@@, etc. I will replace that with an actual random name, and I plan to have some of my own features added on to nationstates.
Note: development on this game will probably be slow.
Heres a video of my game(DJ whats the name of that avi to gif recorder you use again?):
https://www.youtube.com/watch?v=HGqBmcVNioQ
#12
So, I have finally come up with a decent(ish, and I plan to maybe do something else if I come up with something else) idea to make a walrii game for. It is not very related to walriis but it is going to have (hopefully)many different walriis you can buy.

Essentially don't touch the spikes is an android and ios game similar to flappy bird where you move back and forth, trying to not touch the spikes. One thing I decided to omit was the top and bottom spikes, as rendering so many triangles lags my nspire and it provides less spikes on this already small screen.

I plan to have walriis as the sprites, but I currently have a red square, just for testing. I know this is a not very good explanation, but I hope it makes sense in the gif attached.

Any suggestions would be welcome.
#13
Recently, for cookie clicker and my idea for the contest(which I am still not sure about(it is basically going to be a don't touch the spikes remake if I decide on it)), I have been using something along these lines(this is for the game I am working on currently, and vel, coords, and accel are vectors):
edit: nvm, can't release code for contest
and similarly for cookie clicker:

  self.output*self.amt*(millis()-prevTime)/1000


I have for a while known that my cookie clicker game never gives the full income per second. I didn't think it was too much, as, even at optimal 30 fps, it would have an innacuracy of (3.3-3)/3.3, which is about only 10%, which, while being annoying, isn't too ridiculous.

However, over the time I have played my cookie clicker, I have noticed that the actual error is bigger than just 10%. Furthermore, a few minutes ago I looked at the documentation again to try to find something better than milliseconds, and noticed that even timer.getMilliSecCounter() doesn't even return the milliseconds with accuracy to a millisecond. It returns only with an accuracy of 0.02, which makes more sense with the numbers I get with cookie clicker.

Thus, the question I ask is this:
1. Are there any better ways to get time in lua?
2. What are some alternatives to using time to calculate the multiplier for accel/velocity?[/code]
#14
COOOOKIIEEEESSSS!!!!!!!!!!!


Yesterday I started working on cookie clicker for the nspire, and here is the first version of cookie clicker for the nspire. Right now it has 9 producers of cookies, including a walrus. It also supports upgrades for each tower and clicking(although I need to balance it a bit still).

Currently the help and settings menu don't do anything, and only game does anything. I may end up removing the settings menu, as I do not see any real use for it.

Controls: use arrow keys to scroll through menu and press enter to go into one of the parts. In the game click on the cookie or the producers to get buy or get extra cookies. Use left and right keys to scroll between the different producers of cookies.
Press 'u' to upgrade producers/mouse. Again click on what you want to upgrade and use arrow keys to scroll.

The images are taken from the actually cookie clicker images, and the background is just a random cool background I found online that I included in my files just to show that my code supports backgrounds. I hope to replace it with something else soon.

Edit:
First off, what do you think about me adding a potato(http://www.lulu.com/shop/rinardo/the-holy-scripture-of-rinardo/ebook/product-22008800.html). I am planning it to be right under walrus or even above it. Also I need to make everything more expensive, as it takes me about 30 mins to get even the walrus.

Here is the list of glitches I know about:

1. Font size:
Despite me setting the font size to 7, which is one of the values the ti nspire supposedly support, the font size stays default. This is really annoying because stuff has to be scrunched too far together and it often goes off screen.

2. Vars not saving properly:
This is probably my bad coding, but anyways, sometimes when you upgrade clicking it resets you clicking power to 0 and the cost to 3. I think I fixed this but I am not sure. Once I come up with larger changes I will update the downloads.
This is probably the most annoying glitch. This only has to do with the var "statsCookieSPC"(money, money per click, and upgrade cost for the money per click. It also only happens if you buy something ie. save something in the var "statsProducerSPC", which stores everything else

3. When you open the game again without closing it fully(like when you open another file), the game doesn't work at all. You have to open something else to make the game work again. Also think I have fixed this.
#15
Hi :). I am currently working on sudoku for the ti nspire, but I only have 2 levels for it right now, and don't want to post it until at least a good bit of levels have been made. I want to use a custom level generator,which outputs a file, the contents of which I will copy and past into my lua script for the game, or it that I started writing in c(well c++ technically, as I use the new and delete keywords cause im lazy), but I have little clue as to how to generate random sudoku generators. My first attempt at writing a complete sudoku board(withiout all the numbers missing in a puzzle, and that is something else I need help with) compeletely doesn't work, and I still am not sure as to how to improve it. I know why it doesn't work, but I have zero idea as to how to do it better. Anyways, here is my starting code for the generator. I am still going to try to fix it myself, but it would be great if someone could help me create a legit sudoku board generator.

Here is my code, which is horrible(and isnt random yet, it just uses the first value it can), but anyways:


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <stdlib.h>
const char* fileLoc = "C:\\Users\\Andrew\\vs\\sudoku\\easyLevels.txt";
FILE *myfile;
int board[9][9] = { { 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0 } };
void initFile() {
if ((myfile = fopen(fileLoc, "w")) == NULL) {
printf("didnt open");
return;
}
}
void closeFile() {
fclose(myfile);
}
void printBoard() {
fprintf(myfile, ",\"");
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
fprintf(myfile, "%d", board[i][j]);
if (j == 8) {
if(i!=8)
fprintf(myfile, "//");
}
else
fprintf(myfile, ",");
}
}
fprintf(myfile, "\" ");
}

void getPossibleMoves(int *possibleMoves[], int x, int y) {
int cpX = x / 3;
cpX *= 3;
int cpY = y / 3;
cpY *= 3;
int cpB[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++)
cpB[i][j] = board[cpX + i][cpY + j];
}
int psbleMoves[9] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
if (psbleMoves[i] == cpB[j][k])
psbleMoves[i] = 0;
}
}
for (int j = 0; j < 9; j++) {
if (psbleMoves[i] == board[x][j] || psbleMoves[i] == board[j][y])
psbleMoves[i] = 0;
}
}
int numMoves = 0;
for (int i = 0; i < 9; i++) {
if (psbleMoves[i] != 0)
numMoves++;
}
*possibleMoves = new int[numMoves + 1];//(int*)malloc((numMoves+1)*sizeof(int));
(*possibleMoves)[0] = numMoves;
int prevInt = 1;
for (int i = 0; i < 9; i++) {
if (psbleMoves[i] != 0) {
(*possibleMoves)[prevInt] = psbleMoves[i];
prevInt++;
}
}
}

void generateBoard() {
for (int i = 0; i < 9; i++)
board[0][i] = i+1;
for (int i = 1; i < 9; i++) {
for (int j = 0; j < 9; j++)
board[i][j] = 0;
}
int prevMove;
int *possibleMoves=new int[10];
int *prevMoves=new int[10];
for (int i = 1; i < 9; i++) {
for (int j = 0; j < 9; j++) {
prevMove = 0;
getPossibleMoves(&possibleMoves, i, j);
while (possibleMoves[0] == 0) {
prevMove++;
if (prevMoves[0] < prevMove) {
//generateBoard();
return;
}
else {
if (j != 0)
board[i][j-1] = prevMoves[prevMove + 1];
else
board[i - 1][8] = prevMoves[prevMove+1];
getPossibleMoves(&possibleMoves, i, j);
}
}
board[i][j] = possibleMoves[1];
prevMove = 0;
delete(prevMoves);
prevMoves = possibleMoves;
}
}
delete(possibleMoves);
}

int main() {
initFile();
generateBoard();
printBoard();
closeFile();
return 0;
}


By the way the output is ,"1,2,3,4,5,6,7,8,9//4,5,6,1,2,7,-33686019,-33686019,3//7,8,9,-33686019,-33686019,3,1,2,4//2,1,4,3,6,5,8,9,7//3,6,5,2,1,8,-33686019,-33686019,0//0,0,0,0,0,0,0,0,0//0,0,0,0,0,0,0,0,0//0,0,0,0,0,0,0,0,0//0,0,0,0,0,0,0,0,0"
so it doesn't finish and it doesn't have proper values at all.
Attached are what that looks like on the calculator(the really low negative values mess it up a lot), and an actual level. This is not a showcase of how the final game will look like, although I will not change it, but it just shows how the string converts to the look on the screen.
Btw here is the string for the working level that is attached: "1,0,0,0,0,0,4,8,0//5,0,0,3,0,0,0,0,2//2,0,9,0,0,4,3,5,0//8,0,6,0,5,0,0,4,3//4,2,3,0,0,0,5,7,0//0,1,5,4,0,0,9,0,0//0,0,0,0,8,0,0,0,9//6,5,0,0,9,3,0,0,4//0,8,2,6,4,0,0,0,5"
As you may be able to tell, the commas divide each element of a top down ninth of the board, and the //shes divide the top down pieces.
As you may also be able to tell, even the piece of the sudoku board that IS generated is not a legit sudoku board.
#16
I got my ti nspire about a month ago. For math it is actually pretty good, except for the fact that it doesnt calculate decimals for me. It is SOOOO annoying, and I can't find anything to have it calculate decimals. Now, when I want to calculate a decimal I have to get out my ti 84 and calculate it on that, which is really annoying. I read online somewhere that after a certain os version, the decimals were removed. Is there any way to work around this and enable decimals?
#17
How do you access mylib with lua, because I know that minecraft 2d does it it would be nice if I could do the same with my games. I want to be able to use it as a file as well, which I don't think, but hope, is possible. I want to be able to have some legit cross calc saving capabilities and make it easy to cross calc add new levels without redownloading your game and make it easy to add your own levels into flow and more.
#18
Hardware / Arduino Benchmark
September 29, 2015, 10:08:03 PM
About half a year ago I made a benchmark for the arduino because I wanted to see how much faster my then new arduino due was than my arduino uno and micro. I don't know why, but I decided that I will(perhaps, not sure yet) start programming arduino again(since that benchmark I pretty much didn't even touch arduino anymore). The main reason that I stopped arduino was cause I suck at hardware stuff so I couldn't really do anything special, but I did make pong(and I tried to make don't touch the spikes(an amazing remake of flappy bird), but resistive touchscreens are not really meant for capacitive uses), if anyone is interested.

Anyways, back to the arduinos and my benchmark. My benchmark has a large macro, which is divided by the time the arduino took to complete the benchmark. That time is the score the arduino gets at the end. The due turned out to indeed be a lot faster and got a score almost six times as big as the uno and micro, and, unsurprisingly, and my micro got a slightly lower(but practically insignificant) score compared to my uno. Here is my code:


#define ITER 200000L
#define SCORE_DIVIDER 99999999L
#define UNO_SCORE 563L// I might eventually use this to guess which arduino you are benchmarking
#define MICRO_SCORE 559L
#define DUE_SCORE 3301L
#define MALLOC_SIZE 256
void printFloat(float value, unsigned long precision){
   Serial.print(int(value));
   Serial.print(".");
   unsigned long frac;
   if (value >= 0)
      frac = (value - long(value)) * precision;
   else
      frac = (long(value) - value) * precision;
   Serial.println(frac, DEC);
}
void setup() {
   Serial.begin(57600);
   long Millis=millis();
   long increment = 0;
   float f = 0.0f;
   Serial.println("checking float performance using random");
   for (; increment < ITER; increment++) {
      f = random(0.0f, (float)increment);
   }
   Serial.print("rand performance time taken: ");
   Serial.println(millis() - Millis);
   Millis = millis();
   Serial.println("now calculating PI using Newtonian method...");
   long Millis2 = millis();
   float pi = 0.0f;
   float multiplier = 1.0f;
   for (float incrementf = 0.0f, increment=0; increment < ITER; incrementf+=1.0f, increment++){
      pi += 4.0f / (incrementf*2.0f + 1.0f)*multiplier;
      multiplier *= -1.0f;
   }
   Serial.print("PI estimating time: ");
   Serial.print(millis() - Millis2);
   Millis2 = millis();
   Serial.print(" PI estimate: ");
   Serial.println(pi, 8);
   Serial.println("About to test polar to rectangular coordinate conversion: ");
   long Millis3 = millis();
   float X = 0.0f;
   float Y = 0.0f;
   f = 0.0f;
   for (long i = 0L; i < ITER/3; i++, f+=PI/1000.0f){
      X = cos(f)*((float)i)/1000.0f;
      Y = sin(f)*((float)i) / 1000.0f;
   }
   Serial.print("Polar to rect coords converting time: ");
   Serial.println(millis() - Millis3);
   Serial.print("X: ");
   Serial.println(X, 8);
   Serial.print("Y: ");
   Serial.println(Y, 8);
   Millis3 = millis();
   Serial.println("now testing mem write speed(mallocing and freeing pointers):");
   long Millis4;
   for (long i = 0; i < ITER/4; i++){
      char *j = (char*)malloc(MALLOC_SIZE);
      char *f = j;
      for (int i = 0; i < MALLOC_SIZE; i++){
         *f = 'n';//just some random value to initialize the whole array of chars with
         f++;
      }
      free(j);
   }
   Serial.print("Ram test finished in: ");
   Serial.print(millis() - Millis4);
   Serial.println(" milliseconds");
   Serial.print("malloc size is: ");
   Serial.println(MALLOC_SIZE);
   Millis4 = millis();
   long score = Millis + Millis2 + Millis3+Millis4;
   score = SCORE_DIVIDER / score;
   Serial.println("Your arduino's score is: ");
   Serial.print(score);
}

void loop() {
}


-----------------------------------------

By the way, should I make myself a thread just for my old code(or just make this thread for all my code), cause I have a bunch of old codes I want to showcase(like pong for android, 2d minecraft in processing, 2048 in processing, a 2d platformer I made that I need to restore(well finish and fix not restore I don't have any way of doing that) because I made it on my school computer, so my comp doesn't have the working version and the version on my comp is outdated). Not all of it is polished or that good or anything, but some of my code(in my opinion) is not too bad.

Edit (Streetwalrus): merged double post.
#19
I need to create some images using strings in lua, first off to add support for old lua versions. Also I want to be able to manipulate it easily. I tried searching for tutorials on how to make images, but they all skip over it pretty much as if they assume the reader already knows it. Anyways, can someone tell me in depth how to create lua images. Thank you in advance.
#20
TMP edit: Here is the code that draws the level menu. I also uploaded what it looks like:

function drawNumsBoard(gc, sBX, sBY, sX, sY, bW, bH)--sB-sizeBoard, sX-startX, sY-startY, bW-boardWidth, bH-boardHeight
local sizeRectX=bW/sBX
local sizeRectY=bH/sBY
gc:setColorRGB(Colors[boardColor][2])
    for i=0, sBY do
        gc:drawLine(sX, sY+sizeRectY*i, sX+bW, sY+sizeRectY*i)
    end
for i=0, sBX do
gc:drawLine(sX+sizeRectX*i, sY, sX+sizeRectX*i, sY+bH)
end
gc:setColorRGB(Colors[numColor][2])
for i=1, sBY do
for j=1, sBX do
centerText(gc, tostring((i-1)*sBX+j), sX+sizeRectX*(j-1/2), sY+squareSize*(i-1/2))
end
end
gc:setColorRGB(Colors[cursorColor][2])
gc:drawRect(sX+X*sizeRectX, sY+Y*sizeRectY, sizeRectX, sizeRectY)
gc:setColorRGB(0x000000)
end


Here is the line of code that runs it: drawNumsBoard(gc, 10, 5, 0, 0, dispX-1, dispY-1)--dispX and dispY are the screen sizes


EDIT: As of now I have 300 levels! And there is an updated menu!

There is an attached source this time because I am no longer coding in the actuall student software because it keeps crashing on me, so I now code in notepad++.

As for the controls, you move the rectangle with the arrow keys and click on a circle to select it's color. Then you aim it to the other color circle. The aim is to fill the board and connect all the circles. When you win the board you can press enter to advance to the next level by pressing enter. Hope that made sense. Btw I am still new to this forum how do you add images to the middle of the post instead of only the end. I don't really need to know that much but it would be nice.

The controls are also in the readme and in the help menu.

If you want to make levels use this code in processing. To add a new flow dot, just click on the square you want and it will go through all the colors currently available. If you want to change the size of the level then just change the boardSize variable to whatever you want. To actually play your level(sort of it is not as polished as flow) you press the right arrow key(and to go back to editing you press the left arrow key). Then while playing you click on a square with a full flow thingy, which selects the color, and then you click anywhere you want to create a smaller circle on the square you clicked on, which represents the path. To reset the board, simply press R. Then, to actually submit what you created to me, just reply with the latest string that was printed to the console. Here is the code to put in processing to make the levels.

int board[][]=new int[8][8];
int playBoard[][]=new int[8][8];
int boardSize=5;//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;
  }
  if(key=='r'){
    for(int i=0;i<boardSize;i++){
      for(int j=0;j<boardSize;j++){
        board[i][j]=0;
        play=false;
      }
    }
  }
}
#21
I searched for a chess game on ti calc, and I couldn't find it, so I decided to make my own. I so far am nowhere near finishing. All that is done drawing the board and moving the pieces, but the code doesnt check for illegal moves and it allowes anything to move anywhere, including blank spaces onto pieces, for now. Also I plan to maybe eventually make an ai, but im not sure. Anyways, here is the chess game. I will probably make a few more simple games and then go on to making an empire earth like rts game.


EDIT: I updated the chess file so that it checks whether you make a valid move. It doens't detect checkmates yet, but it doesnt let you move if you are checked. Please report any bugs you find cause there were a lot during development and I might have missed some.

Also now if you press clear(ctr+del) it clears the board.

Second Edit: sorry for uploading the screenshot instead of the actual game, I was rushing to upload it.
#22
Last weekend I started making a game for the ti nspire based off of learn to fly idle on kongregate. I finished it, except that I only have 3 enemies and my pics are not too good. It will be very easy to add new enemies, I just need good pictures for them. I hope you like this simple game I made.

The rules, the game, and some images are attached.
#23
I recently learned some of the ti nspire lua language, so I decided to make a learn to fly idle game. Most of the begining progress is done, but the program has some problems with it.

First off, the cannonballs on the calc look bad, as opposed to on the computer. Second off, some of my variables don't save properly. Third off, a quick sine(which is just a list of sine values in an array that I generated with c) function I made just cause why not doesnt work. The third one has about zero priority because it is completely unessesary, but I was just wondering. Fourth off, after I fixed the auto fire, since it was partially linked to shots per click, it completely started being wierd. The adder for the auto shots and shots per click is completely wierded out

Also I was wondering if anyone would like to collab on this project with me, so as to make it look better. BTW the program only works in handheld view.

Attached, once approved, is the game and a screenshot.
Powered by EzPortal