Hello, everyone!
I'm working on Xs&Os game (or tic tac toe) to learn pharo. Already uploaded a first version. Game is boring and very simple, but if somebody is interested here is a link:
http://smalltalkhub.com/#!/~MarkRizun/XsAndOsGame/ As a novice in pharo, waiting for comments and advice. Сritique is welcome too ;)
Regards, Mark. |
To play it just type in workspace following: XsAndOsGame new openInWorld 2014-02-03 Маркіян Різун <[hidden email]>:
|
well done , now you only need to add a computer opponent, since playing against myself is boring because I win and lose every single time :D On Mon, Feb 3, 2014 at 12:40 PM, Маркіян Різун <[hidden email]> wrote:
|
Sure, that is in my plans:) 2014-02-03 kilon alios <[hidden email]>:
|
I am added my self as a watcher to your project , will definitely be following your progress. Rock on :) On Mon, Feb 3, 2014 at 12:54 PM, Маркіян Різун <[hidden email]> wrote:
|
Thx) That's nice 2014-02-03 kilon alios <[hidden email]>:
|
In reply to this post by Mark Rizun
On Mon, Feb 3, 2014 at 11:39 AM, Маркіян Різун <[hidden email]> wrote:
random comments (tested on Pharo 3.0): - I played and things work perfectly as far as I saw :-)
- your code is of very good quality! - 2 tests don't pass (EmptyCellTestCase, CellRendererTestCase) - usually we don't append 'Case' at the end of our test classes - the package name doesn't follow the convention (https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/ws/Conventions/Conventions.pier.html) - you may want to avoid the use of non-alphanumeric characters in the package name (e.g., avoid &) - please indent your code (use ALT+Shift+u on each method to get automatic indentation) - "self should: [ offset = (50 @ 50) ]" --> "self assert: offset equals: 50@50" - "self should: [ cell isOff ]." --> "self assert: cell isOff"
- all subclasses of Cell override #initialize in exactly the same way. Consider moving that to the superclass - you should try to avoid as much as possible doing a super send in a different method. For example, EmptyCell>>initializeState does a super send on #initialize. - OCell and XCell are exactly the same, this should not be and is very suspicious. - CellRenderer has 2 methods with an uppercase letter. This is not conventional - you use a lot of variables you use only once. Consider inlining them. For example in CellRenderer>>offsetWithinGridForm, all variables seem useless : "^ CellRenderer cellExtent * ((self cellLocation x - 1) @ (self cellLocation y - 1))" - CellRenderer>>renderContents uses branching on the class of objects instead of polymorphism. That's bad design in my opinion. Consider delegating to OCell and XCell or using double-dispatch. - Same thing for CellRenderer class>>rendererFor: All in all, very good job. Would you consider writing a tutorial on how to implement an Xs&Os game in Pharo? -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill |
Really appreciate your comments, they are very useful for me.
I will do my best to make commits as soon as possible to fix problems that you pointed out. Plus I've learned so much from only one message! thx:) 2014-02-04 Damien Cassou <[hidden email]>: After finishing this game completely (it will take a while), I have in plans to implement another game. Then, if I have enoug experience in pharo, I want to write 2 tutorials for both games.
Mark |
On 04 Feb 2014, at 18:04, Маркіян Різун <[hidden email]> wrote:
I’d suggest you to start writing a tutorial on X&O now, and then do something more. It’s important to have a constant impact. Also if you have a short tutorial (e.g. on Athens) which can help sleepy developers on their deadline hight, I can include you as an author of http://sleepycoders.blogspot.com Uko P.S. good job :)
|
On 04 Feb 2014, at 18:08, Yuriy Tymchuk <[hidden email]> wrote:
* deadline night
|
That's a good idea:) I should think how to write this tutorial. 2014-02-04 Yuriy Tymchuk <[hidden email]>:
|
On 04 Feb 2014, at 20:58, Маркіян Різун <[hidden email]> wrote:
IMHO Your tutorial should guide a reader through the development process and give the understanding about key concepts that you are using (probably how to build a view or how to handle events). As for IA consider putting at least something. a) thing that selects first free cell (1 -> 9); b) takes a set of free cells and selects one randomly :) Uko
|
2014-02-04 Yuriy Tymchuk <[hidden email]>:
You just stole my idea for AI (Easy level). Also there should be Normal and Impossible levels. On Impossible computer always wins;) |
In reply to this post by Damien Cassou
Thanks damien
It was on my todo :) Mark will come to visit us this summer :) Stef On 04 Feb 2014, at 17:37, Damien Cassou <[hidden email]> wrote:
|
In reply to this post by Mark Rizun
On Tue, Feb 4, 2014 at 8:58 PM, Маркіян Різун <[hidden email]> wrote:
> I should think how to write this tutorial. on the technical point of view, I advise you to use Pillar: http://www.smalltalkhub.com/#!/~Pier/Pillar -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill |
Thanks, I'll certainly take a look at it 2014-02-05 Damien Cassou <[hidden email]>:
|
Updated XsAndOsGame: added AI, also fixed some problems, that Damien mentioned in his comments. Btw, thanks to Damien, because I learned for myself a lot of new useful things. Note: The new version is XsAndOsGame (NOT Xs&OsGame) !
To play it type in workspace: XsAndOsGame new openInWorld. If you want to play vs computer press button "ToggleMode" and choose difficulty. Initially it is easy. Mark
2014-02-05 15:57 GMT+02:00 Маркіян Різун <[hidden email]>:
|
I really like the GUI , is it just Morphic ? Your impossible mode is quite easy to win. One thing I would change is when I use the ToggleMode to toggle to Player vs CPU I would like it to stick even after I finish the match. Because as it is now If I click New Game it reverts back to Player vs Player mode.
Also I would like if you expand your window to add the bottom text because as it is if it mixes with other windows its hard to read being outside its window. Well done , looks very good indeed :)
back to studying your code. On Sat, Feb 8, 2014 at 4:07 PM, Маркіян Різун <[hidden email]> wrote:
|
2014-02-08 22:55 GMT+02:00 kilon alios <[hidden email]>:
Yes it is.
Sure, because impossible and normal modes are about the same for now. Today or tommorow I will update game again, and it will be impossible to win.
You are right, I have to fix this. Thanks for being so helpful :)
You mean that I should add some background on the place where the text is? |
"You mean that I should add some background on the place where the text is?"
yes exactly. Try to hover the window over another window like a Nautilus window to see why thats a problem. |
Free forum by Nabble | Edit this page |