Forums

Topic: Petit Computer

Posts 621 to 640 of 9,620

ramstrong

portealmario wrote:

I feel sick, I have been working on a program for forever, and the emtire thing was just deleted. I was really happy with it and was going to post a QR code for it tomorrow. 😵😵😵😵

Ouch! That must really hurt! I wish I can say "I know how you feel", but I don't. When my program gets accidentally deleted, it usually occurs in the middle, not the day before posting! And if I can have my way, that'll never happen again. I'm triple back up now. And all my stuff gets uploaded to the blog at earliest opportunity.

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

ramstrong

I do have a question to the group. Shall we start a new thread to act as Source Code repository? I like source codes. I think it gives people a chance to get familiar with the language effortlessly. I began by copying code into the computer. But so far, I'm the only one? Is there anybody beside me who wants to share code? Because if so, let's create that repository. Otherwise, I'm content with collecting them on my blog.

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Eel

Well, you are free of creating any threads you want as long as they have a purpose that requires another thread.
I could see source codes fitting in the tutorials thread, but it could get messy.

I say go for it. If TBD decides not to lock it, it means it's good.

Maybe we could ask for a Petit Computer subforum to be created (jk, I highly doubt that would happen).

BTW, you should try editing your comments to merge them together, multiple posting is usually not cool.

Edited on by Eel

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

ramstrong

Morphtroid wrote:

BTW, you should try editing your comments to merge them together, multiple posting is usually not cool.

I only do that if I post on a single subject. Multiple subjects gets multiple posting. I'm not about to combine Sprite's post with PortealMario's. And the source code forum post is supposed to be on soap box post, but my addled brain somehow missed it. Gah! Sorry!

Edit:
I don't think a Petit Computer subforum is unreasonable, but I'm not sure it's a good idea. Judging from my experience with Small Basic, whole separate forum will cause many threads, and so fracture the community, where as a few dedicated threads will cause the whole community to join in and have lots of activities. So, I think 3-4 threads is better than a whole subforum. I just want to know whether or not other people will contribute their source code before starting a dedicated thread on it.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Icebender7

ramstrong wrote:

Icebender7 wrote:

You guys are doing great I was wondering how to make the program ask yes or no, not by typing it in but by moving with the + pad and the A button, and then get different results depending on the answer using the GOTO command.

If you google "Petit Computer how to use buttons", you should see my blog where I did a lot of explanations on buttons and how they work. There's also a post on QR code thread on reading dpad/buttons. Look for @SETB5 subroutine.

But if I read you right, I suggest that you abandon the dpad idea and just use A for OK, and B for CANCEL. It's cleaner and easier that way.

thx I'll use A for yes and B for no, until I get better

Edited on by Icebender7

Icebender7

portealmario

So, I guess I will start a new project. Maybe there is an early version on the sd card. @ramstrong I am definately going to use that website, I have been trying to fiqure button use out for a long time, but when I see other people using it, it is too unfamilliar to recognize.

meng 😐
3ds friend code:1762-2769-7142

portealmario

@ramstrong I totally agree with your soapbox post
I think that someone should try to make a clone of minicraft for petit computer(I haven't learned enough to start myself). It is a game made by notch in 24 hours(with some similarities to minecraft) I'm sure someone(cough) @morphtroid (cough) could do it. It would be really cool to play it on the ds, and it would be easy to mod due to it's BASIC language. Do you think anyone would want to do it?

Edited on by portealmario

meng 😐
3ds friend code:1762-2769-7142

Sprite

Portealmario i feel so bad for you. I know what its like to lose all of your data. Mine was in a different circemstance so yours must feel 100 times worse. Hope ypu find a backup
EDIT: Hope you find a backup

Edited on by Sprite

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens.
Friend Code: 1075-1228-4183

81Rambler

Morphtroid wrote:

On an unrelated note, I bought "Atari's Greatest Hits Vol. 2" for the DS some days ago, it comes with a lot of "Petit Computer-izable" game ideas I can't wait to try when my new stylus arrives... It also comes with a BASIC compiler that I can't understand at all lol, but I already have Petit Computer for that.
If any of you want good & easy game ideas, I totally recommend you to play atari games.

I acctually picked that up for those reasons, that it included the Atari 400 emulator as well as... Atari Basic Programming (12 lines with a comically named 'Keyboard controller'), but back to the Atari 400 I was a bit curious how easy/difficult it would be to translate Basic code for the Vic20/Coimmodore64 to it as uses a similar peek/poke system (although some minor language changes would be made of course).

These sorts of collections are great places for inspiration though. My current project is currently inspired from Activision Anthology, which I should have some conceptual stuff up soon. Professor Layton was a pretty obvious inspiration for my first (as well as The 7th Guest), and some collections I could recommend to others are Atari Anthology and Intelivsion Lives.

Failing those Morphtroid I WILL be expecting a Petit Computer version of Atari Basic Programming ;p (joking, of course)

Edited on by 81Rambler

81Rambler

Tingle

So, I have another question. It's about the DIM command, and arrays. I just don't understand what they do. As in, the Petit Computer help automatically assumes I understand the word array. Would somebody oblige and explain to me the concept of an array and what it can be used for?

Tingle

Eel

@Rambler: I managed to do a little program with Atari Basic, but the terminal emulator really lacks some basic functions, like DPad support. To move around your code you need press a button combination every time you want to move a single space so it gets tiresome and boring, Petit Computer is clearly the superior choice. That doesn't means it's not fun to play around with though. It's fascinating in it's own historical kind of way. There are also tons of premade codes you can find online.

The 2600 BASIC game is pretty bad though... I may need to read the 27-pages instruction book again if I want to get anything from that one.

@Tingle:

Wikipedia wrote:

In computer science, an array data structure or simply an array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula.[1][2][3]
For example, an array of 10 integer variables, with indices 0 through 9, may be stored as 10 words at memory addresses 2000, 2004, 2008, … 2036, so that the element with index i has the address 2000 + 4 × i.[4]
Arrays are analogous to the mathematical concepts of vectors, matrices, and tensors. Indeed, arrays with one or two indices are often called vectors or matrices, respectively. Arrays are often used to implement tables, especially lookup tables; the word table is sometimes used as a synonym of array.
Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists and strings. They effectively exploit the addressing logic of computers. In most modern computers and many external storage devices, the memory is a one-dimensional array of words, whose indices are their addresses. Processors, especially vector processors, are often optimized for array operations.
Arrays are useful mostly because the element indices can be computed at run time. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array. For that reason, the elements of an array data structure are required to have the same size and should use the same data representation. The set of valid index tuples and the addresses of the elements (and hence the element addressing formula) are usually,[3][5] but not always,[2] fixed while the array is in use.
The term array is often used to mean array data type, a kind of data type provided by most high-level programming languages that consists of a collection of values or variables that can be selected by one or more indices computed at run-time. Array types are often implemented by array structures; however, in some languages they may be implemented by hash tables, linked lists, search trees, or other data structures.
The term is also used, especially in the description of algorithms, to mean associative array or "abstract array", a theoretical computer science model (an abstract data type or ADT) intended to capture the essential properties of arrays.

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

ramstrong

@Morphtroid
Gee, I think you should link the article, instead of copy and paste.

@Tingle
This is part of "variable" concept. Also Indirection. :http://en.wikipedia.org/wiki/Indirection

The computer is just a bunch of numbers. A variable will occupy one of those numbers (or memory address). So, when you do something like A=10, that means somewhere in memory, say address#4532, it will have a value of 10. Also somewhere else, there will be an entry "&A=4532" <- this here is a pointer (indirection).

An array is simply a bunch of variables together. An example would be a row of ducks, Solar panel arrays, string is an array of characters, etc. A lot of times, we want a group of variables to denote the same thing, with several different elements. Taking an example of ducks, we can say, "Shoot the 3rd duck from the left" which something like DUCK[2]=TRUE. 3 is the reference number. If we take memory address of DUCK is #3231, then
&DUCK[0]=3231
&DUCK[1]=3232
&DUCK[2]=3233
&DUCK[3]=3234
&DUCK[4]=3235
and so on...

DUCK[2] because array starts from zero.

However, the computer will need to know how many DUCK variables are there, because, eventually, you want to put another variables after it. So, we use DIM, as in DIM DUCK[5], which means "Let there be 5 DUCK variables going from 0 to 4". BASIC takes care of the internal memory allocations so you don't have to worry about it. But you do need to declare how many elements an array have before it can be used. This is also why you can't resize the DIM because you'll be in danger of overwriting other variables. So, you CLEAR the memory first, before allocating variables using DIM.

The nice thing about it is that we can use a variable as reference. That means we can do this:
FOR I=0 TO 4
DUCK[I]=TRUE
NEXT
In this case, variable I is changed with in the loop, so DUCK[0],DUCK[1]...DUCK[4] are all set to TRUE.
We can also do this:
INPUT "CHOICE",N
CHOICE[N]=TRUE

Why variable "I"? It's tradition, same as we use the term "Debug" when we mean correcting errors. "Debug" means getting rid of bugs, in this case a moth. The variable I is used as convention because in FORTRAN, variable I to N defaults to integer, and we use integers (as opposed to real) in loops.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

ramstrong

Example of using Sprite Collision. Note that SPHITNO is set by the system automatically.

ACLS:CLEAR
MAXSP=19
SPSET 0,96,0,0,0,0
SPHOME 0,8,8
FOR I=1 TO MAXSP
SPSET I,64,0,0,0,0
SPHOME I,8,8
SPOFS I,255+RND(245)+5,RND(180)+5
NEXT

@LOOP
VSYNC 1
SPOFS 0,TCHX,TCHY

FOR SPNUM=1 TO MAXSP
IF SPCHK(SPNUM)==0 THEN GOSUB @MOVE
NEXT

IF SPHIT(0) THEN GOSUB @FLING
GOTO @LOOP

@FLING
BEEP 61
SPREAD(SPHITNO),X,Y
SPCHR SPHITNO,92
SPOFS SPHITNO,X+RND(225),Y+RND(95)-40,40
RETURN

@MOVE
SPREAD(SPNUM),X,Y
TX=TCHX:TY=TCHY
DX=TX-X:DY=TY-Y
DR=SQR(DX*DX-DY*DY)
SPOFS SPNUM,TX,TY,DR
SPCHR SPNUM,72
RETURN

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

LittleKing

Just wondering, but does anyone here have any background in software development, or experience with programming other than BASIC?

LittleKing

GrabSomeEyes

@Metabble_King if I remember correctly, @Morphtroid has had some experience outside of BASIC.
I think a few people here at least do a little outside of BASIC, but I can't really speak for them.
I can speak for Morphtroid, but none else.

Eos OS: http://conlogxl.forumotion.com/t12-eos-os-v10
3DS FC: 3695-0514-5044

Eel

Eh just mostly Game Maker and small school-related projects on other languages (C#, Java, etc). Nothing too serious.

The first real non-Game Maker language I used was actually BASIC in high school, my school was very outdated.
After BASIC we used old school Pascal and C. Fun times.
I was usually the only one who enjoyed programming though. Huh.

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

Shadow1364

Just posted my first program to the QR thread. Check it out and comment! ^-^

FC: 1934-1622-0902

LittleKing

Morphtroid wrote:

Eh just mostly Game Maker and small school-related projects on other languages (C#, Java, etc). Nothing too serious.

The first real non-Game Maker language I used was actually BASIC in high school, my school was very outdated.
After BASIC we used old school Pascal and C. Fun times.
I was usually the only one who enjoyed programming though. Huh.

Ah, thanks. Explains why you're so good at this! I was interested because some people here are pretty good at using Petit Computer and BASIC, so I thought maybe a few had done other stuff before. Having learned C as my first language and making a basic RPG battle engine in that, and then moving into Objective-C, it seems that BASIC is a better starting point than I thought. Through it you can learn about basic loops and subroutines, and do some pretty cool stuff without getting too complex. I always tend to write out anything more complex in pseudocode first, which, quite frankly, often looks kind of like BASIC! xD

I like programming since it allows one the freedom to create. If you think about it, you can basically make whole worlds! It's kind of like a step up from LEGO and K'Nex.

Just wondering, but how do you guys handle collision detection in BASIC games? In Obj-C I've had to make my own physics classes which work on my own prediction based collision algorithm to detect and limit positional offsets based on object velocities each frame so that objects don't overlap. Do you just see if sprites overlap and correct their positions so that they don't after the fact, or what? This seems most likely to me since most collision correction is post-collision, and not pre-collision.

LittleKing

Please login or sign up to reply to this topic