Notices


Reply
Thread Tools
Posts: 193 | Thanked: 201 times | Joined on Dec 2009 @ Subotica, Serbia
#1
Hi.

My first standalone, worked a little bit on PyQt for Maemo, project for Maemo can be found in extras-devel repositories.

PeQersi - Reversi game
Desc:
Reversi is a board game (8x8) for two players. By putting discs, different color for each player, and flipping the enemies discs, the goal is to have the most discs of players own color on the board when there’s no more place on the board.
More information can be found here: http://en.wikipedia.org/wiki/Reversi

The purpose was to learn, so the app is full of bugs and the design is plain simple, but I've got all the basics now. Improvements to the app can begin.

It was created for the competition:
[ANNOUNCE] The First N900 Coding Competition! 21st May-21st July. Open to all!

There are still problems with the logic of calculating possible moves, so the comp will grab some discs which he should have. Sorry if you lose the game because of it.
Think of it as a feature, because comp guesses a random field it can put his disc, this way the game becomes greater challenge.

I'll try to fix the possible moves logic asap and add some basic colors... I'm a programer not a designer. If someone wants to help around design or anything else, his/hers would be welcome.

Looks like there's some bug with my packaging, the app can bee installed through apt, but it isn't showing in the application manager. I hope that those that have activated the devel repository know how to use apt.

Edit: Forgot... package is called peqersi
Edit 2: You can grab the source code: http://gitorious.net/peqersi

Edit 3: You can see it in extras here: http://maemo.org/downloads/product/Maemo5/peqersi/

Here are two screenshots:
Attached Images
  

Last edited by mmlado; 2010-09-14 at 08:34.
 

The Following 10 Users Say Thank You to mmlado For This Useful Post:
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#2
Originally Posted by mmlado View Post
Looks like there's some bug with my packaging, the app can bee installed through apt, but it isn't showing in the application manager. I hope that those that have activated the devel repository know how to use apt.
You are probably missing

Section: user/games

from your control files.
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
 

The Following 2 Users Say Thank You to attila77 For This Useful Post:
Posts: 193 | Thanked: 201 times | Joined on Dec 2009 @ Subotica, Serbia
#3
Originally Posted by attila77 View Post
You are probably missing

Section: user/games

from your control files.
Thanks, but it's not that.
apt-cache show peqersi, shows:
Section: user/games

 
ndi's Avatar
Posts: 2,050 | Thanked: 1,425 times | Joined on Dec 2009 @ Bucharest
#4
Nice game, but it's either a bug or it's cheating.

I see it taking pebbles where there shouldn't be an option to, such as taken side lines. I had both corners on the left, then a complete left line, and when taking diagonals it also retakes white pebbles.

I'll try to screen the behavior. it wouldn't hurt if it waited a little while before playing. Or an indicator of where it placed its move, because it's not verifiable.
__________________
N900 dead and Nokia no longer replaces them. Thanks for all the fish.

Keep the forums clean: use "Thanks" button instead of the thank you post.
 

The Following User Says Thank You to ndi For This Useful Post:
ndi's Avatar
Posts: 2,050 | Thanked: 1,425 times | Joined on Dec 2009 @ Bucharest
#5
Here's the attachment, from two consecutive screenshots.

Numbering 1-8 left to right and 1-8 top to bottom, I play:

24 > taking over 25, 26 (vertical) and 35 (diagonal)

The CPU must have played 84, an illegal play, because it's the only added peg. In doing so, it takes 41, 42, 51 and 53.

Might be a coincidence, but I think it played the 84 peg, then turned the other colors as if the CPU played my peg as well as his. It might be a coincidence, but if you take my before-play situation and add a white peg instead of a black, it gets you just about this situation.

Generally, it tends to take over pins way above its length, but in accordance with the set line or diagonal. For example, assume an all-black table. Also assume that 22 is white and 44 is empty.

Playin 44 will get you 22, 33 and 44 white, the rest black. When CPU plays this, it also takes over 11. I'll keep trying to figure it, but I'm a Othello heavyweight and I can tell it cheats me heavily.

What algorithm do you use, standard weighted table? If so, several levels of difficulty should be available easily.


Oh, one more. After finishing a game the game randomly refuses to play again, even if I choose "new game". It initializes board, but doesn't allow me to place any pegs.

I don't write for Maemo, but I have written an Othello game before, if I can help with algorithm, I'd be happy to discuss it.

ETA: Sorry, I missed that part where you said you knew about the grabbing of pegs. I decided to leave the post for reference instead of deleting it.
Attached Images
 
__________________
N900 dead and Nokia no longer replaces them. Thanks for all the fish.

Keep the forums clean: use "Thanks" button instead of the thank you post.
 

The Following User Says Thank You to ndi For This Useful Post:
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#6
I like PeQuersi! I have never played Reversi before, but first time I opened your program, I won! Though several times later I lost (but then, I can console yourself that computer sometimes grabs my pebbles ;-).

1. Sometimes, after one game is finished, I click "New Game", it creates new field, but the count outside the field doesn't change, and I cannot make a single move, I have to restart the program.

2. Several times, when I won the game, the program didn't show the message that I won the game. No possible moves, and no message about the end of the game.

Current design is all correct.

What about a feature of playing against another player (or against yourself instead of computer? What about computer having first move?

Does the computer play randomly - or it chooses the best possible move? In other words, is it a formidable artificial intelligence opponent or a guesser? Or something in between?

Some warnings when I run it from terminal:
WARNING:root:Maemo detected
WARNING:root:OpenGL acceleration not available
'Main' object has no attribute 'view'

And you could add portrait mode support.
 

The Following User Says Thank You to Wikiwide For This Useful Post:
Posts: 193 | Thanked: 201 times | Joined on Dec 2009 @ Subotica, Serbia
#7
New, bug-fix, version released, 0.0.0-2

Fixes:
- Function for calculating possible moves fixed. Comp doesn't cheat anymore.
- Numbers on scoreboard moved lover to not overlap with the discs
- New game in menu fixed. Sometime it didn't allow player to move after restarting the fields.
 

The Following User Says Thank You to mmlado For This Useful Post:
Posts: 193 | Thanked: 201 times | Joined on Dec 2009 @ Subotica, Serbia
#8
Originally Posted by ndi View Post
Here's the attachment, from two consecutive screenshots.
Thank you for the screenshots and the explanation of the problem. It helped me a lot. I made a n00b mistake. Forgot that lists work with negative indexing too, so this way the board was basically a sphere. Once it stopped checking if the field "exists" and concentrate on the range of possible fields it works... i hope.

Originally Posted by ndi View Post
What algorithm do you use, standard weighted table? If so, several levels of difficulty should be available easily.
Sorry. I have no idea what you're talking about. I don't play Reversi that much, I like the programing challenge it gives me.
For now it only finds current players disks and from them sees in which are possible moves and which disks will be taken over in the process. I would be grateful if you could show me in the direction where these algorithms can be found, or if you would be kind to explain it here on tmo, so others can learn too.

Originally Posted by ndi View Post
Oh, one more. After finishing a game the game randomly refuses to play again, even if I choose "new game". It initializes board, but doesn't allow me to place any pegs.
Fixed it. Forgot to reinitialize the players too.

Originally Posted by ndi View Post
I don't write for Maemo, but I have written an Othello game before, if I can help with algorithm, I'd be happy to discuss it.
Sure, I would like that. I like to learn about new things. If you would like and know python you can create the AI script. You can see the random_computer class in the source code or send me a pseudo code and I'll implement it. Also for the help if you would like I would add you to the developers list.
 
Posts: 193 | Thanked: 201 times | Joined on Dec 2009 @ Subotica, Serbia
#9
Originally Posted by Wikiwide View Post
I like PeQuersi! I have never played Reversi before, but first time I opened your program, I won! Though several times later I lost (but then, I can console yourself that computer sometimes grabs my pebbles ;-).
I like that you like it. One happy user. Mission accomplished. Thank you. Yes the comp cheats. I hope the bug is fixed. Please upgrade the app.

Originally Posted by Wikiwide View Post
1. Sometimes, after one game is finished, I click "New Game", it creates new field, but the count outside the field doesn't change, and I cannot make a single move, I have to restart the program.
This one is fixed in the new version, too. I forgot to reset the players.

Originally Posted by Wikiwide View Post
2. Several times, when I won the game, the program didn't show the message that I won the game. No possible moves, and no message about the end of the game.
I didn't encounter this problem yet. I would be grateful if you could make a screenshot of this problem maybe it would help.
I'm planing on implementing a save function, which would save the history of moves, so I can replicate the game.
In any case I'll try to find and fix it.

Originally Posted by Wikiwide View Post
Current design is all correct.
Thank you. There are plans to make it more aesthetically pleasing, by adding colors, and making the disks flip.

Originally Posted by Wikiwide View Post
What about a feature of playing against another player (or against yourself instead of computer? What about computer having first move?
Sure. I have many plans for PeQersi. For now, for me, it was important to make the basics, and make it playable. I wanted this to enter the competition and gain exposure for the app, and hopefully a bigger user base, then when released without the competition.

Originally Posted by Wikiwide View Post
Does the computer play randomly - or it chooses the best possible move? In other words, is it a formidable artificial intelligence opponent or a guesser? Or something in between?
It's a guesser, for now. My next step will be to create an script that will grab the most possible disks and probably add a little randomness to it, so it doesn't play the same way always. Hopefully with the help of ndi, a real ai will be written for it.

Originally Posted by Wikiwide View Post
Some warnings when I run it from terminal:
WARNING:root:Maemo detected
WARNING:root:OpenGL acceleration not available
'Main' object has no attribute 'view'
Yes. The first two are there because I wanted them. The first says if it's on a maemo or another comp type, and runs some additional lines in the script. The script can utilize the OpenGL acceleration, for the eye candy later development. In this case it tells it's disabled. I left out the library from dependencies, but if you have it installed it will be used.
I'm hunting for the third message.

Originally Posted by Wikiwide View Post
And you could add portrait mode support.
It will be added, will have to learn how, and probably modify the script a little.

Manny things are in plan, and I'll add new things as I can. For the duration of the competition development is freezes, only bug-fixes allowed.

If you like it, please vote here: http://talk.maemo.org/showthread.php?t=58990
 
Posts: 193 | Thanked: 201 times | Joined on Dec 2009 @ Subotica, Serbia
#10
Originally Posted by attila77 View Post
You are probably missing

Section: user/games

from your control files.
I think, but I'm not certain, the problem was a missing image when using py2deb. I used the build_myapp.py script from here: http://wiki.maemo.org/Py2deb but pointed the p.icon to a place that didn't exists.
Now, it can be installed through application manager.
 

The Following User Says Thank You to mmlado For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 02:55.