Great, if slightly quirky, video from Paul Irish. Some good points about IIFE’s and jQuery selector performance.
I’ve even added a Cornify button for you to click here:
Great, if slightly quirky, video from Paul Irish. Some good points about IIFE’s and jQuery selector performance.
I’ve even added a Cornify button for you to click here:
<appSettings> <add key="LeadingBytes" value="2"/> <add key="LeadingBytesValue" value="7"/> </appSettings>
Where NZ is number of leading zero bytes the hash of the result must have, in this case 4 Also stores value in a list of request values for the session.
NZ[ random data ] X-PoWRequest: 0465A709F1CE40EABEFEF4C94FA0E9A8
Server checks that X-PoWRequest is present, if not response invalid.
X-PoWRequest: 0465A709F1CE40EABEFEF4C94FA0E9A8 X-PoWResponse: ED807302BF6A403ABE0C0864E271E284
[ server value ][ client value ]
0465A709F1CE40EABEFEF4C94FA0E9A8ED807302BF6A403ABE0C0864E271E284
[ hash ]
00000000891444D0AE14416C4D25E59EACE0404151F44C118F8B1CF868C314A8
Other helper methods:
public static Task<byte[]> GenerateResponse(byte[] request) public static Task<string> GenerateResponse(string request) public static Task GenerateResponse(HttpContext context)
public static bool RequiresResponse(HttpContext context) public static string GetRequest(HttpContext context) public static byte[] GetRequest(HttpContext context) public static void SetResponse(HttpContext context, byte[] request, byte[] response) public static void SetResponse(HttpContext context, string request, string response)
Although the name suggest that this is a game, at present it is merely a demo. When you visit the site (in a browser that fulfils the requirements below) then you will be presented with a first-person view from your own personal spaceship, flying through the galaxy.
Other people also viewing the site at the same time as you will be visible to you as spaceships flying through space, their positions updated in real time. Your spaceship will also be visible to them.
Mouse
Keyboard
Top left displays your radar, which shows where other ships are in space. Your ship is represented by the large green dot in the centre, other ships are smaller red dots around. If a red dot is on top of the green dot that means that either the other ship is right next to you, or directly in front of you.
Bottom left displays the game info messages, which will tell you about events in the galaxy, such as a new player joining the game.
You will need a browser that supports WebGL, running on a reasonably powerful computer with decent graphics hardware.
The currently recommended browser is Google Chrome. The demo works ok on Firefox (but not as fast as Chrome), and not at all on IE 10 or less. Apparently this may be changed in IE 11 (which will possibly support WebGL).
Google Chrome has also been found to work on Android devices, such as Tablets and recent phones. However what does not work at present is the touch interface for these devices. At present this is primarily a desktop-with-mouse driven experience.
This demo uses WebGL for the graphics rendering. It also uses either WebSockets, Server-Sent Events or AJAX Long Polling for the real-time communications.
It is built with the following technologies:
A live demo is available here: http://awesome3dgame.azurewebsites.net/
Source code is available on Github here: https://github.com/SneakyBrian/Awesome3DGame
In future posts I will delve into the details of how this was implemented.
<TexasHoldemOdds xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PokerOdds.Mvc.Web.Models.TexasHoldem">
<Board>7h as th</Board>
<CalculationTimeMS>1678</CalculationTimeMS>
<Completed>true</Completed>
<Outcomes>
<PokerOutcome>
<HandType>HighCard</HandType>
<HandTypeName>HighCard</HandTypeName>
<WinPercentage>8.459619319933843</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>Pair</HandType>
<HandTypeName>Pair</HandTypeName>
<WinPercentage>20.051439464020408</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>TwoPair</HandType>
<HandTypeName>TwoPair</HandTypeName>
<WinPercentage>5.14609555312608</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>Trips</HandType>
<HandTypeName>Trips</HandTypeName>
<WinPercentage>0.90100823218307036</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>Straight</HandType>
<HandTypeName>Straight</HandTypeName>
<WinPercentage>1.326353264373616</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>Flush</HandType>
<HandTypeName>Flush</HandTypeName>
<WinPercentage>0</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>FullHouse</HandType>
<HandTypeName>FullHouse</HandTypeName>
<WinPercentage>0</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>FourOfAKind</HandType>
<HandTypeName>FourOfAKind</HandTypeName>
<WinPercentage>0</WinPercentage>
</PokerOutcome>
<PokerOutcome>
<HandType>StraightFlush</HandType>
<HandTypeName>StraightFlush</HandTypeName>
<WinPercentage>0</WinPercentage>
</PokerOutcome>
</Outcomes>
<OverallWinSplitPercentage>35.884515833637018</OverallWinSplitPercentage>
<Pocket>2d qc</Pocket>
</TexasHoldemOdds>
{
"Pocket" : "2d qc",
"Board" : "7h as th",
"Outcomes" : [{
"HandType" : 0,
"HandTypeName" : "HighCard",
"WinPercentage" : 8.459619319933843
}, {
"HandType" : 1,
"HandTypeName" : "Pair",
"WinPercentage" : 20.051439464020408
}, {
"HandType" : 2,
"HandTypeName" : "TwoPair",
"WinPercentage" : 5.14609555312608
}, {
"HandType" : 3,
"HandTypeName" : "Trips",
"WinPercentage" : 0.90100823218307036
}, {
"HandType" : 4,
"HandTypeName" : "Straight",
"WinPercentage" : 1.326353264373616
}, {
"HandType" : 5,
"HandTypeName" : "Flush",
"WinPercentage" : 0.0
}, {
"HandType" : 6,
"HandTypeName" : "FullHouse",
"WinPercentage" : 0.0
}, {
"HandType" : 7,
"HandTypeName" : "FourOfAKind",
"WinPercentage" : 0.0
}, {
"HandType" : 8,
"HandTypeName" : "StraightFlush",
"WinPercentage" : 0.0
}
],
"OverallWinSplitPercentage" : 35.884515833637018,
"Completed" : true,
"CalculationTimeMS" : 1816
}