Computer Science Canada

[FP] Peg Solitaire

Author:  the_short1 [ Mon Jun 26, 2006 11:01 am ]
Post subject:  [FP] Peg Solitaire

Well well. the pacmasta is back.. this year its a game called Pegs. Pegs is a revamped, highly customizeable version, of the classic peg solitaire. It is fun, but challenging, game with all the features you would expect.

Peg Solitaire has been around for over a century, as far as mid 1800's and it has always been fairly popular with mathematitions trying to calculate the shortest posible move sequence. Also it is a fun challenge to beat the solitaire level in the shortest time.

The object of this game is to jump over another peg (like Capture in checkers), and the jumped peg will be removed, the goal is to have only 1 peg remaining, and preferably in the center (but it doesnt need to be).

This version contains 10 levels, Cross, Plus, Fireplace, Up-Arrow, Pyramid, Diamond, Solitaire, Wall, Square, and Custom. (Increasing In Difficulty)

Solitaire is considered the main game, but it is recomended that you finish the levels leading up to it to learn the peg removal tricks. Level 7 & 8 are special, to beat them you start with the solitaire level and you have to remove pegs until you match the required layout. Level 9 (custom) is currently the diamond 9x9 solitaire game, but this game is very dynamic and you can create your own levels (up to 10x10), and your own board styles. (see in game intructions)

Special Features: Completely GUI driven, GUI Menubar, Fully colour customizable, Custom cursor, Images are all custom made (pixel by pixel) from within java, Dynamically scaleable from 4x4 to 10x10 layout, Ability to create your own levels. Highscores save, GUI level Creator!

Programming Language: Java
Format: Precompiled .JAR archive.
Requirements: Pent 2 or higher CPU, Any OS w/ JRE.
JRE (Java Runtime Edition): http://www.java.com/en/download/manual.jsp
(Most people already have the JRE installed for playing java games online)

Grade: 12
Mark: Handed this in for my Comp Sci ISU and i got 100% Smile
Time: About a month and a half, most of which was 30minutes a day in class
Experience: Second year java, first year java gui, self taught most.
Used: JCreator & J2SDK 1.4.2_09
Totals: 5 Main classes +1 Turing, 2390 Lines of code, 4 Subclasses, 33 Methods , 128 Variables
Attached: 2 code snippets, one from Pegs one from PegsMenu, Methods and variable documentation, Pegs[sf].zip (The Game Archived)
Full source: Available by request (only ppl high on compsci hiarchy)
Screenshots: SS 1 SS 2 SS 3 SS 4
If you find any bugs, please post here or email kevinfolz@gmail.com
Please include description of what went wrong, and last 10 debugging lines.

I have done extensive playing of the game and i strive to make all my programs bug free, but alas i have found the following 2 unfixable glitches:
-If running win98, DON'T use scrollmouse for level selector in Highscores window, it causes the Java Virtual Machine to crash (not my program)
-If clicking very fast, it sometimes misses a click, simply reclick to fix, or if the click was a selected peg and it lost its green colour so you dont know where it is, press backspace and it will clear that selection. I believe its just the GUI action listener slipping.

Enjoy, and feel free to post comments and suggestions.
-Kevin

Edit1: fixed a small cosmetic glitch in colour window, now the 16 colour boxes dont have spaces betweem them (was caused by cursor button was too long)..

Edit2: I was bored so .. 110 lines of code, 3 variables and 1 method later.. Tada! we have GUI Level Creator! Accessable through file menu

Edit3:For anyone that manages to set a new (1-3) rank record for any level,send a screenshot (kevinfolz@gmail.com) of the highscore window (for that particular level), and I will make an effort to add it on the next release

Author:  upthescale [ Mon Jun 26, 2006 11:45 am ]
Post subject: 

do ieneed java to open this? wut one runs the game?

Author:  the_short1 [ Mon Jun 26, 2006 12:09 pm ]
Post subject: 

upthescale wrote:
do ieneed java to open this? wut one runs the game?


Download Pegs[sf].zip, Unzip to a folder, and you should be able to just double click on the .jar file to run it. If not .jar files may be associated with winrar, winzip etc, so unassociate those programs from .jar first if needed.
You just need a JRE or JSDK (which contains the JRs)...

Author:  upthescale [ Mon Jun 26, 2006 12:24 pm ]
Post subject: 

How do i unzip?

Author:  the_short1 [ Tue Jun 27, 2006 10:59 pm ]
Post subject: 

wow.. im kinda disapointed in the lack of comments and ppl downloading my game :S.... its acually fairly catchy once you beat a few of the levels you want to keep trying to beat the next ones..

anyways.. .i updated it now .. added GUI level creator if anyone cares......

Author:  cool dude [ Wed Jun 28, 2006 7:17 pm ]
Post subject: 

Thats freaking amazing!!! wow pacmasta is definetly bak! i really like the game, because for the first time a game is actually challenging. especially the level where you had to make the pattern (i'm still on it). really good work! you'll probably get first this time (or close to first). you only got 100% where are the bonus marks! Laughing

p.s. people might not have seen your game yet thats why no replies yet, but this is truly amazing! i don't have many comments yet because i'm still playing it. anyways i'm going bak to play it lol. this is the one game i'll probably save on my computer, and that happens rarely, because the games aren't that great, except for wolferstein.

Author:  the_short1 [ Wed Jun 28, 2006 8:25 pm ]
Post subject: 

cool dude wrote:
Thats freaking amazing!!! wow pacmasta is definetly bak! i really like the game, because for the first time a game is actually challenging. especially the level where you had to make the pattern (i'm still on it)."...


Thank you.. and if you beat the level (8)square.. . take a screen shot of the highscores window (for that level) and ill add it on the next release. as you may notice is the only level I cant beat and i tried too many times to count.


: