(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| Blackjack is a popular card game played against a Dealer. In this card game the Player is trying to beat the Dealer. | |
| Deck: | |
| The game is played with 4 or more decks containing 52 distinct cards in each (Face values : A, 2-9, J, Q and K; Suits : D,C,S,H) | |
| The entire deck is shuffled before the start of the game. | |
| Beginning: | |
| Player and Dealer are initially dealt 2 cards each. Only one of the Dealer's cards is visible to the Player, the other is hidden. All the cards of the Player are visible to everyone at all times. | |
| Turns: |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
*.xls diff=xdoc2txt
| package edu.pk.java.test; | |
| import java.util.Random; | |
| import java.util.concurrent.ArrayBlockingQueue; | |
| import java.util.concurrent.BlockingQueue; | |
| import java.util.concurrent.TimeUnit; | |
| import static edu.pk.java.test.PublisherSubscriberTest.*; | |
| public class PublisherSubscriberTest { |
| import java.io.IOException; | |
| import java.util.Random; | |
| import java.util.function.Consumer; | |
| class ReactiveImplDemo { | |
| public static void main(String[] args) throws IOException { | |
| System.out.println("Start"); | |
| ReactiveSource.getIntFlux(20).subscribe(x -> System.out.println("Subscriber 1 received int: " + x)); | |
| ReactiveSource.getIntFlux(12).subscribe(x -> System.out.println(" Subscriber 2 received int: " + x)); | |
| System.out.println("End. Press any key to continue"); |