Closed Thread Icon

Topic awaiting preservation: Oh NO! (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8458" title="Pages that link to Topic awaiting preservation: Oh NO! (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Oh NO! <span class="small">(Page 1 of 1)</span>\

 
eyezaer
Lunatic (VI) Mad Scientist

From: the Psychiatric Ward
Insane since: Sep 2000

posted posted 01-11-2003 04:46

What am I doing in this wing of the asylum?

Errr... I want to make a game.

I was wondering how hard it would be.

I dont know the name of the game, but it is a tryangle with 15 pegs. Ya start by taking one peg out... and then ya jump pegs over pegs to eliminate pegs. the point is to eliminate as many pegs as possible.

Anyone know what the name is?

I have no idea where to start in coding someting like this... could it be done in JS alone?

Thinking out loud... 15 pegs. each peg would have restrictions on where it could be moved inside the 15 holes (it could not be placed on another peg, and it can not move unless it is jumping over a peg)... when no more pegs could be moved an alert would pop up telling yo how stupid or smart you were based on the number of pegs left on the board. blah blah...

                                   

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 01-11-2003 05:28

Yes, that would be possible with JavaScript alone. What's your programming experience like? (I haven't followed you in the SSS forum or anything, so I dont know what languages you might already be familiar with.) If programming in general is new to you, a triangle-based game might be difficult. But if you can figure out the algorithms, actually writing it in JS shouldn't be all that difficult.

Personally, I'd probably start with a few pictures of pegs made in photoshop. Then I'd place them on a web page as the triangle you described... maybe with a weird table, or perhaps with absolute positioning. Then I'd create some sort of array to hold the positions in; each entry in the array could be 0 or 1 (or true or false, depends what you like) to know if it has a peg in it. Then I'd attach onclick events to each peg image, which would figure out whether there was a peg in that spot when you clicked on it, and if so it would highlight it somehow (another photoshop image), and then when you clicked another spot it would see if the currently selected one could jump there, and if so, it would jump.

The real problem is in representing the triangular board with an array. (Perhaps the first 1 element could be the top peg, the next 2 be the next row of pegs, then 3, 4, 5. There are still difficulties, though.)

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 01-11-2003 06:48

It's definitely possible, I agree. I usually spend many hours drawing things up on little pieces of paper. I try to think through as much of the coding and graphics as I can so when I start coding and PSing things go a bit smoother.

. . : slicePuzzle

eyezaer
Lunatic (VI) Mad Scientist

From: the Psychiatric Ward
Insane since: Sep 2000

posted posted 01-11-2003 17:59

Groovy. I will hack a board together in PS and then see about using css to position the pieces.

And as far a coding... well... all my JS trials so far have never worked. I have not yet been able to grasp the concepts I guess, so... I am trying again.

I am also going to dig around the internet and see if i can find some JS or flash versions of this game.

then... I will be back.

                                   

Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 01-13-2003 02:29

I think that game is called the Crackerbarrel game.... ;-)

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 01-13-2003 03:05

Nah, it's the "generic cheap american cuisine game"

They have them in all kinds of cheesy restaurants.

Sounds like a cool idea, definately challenging without a good coding knowledge...

Hope it works out =)

reitsma
Maniac (V) Mad Scientist

From: the bigger bedroom
Insane since: Oct 2000

posted posted 01-16-2003 03:22

hmm.....

the triangle concept shouldn't be too taxing.

i recommend you start by viewing the triangle as such:

x
xx
xxx
xxxx
xxxxx

...and then they can be subject to coordinates, say row, then column.....
and row 1 is limited to one column, etc etc.
and a spot is next to another spot if either:
row=row, and column = column -1 (or +1)

OR

row = row -1 (or +1) and column = column

OR

row = row -1 (or +1) and column = column +1 (but not -1, tell me if you need this bit explained!)


now, this is just one possible form of attack. i'm sure there are myriad others.

Now, tell me, izzy - how are you with oo coding?


now, i'm going to dig up an old piece i wrote on this, just in case you want it:

quote:
did you know that in javascript, you can create your own objects?
then, your objects can have properties, like the predefined ones do.
(eg window.height - height is a property of the object window)
so, lets say we want to create a chair:
thisChair = new Chair()

then, all you need is a function chair:
function Chair() {
this.price=20
this.weight=2
this.color='blue'}

so now, the value thisChair.color is 'blue'.
SO, that means you can create a few chairs:

thisChair = new Chair()
thatChair = new Chair()

right? but what if you dont want them to be all $20, 2kg and blue?
then pass variables!
check this:
function Chair(price, weight, color) {
this.price=price
this.weight=weight
this.color=color
}

SO.... then, when you create each chair, you give it its own variables:

thisChair = new Chair(20, 1, 'blue')
thatChair = new Chair(10, 5, 'pink')

so now, thisChair.price = 20, but thatChair.price = 10.
making sense?

ok, well, what i want to do is create, say 20 blocks objects.
but instead of writing
block1 = new Block(block1ID) //creates an object called 'block1', whose attributes are the block1ID
block2 = new Block(block2ID) //creates an object called 'block2', whose attributes are the block2ID
block3= new Block(block3ID) //creates an object......
and so on, i want it to do some writing for me.
so, as bitdamaged suggested, i can have something like this:
for(i=1, i>20, i++) {
eval('block' + i + ' = new Block(block' + i + 'id)')
}

so what this does create 20 block objects, block1, block2, etc..
the purpose of the eval function is to use the i variable to create a string, then evaluate that function as a string. understand?
if we just had blocki = new block(blockiID), then it would create the one "blocki" object. but the eval function basically means that when i=1, for instance, it writes this code:
block1 = new Block(block1id)
then evaluates it (runs the code), then it will do the same sort of thing for i=2, and so on.



now, i lurve javascript, and don't get enough exposure to it, so if you want any help, at all - just drop me a post or an email.

best of luck to ya.

edit: one final bit.

i wont drown you with a barrage of links, just give you one: http://www.dkrz.de/~k202039/dhtml/index.html
this one has examples and explanation, and the code is nice and clean.




[This message has been edited by reitsma (edited 01-16-2003).]

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 01-16-2003 12:38

I believe that game is actually called solitaire... at least it is over here.

so long,

Tyberius Prime

eyezaer
Lunatic (VI) Mad Scientist

From: the Psychiatric Ward
Insane since: Sep 2000

posted posted 01-16-2003 22:01

oh hoo hoo...

here is a form of the game, but not in a triangular format... http://www.girlstart.com/pegs.htm

I am looking for something a little simpler than that ^ to take apart.

as far a coding... eh... I am in a bit over my head with this so far. I don't plan on giving up though, even if it takes me a few months.

I have tried coding in JS before, but it just has not *clicked* with me yet.. hence the "Oh NO!" and I keep getting distracted with Photoshop too.

"generic cheap american cuisine game" hehe... I guess so. I came across one webpage where a person had played with it at the crackerbarrel and got so frustrated that he wrote a program to solve the game.

HOkay... off to the Dynamic Duo to learn.

                                   

« BackwardsOnwards »

Show Forum Drop Down Menu