flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > RoShamBo - the simplest game. amd64, Win7

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4209
Location: vpcmpistri
bitRAKE 25 Apr 2013, 08:56
Rock | Paper | Scissors is a very old game. Like the prisoner's dilemma when played repeatedly complex patterns of play can develope. But I haven't coded any of that - I just wrote a simple interface for now. It looks pretty and is an example of minimal UI design.

In the future it will be easy to add new computer agents with different play styles. For now there are only two.

Download zip and compile with FASM:
https://github.com/bitRAKE/RoShamBo

And/Or watch the video...
http://www.youtube.com/watch?v=rM9k_DQYnfU

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 25 Apr 2013, 08:56
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 25 Apr 2013, 09:20
I like the UI, especially those "fuzzy" transitions between button states. Smile

I have one suggestion though, don't use '%INCLUDE%' in the paths - it's simply unnecessary (let people set their INCLUDE environment variable with the proper path to the FASM includes directory). Wink
Post 25 Apr 2013, 09:20
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4209
Location: vpcmpistri
bitRAKE 25 Apr 2013, 09:58
I forgot why I was using %INCLUDE%. Think one of the six editors I'm using needs it. Or there was something else maybe. Removed.

I'm not really that lucky, the Test agent is predictable.
Post 25 Apr 2013, 09:58
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 25 Apr 2013, 10:11
bitRAKE wrote:
I'm not really that lucky, the Test agent is predictable.
Yeah, seems that always directly after the program start the stone is the first correct answer. Wink I think you may change the random number generator you've used there. To seed it you may use not only the timer but also such "physical" factors as the coordinates of the mouse pointer, maybe also content of some chosen parts of graphical memory or such.
Post 25 Apr 2013, 10:11
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20593
Location: In your JS exploiting you and your system
revolution 25 Apr 2013, 10:23
Both windows and Linux have good[1] random number generators built in. There is not really any need to roll your own unless you are trying to learn or something, otherwise use the OS, that is what it is there for.

[1] By "good" I mean not-predictable and cryptographically secure also. But it is not perfect, naturally, because it is based upon algorithms and some external random events as seed material. For better quality randomness you would need to go to a proper hardware solution, but this would likely be extreme overkill unless you are dealing with banking transactions or similar things.
Post 25 Apr 2013, 10:23
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4209
Location: vpcmpistri
bitRAKE 25 Apr 2013, 11:53
Test agent is just a loop of 32 moves.

Random agent ues Park-Miller, seeded by RDTSC. Which is sufficient here. Random is far from optimal against human or other non-random agents.

http://www.rpscontest.com/

Some Japanese researcher created a robot that plays using a high-speed camera to detect human movement and plays perfectly. Laughing

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 25 Apr 2013, 11:53
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 25 Apr 2013, 17:26
bitRAKE,

AGENTS symbolic constant isn't used outside ubiquitous match L,AGENTS { irp T,L \{ expand/iterate combo, then it could be fixed instead (to drop those matches).
Post 25 Apr 2013, 17:26
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 26 Apr 2013, 04:04
Add AI difficulty when implementing it. Like this:

Choose Difficulty:
-------------------
Noob
Intermediate
Professional
Insane
God

lol
Post 26 Apr 2013, 04:04
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4209
Location: vpcmpistri
bitRAKE 26 Apr 2013, 05:21
Thanks, baldr, I was thinking on moving it to the Agent files - just didn't do it. So, just the order of includes would determine Agent order. Then I thought there could be a benefit to have different orders for each. Switching to FIX is much easier on the eyes.
Post 26 Apr 2013, 05:21
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.