Re: [Pharo-users] XsOs game
Thanks for comment. I'll fix all problems and change everything you mentioned, hope to succeed in it. Mark 2014-02-09 22:51 GMT+02:00 Pharo4Stef pharo4s...@free.fr: Hi mark I read a bit your code It is nice for a first project Here are some feedback. I suggest that you take into account the easy one and produce a new version and if you want to train your skills you try to see how to address the difficult ones. Stef - Add it in the class comment XsAndOsGame new openInWorld. - you have some unclassified protocols on the class side. - you may want to run smallLint (criticBorwser on your code and see the hints that it can give you). - When you create a new game do not move the window to the top corner :) easyBtn - easyButton (you do not pay per character :)) findEmptyCellPos - findEmptyCellPosition not in accessing impBtn - impossibleButton :) - Why do you need a separate class just for three colors? I would merge XsAndOsGameColors and XsAndOsGame XsAndOsGameinitialize is long May be you should extract some methods from it (methods that you can then reuse for other tasks) renderOContents | delta offset x1 y1 x2 y2 rect | delta := CellRenderer cellExtent - 1. offset := self offsetWithinGridForm. x1 := offset x + self oCorner x. x2 := offset x + delta x - self oCorner x. y1 := offset y + self oCorner y. y2 := offset y + delta y - self oCorner y. rect := Rectangle new setOrigin: x1 @ y1 corner: x2 @ y2. self targetForm getCanvas fillOval: rect color: XsAndOsGameColors gameBoardBackgroundColor borderWidth: 3 borderColor: XsAndOsGameColors OColor What do you refer to CellRenderer direcly? self class ? rendererFor: aCell VERY BAD IMPLEMENTATION OF THIS METHOD!!! aCell class = EmptyCell ifTrue: [ ^ CellRenderer ]. aCell class = XCell ifTrue: [ ^ XCellRenderer ]. aCell class = OCell ifTrue: [ ^ OCellRenderer ] indeed :) why not implementing some methods call renderClass and sending a message to the object :) mptyCellinitialize super initialize. CellRendereroffsetWithinGridForm Returns a point - left top corner of current cell ^ CellRenderer cellExtent * ((self cellLocation x - 1) @ (self cellLocation y - 1)) = self clas cellExtent CellRenderer renderBorderBottom | delta offset x1 y1 x2 y2 | delta := CellRenderer cellExtent - 1. offset := self offsetWithinGridForm. x1 := offset x. x2 := x1 + delta x. y1 := offset y + delta y. y2 := y1. self targetForm getCanvas line: x1 @ y1 to: x2 @ y2 width: 1 color: XsAndOsGameColors cellBorderColor = CellRenderer renderBorderBottom | delta offset x1 y1 x2 y2 | delta := self class cellExtent - 1. offset := self offsetWithinGridForm. x1 := offset x. x2 := x1 + delta x. y1 := offset y + delta y. y2 := y1. self targetForm getCanvas line: x1 @ y1 to: x2 @ y2 width: 1 color: XsAndOsGameColors cellBorderColor I was wondering why you need Grid (I would rename it CellGrid) and do not use a Matrix. grid sizeOfGrid - I would rename sizeOfGrid into size like that your grid can be a bit more polymorphic from its API point of view makeGameBoarMorph - typo :) Now I want wondering why you do not have an instance variable to hold it Future fun ideas for new versions: playerVsComputer self vsComputer ifTrue: [ self vsComputer: false. self stateMorph contents: 'Player 1 VS Player 2' ] ifFalse: [ self vsComputer: true. self stateMorph contents: 'Player VS Computer --- Difficulty: ' , self difficulty asString ]. self vsComputer ifTrue: [ self easyBtn enable. self normalBtn enable. self impBtn enable ] ifFalse: [ self easyBtn disable. self normalBtn disable. self impBtn disable ] This kind of code may be think that may be you need another object that represent the TwoUsers vsComputer strategy I'm not sure but clicked look quite long. May be you should create another class that can represent the logic of the game. A really interesting exercise would be to see how you can create a boardGame for 15*15 and see how it breaks some hidden rules. On 08 Feb 2014, at 15:07, Маркіян Різун mri...@gmail.com wrote: 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 XsOsGame) ! 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 Маркіян Різун mri...@gmail.com: Thanks, I'll certainly take a look at it 2014-02-05 Damien Cassou damien.cas...@gmail.com: On Tue, Feb 4, 2014 at 8:58 PM, Маркіян Різун mri...@gmail.com 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
Re: [Pharo-users] XsOs game
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 XsOsGame) ! 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 Маркіян Різун mri...@gmail.com: Thanks, I'll certainly take a look at it 2014-02-05 Damien Cassou damien.cas...@gmail.com: On Tue, Feb 4, 2014 at 8:58 PM, Маркіян Різун mri...@gmail.com 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
Re: [Pharo-users] XsOs game
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 damien.cas...@gmail.com: Would you consider writing a tutorial on how to implement an XsOs game in Pharo? 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
Re: [Pharo-users] XsOs game
That's a good idea:) I should think how to write this tutorial. 2014-02-04 Yuriy Tymchuk yuriy.tymc...@me.com: On 04 Feb 2014, at 18:08, Yuriy Tymchuk yuriy.tymc...@me.com wrote: On 04 Feb 2014, at 18:04, Маркіян Різун mri...@gmail.com wrote: 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 damien.cas...@gmail.com: Would you consider writing a tutorial on how to implement an XsOs game in Pharo? 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. I'd suggest you to start writing a tutorial on XO 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 * deadline night Uko P.S. good job :) Mark
Re: [Pharo-users] XsOs game
2014-02-04 Yuriy Tymchuk yuriy.tymc...@me.com: 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 :) You just stole my idea for AI (Easy level). Also there should be Normal and Impossible levels. On Impossible computer always wins;)
Re: [Pharo-users] XsOs game
To play it just type in workspace following: XsAndOsGame new openInWorld 2014-02-03 Маркіян Різун mri...@gmail.com: Hello, everyone! I'm working on XsOs 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.
Re: [Pharo-users] XsOs game
Sure, that is in my plans:) 2014-02-03 kilon alios kilon.al...@gmail.com: 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, Маркіян Різун mri...@gmail.com wrote: To play it just type in workspace following: XsAndOsGame new openInWorld 2014-02-03 Маркіян Різун mri...@gmail.com: Hello, everyone! I'm working on XsOs 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.
Re: [Pharo-users] XsOs game
Thx) That's nice 2014-02-03 kilon alios kilon.al...@gmail.com: 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, Маркіян Різун mri...@gmail.com wrote: Sure, that is in my plans:) 2014-02-03 kilon alios kilon.al...@gmail.com: 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, Маркіян Різун mri...@gmail.com wrote: To play it just type in workspace following: XsAndOsGame new openInWorld 2014-02-03 Маркіян Різун mri...@gmail.com: Hello, everyone! I'm working on XsOs 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.
[Pharo-users] Drawing a line
Hello! Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form. Thank you for help. Mark
Re: [Pharo-users] Drawing a line
Thanks for help. I'll try out your suggestions. Mark 16 січ. 2014 12:50, користувач Henrik Johansen henrik.s.johan...@veloxit.no написав: On 16 Jan 2014, at 10:52 , Маркіян Різун mri...@gmail.com wrote: Hello! Task is simple - draw a line on a form(actually this line will be a border of a cell). While browsing classes I found LineSegment and LineMorph. Which of them is better to use in my case? And another question: I know how to initialize both of them, but don't know how to draw it on my form. Thank you for help. Mark myForm getCanvas line: pt1 to: pt2 width: w color: c You only need to use a LineMorph if the line is not supposed to be static, otherwise drawing it directly on the Form is just as easy. Unless what you actually want is to create something like a spreadsheet, in which case a CellMorph, with RectangleMorph (cell outline) / StringMorph (cell contents) as subcomponents would probably be a better solution. (And the spreadsheet itself a morph, with CellMorphs as subcomponents) Cheers, Henry
Re: [Pharo-users] Replacement for SketchMorph?
Thank you very much. Comments are really helpful. Mark 2014/1/16 Sean P. DeNigris s...@clipperadams.com Маркіян Різун wrote appropriate replacement for it. Hi! See ImageMorph. IIRC there is a good class comment - Cheers, Sean -- View this message in context: http://forum.world.st/Replacement-for-SketchMorph-tp4737288p4737293.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Re: [Pharo-users] Laser Game
Or maybe I should write it from the beginnig. 2013/9/5 Маркіян Різун mri...@gmail.com I guess Marcus is right, the best option is to rewrite some (big) parts of code. 2013/9/5 Yuriy Tymchuk yuriy.tymc...@me.com You can explore what methods are needed and how they are implemented in Squeak uko On 5 вер. 2013, at 10:27, Маркіян Різун mri...@gmail.com wrote: Used RectangleMorph, still doesn't work. Obviously, it's because of some methods of SketchMorph that are used. 2013/9/5 Stéphane Ducasse stephane.duca...@inria.fr I should look at the tutorial because it looks really strange to me to use a sketchMorph for a board game. On Sep 4, 2013, at 11:09 AM, Маркіян Різун mri...@gmail.com wrote: I thought about that:) SketchMorph is used to create game board, so I need it. Can I use some other Morph? Mark 2013/9/3 Stéphane Ducasse stephane.duca...@inria.fr On Sep 3, 2013, at 12:07 PM, Маркіян Різун mri...@gmail.com wrote: I was dealing with laser game on pharo and found two problems. 1. LedMorph is missing but it's ok, I downloaded it (Morphic Extras). you cn find it under my repository on Smalltalkhub 2.SketchMorph is missing too, and I have some difficulties with it. When trying to load it (Morphic Basic) with Monticello browser an error occurs. Any ideas? Remove reference to SketchMorph. Stef 2013/9/2 Маркіян Різун mri...@gmail.com Thanks) 2013/9/2 Stéphane Ducasse stephane.duca...@inria.fr On Sep 2, 2013, at 2:05 PM, Yuriy Tymchuk yuriy.tymc...@me.com wrote: Hi, yes it can. This is where your adventure begins :) Also I think that I may be easier to follow the tutorial step by step with Pharo. Then you'll solve problems just when they appear and not end up with a tons of unknown stuff. ;) Uko On 2 вер. 2013, at 15:02, Маркіян Різун mri...@gmail.com wrote: As was suggested above I tried to load Laser Game on Pharo 2.0 and it didn't work. Can this problem be solved? 2013/8/16 Stéphane Ducasse stephane.duca...@inria.fr On Aug 16, 2013, at 11:11 AM, Маркіян Різун mri...@gmail.com wrote: Hi, everyone! I have been working on a tutorial 'how to make a game using smalltalk' and developed this game ( Laser Game ) on Squeak, as it is an example of development on Squeak. I'm learning, so it's a great experience for me. Laser Game is my first game and it's not complicated, but for me it took long time to make. Links: 1. http://squeak.preeminent.org/tut2007/html/ - website of tutorial 2. http://smalltalkhub.com/#!/~MarkRizun/LaserGame/source - Laser Game Comments are welcome:) I thought that you were doing it on Pharo. It would be good to have it on pharo and to know what are the changes at the morphic level. Mark
Re: [Pharo-users] Laser Game
I thought about that:) SketchMorph is used to create game board, so I need it. Can I use some other Morph? Mark 2013/9/3 Stéphane Ducasse stephane.duca...@inria.fr On Sep 3, 2013, at 12:07 PM, Маркіян Різун mri...@gmail.com wrote: I was dealing with laser game on pharo and found two problems. 1. LedMorph is missing but it's ok, I downloaded it (Morphic Extras). you cn find it under my repository on Smalltalkhub 2.SketchMorph is missing too, and I have some difficulties with it. When trying to load it (Morphic Basic) with Monticello browser an error occurs. Any ideas? Remove reference to SketchMorph. Stef 2013/9/2 Маркіян Різун mri...@gmail.com Thanks) 2013/9/2 Stéphane Ducasse stephane.duca...@inria.fr On Sep 2, 2013, at 2:05 PM, Yuriy Tymchuk yuriy.tymc...@me.com wrote: Hi, yes it can. This is where your adventure begins :) Also I think that I may be easier to follow the tutorial step by step with Pharo. Then you'll solve problems just when they appear and not end up with a tons of unknown stuff. ;) Uko On 2 вер. 2013, at 15:02, Маркіян Різун mri...@gmail.com wrote: As was suggested above I tried to load Laser Game on Pharo 2.0 and it didn't work. Can this problem be solved? 2013/8/16 Stéphane Ducasse stephane.duca...@inria.fr On Aug 16, 2013, at 11:11 AM, Маркіян Різун mri...@gmail.com wrote: Hi, everyone! I have been working on a tutorial 'how to make a game using smalltalk' and developed this game ( Laser Game ) on Squeak, as it is an example of development on Squeak. I'm learning, so it's a great experience for me. Laser Game is my first game and it's not complicated, but for me it took long time to make. Links: 1. http://squeak.preeminent.org/tut2007/html/ - website of tutorial 2. http://smalltalkhub.com/#!/~MarkRizun/LaserGame/source - Laser Game Comments are welcome:) I thought that you were doing it on Pharo. It would be good to have it on pharo and to know what are the changes at the morphic level. Mark
Re: [Pharo-users] Laser Game
2013/9/4 p...@highoctane.be p...@highoctane.be you can get a rectanglemorph and a Form I'll try that) Thank you
Re: [Pharo-users] Laser Game
There are different errors: SubscriptOutOfBounds: 1 , MessageNotUnderstood: PasteUpMorphmorphToDropForm: . Mark 2013/9/3 Yuriy Tymchuk yuriy.tymc...@me.com Hi. Maybe you can provide more detail about the error? uko On 3 вер. 2013, at 13:07, Маркіян Різун mri...@gmail.com wrote: I was dealing with laser game on pharo and found two problems. 1. LedMorph is missing but it's ok, I downloaded it (Morphic Extras). 2.SketchMorph is missing too, and I have some difficulties with it. When trying to load it (Morphic Basic) with Monticello browser an error occurs. Any ideas? 2013/9/2 Маркіян Різун mri...@gmail.com Thanks) 2013/9/2 Stéphane Ducasse stephane.duca...@inria.fr On Sep 2, 2013, at 2:05 PM, Yuriy Tymchuk yuriy.tymc...@me.com wrote: Hi, yes it can. This is where your adventure begins :) Also I think that I may be easier to follow the tutorial step by step with Pharo. Then you'll solve problems just when they appear and not end up with a tons of unknown stuff. ;) Uko On 2 вер. 2013, at 15:02, Маркіян Різун mri...@gmail.com wrote: As was suggested above I tried to load Laser Game on Pharo 2.0 and it didn't work. Can this problem be solved? 2013/8/16 Stéphane Ducasse stephane.duca...@inria.fr On Aug 16, 2013, at 11:11 AM, Маркіян Різун mri...@gmail.com wrote: Hi, everyone! I have been working on a tutorial 'how to make a game using smalltalk' and developed this game ( Laser Game ) on Squeak, as it is an example of development on Squeak. I'm learning, so it's a great experience for me. Laser Game is my first game and it's not complicated, but for me it took long time to make. Links: 1. http://squeak.preeminent.org/tut2007/html/ - website of tutorial 2. http://smalltalkhub.com/#!/~MarkRizun/LaserGame/source - Laser Game Comments are welcome:) I thought that you were doing it on Pharo. It would be good to have it on pharo and to know what are the changes at the morphic level. Mark
Re: [Pharo-users] Laser Game
As was suggested above I tried to load Laser Game on Pharo 2.0 and it didn't work. Can this problem be solved? 2013/8/16 Stéphane Ducasse stephane.duca...@inria.fr On Aug 16, 2013, at 11:11 AM, Маркіян Різун mri...@gmail.com wrote: Hi, everyone! I have been working on a tutorial 'how to make a game using smalltalk' and developed this game ( Laser Game ) on Squeak, as it is an example of development on Squeak. I'm learning, so it's a great experience for me. Laser Game is my first game and it's not complicated, but for me it took long time to make. Links: 1. http://squeak.preeminent.org/tut2007/html/ - website of tutorial 2. http://smalltalkhub.com/#!/~MarkRizun/LaserGame/source - Laser Game Comments are welcome:) I thought that you were doing it on Pharo. It would be good to have it on pharo and to know what are the changes at the morphic level. Mark
Re: [Pharo-users] Laser Game
Thanks) 2013/9/2 Stéphane Ducasse stephane.duca...@inria.fr On Sep 2, 2013, at 2:05 PM, Yuriy Tymchuk yuriy.tymc...@me.com wrote: Hi, yes it can. This is where your adventure begins :) Also I think that I may be easier to follow the tutorial step by step with Pharo. Then you'll solve problems just when they appear and not end up with a tons of unknown stuff. ;) Uko On 2 вер. 2013, at 15:02, Маркіян Різун mri...@gmail.com wrote: As was suggested above I tried to load Laser Game on Pharo 2.0 and it didn't work. Can this problem be solved? 2013/8/16 Stéphane Ducasse stephane.duca...@inria.fr On Aug 16, 2013, at 11:11 AM, Маркіян Різун mri...@gmail.com wrote: Hi, everyone! I have been working on a tutorial 'how to make a game using smalltalk' and developed this game ( Laser Game ) on Squeak, as it is an example of development on Squeak. I'm learning, so it's a great experience for me. Laser Game is my first game and it's not complicated, but for me it took long time to make. Links: 1. http://squeak.preeminent.org/tut2007/html/ - website of tutorial 2. http://smalltalkhub.com/#!/~MarkRizun/LaserGame/source - Laser Game Comments are welcome:) I thought that you were doing it on Pharo. It would be good to have it on pharo and to know what are the changes at the morphic level. Mark
[Pharo-users] Laser Game
Hi, everyone! I have been working on a tutorial 'how to make a game using smalltalk' and developed this game ( Laser Game ) on Squeak, as it is an example of development on Squeak. I'm learning, so it's a great experience for me. Laser Game is my first game and it's not complicated, but for me it took long time to make. Links: 1. http://squeak.preeminent.org/tut2007/html/ - website of tutorial 2. http://smalltalkhub.com/#!/~MarkRizun/LaserGame/source - Laser Game Comments are welcome:) Mark
Re: [Pharo-users] Problem with saving in repository
Thank you guys. 2013/7/15 Yuriy Tymchuk yuriy.tymc...@me.com So, yeah. You should enter user and password. You can do this by right-clicking a repository end selecting edit. Uko On 15 лип. 2013, at 16:05, Маркіян Різун mri...@gmail.com wrote: Version 2.0 Repository: MCHttpRepository location: 'http://smalltalkhub.com/mc/MarkRizun/LaserGame/main' user: '' password: '' 2013/7/15 Yuriy Tymchuk yuriy.tymc...@me.com Hi. Looks like the problem is with authentication (according to 403 error). Maybe you have forgotten to enter credentials, or just made a mistake? Uko On 15 лип. 2013, at 15:48, Маркіян Різун mri...@gmail.com wrote: Hi guys, When I'm trying to save my code in repository it failes and gives me error. Am I doing something wrong? error.jpg
Re: [Pharo-users] New guy in the community.
Maybe it wasn't encouraging however I will try to make my dream real. 2013/6/4 Esteban Lorenzano esteba...@gmail.com On Jun 4, 2013, at 1:22 PM, Clément Bera bera.clem...@gmail.com wrote: Hello and welcome, Yeah lots of programmers start programming willing to do video games. But a few finish by really doing games... that's really encouraging ;) but yes... 25 years ago I made my first small program: 10 PRINT HELLO 20 GOTO 10 ( it was a Commodore 64 :D ) ... and I was already dreaming about doing games :) finally last year I decided it was about time to actually doing games and I started storm project for that... now I'm again stuck doing something else, but well... dreams are for make us moving on :) anyway, welcome and I hope you find here a place to make your dreams live. Esteban When I was student (a year ago) I started to implement a game, and then I switched and I am now working in compiler virtual machines related stuff. But recently I decided to fulfill my dream and to finish the game I started as a student. Some features are still missing, but the game is there : http://clementbera.github.io/amber/projects/easnoth/easnoth.html# This is done in Smalltalk. Not directly in Pharo, because Pharo permits to do client applications, and as a small game I prefered to have it on the web so I implemented in in amber http://amber-lang.net/, which could be described as a Pharo on the web. Good luck with Pharo. Any question is welcomed. Clement 2013/6/4 Маркіян Різун mri...@gmail.com Hi everyone! My name is Mark and I'm new in Pharo community. I live in Ukraine and study in Ivan Franko National University of Lviv on the Faculty of Applied Mathematics and Informatics. I've just finished my first year and now I want to study programming a lot (I have whole summer!). I hope, that after some time I will be able to create some cool things and also to inspire other novice programmers, as my friend inspired me. My dream is to create games. I know, that it can take a lot of time even for a simple ones, but I'm ready for it. Thank you guys for reading this. Mark. -- Clément Béra Mate Virtual Machine Engineer Bâtiment B 40, avenue Halley 59650 *Villeneuve d'Ascq*