1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
/// A number of constants to give a name to all characters in this block.
mod constants {
    /// \u{1f0a0}: '🂠'
    pub const PLAYING_CARD_BACK: char = '🂠';
    /// \u{1f0a1}: '🂡'
    pub const PLAYING_CARD_ACE_OF_SPADES: char = '🂡';
    /// \u{1f0a2}: '🂢'
    pub const PLAYING_CARD_TWO_OF_SPADES: char = '🂢';
    /// \u{1f0a3}: '🂣'
    pub const PLAYING_CARD_THREE_OF_SPADES: char = '🂣';
    /// \u{1f0a4}: '🂤'
    pub const PLAYING_CARD_FOUR_OF_SPADES: char = '🂤';
    /// \u{1f0a5}: '🂥'
    pub const PLAYING_CARD_FIVE_OF_SPADES: char = '🂥';
    /// \u{1f0a6}: '🂦'
    pub const PLAYING_CARD_SIX_OF_SPADES: char = '🂦';
    /// \u{1f0a7}: '🂧'
    pub const PLAYING_CARD_SEVEN_OF_SPADES: char = '🂧';
    /// \u{1f0a8}: '🂨'
    pub const PLAYING_CARD_EIGHT_OF_SPADES: char = '🂨';
    /// \u{1f0a9}: '🂩'
    pub const PLAYING_CARD_NINE_OF_SPADES: char = '🂩';
    /// \u{1f0aa}: '🂪'
    pub const PLAYING_CARD_TEN_OF_SPADES: char = '🂪';
    /// \u{1f0ab}: '🂫'
    pub const PLAYING_CARD_JACK_OF_SPADES: char = '🂫';
    /// \u{1f0ac}: '🂬'
    pub const PLAYING_CARD_KNIGHT_OF_SPADES: char = '🂬';
    /// \u{1f0ad}: '🂭'
    pub const PLAYING_CARD_QUEEN_OF_SPADES: char = '🂭';
    /// \u{1f0ae}: '🂮'
    pub const PLAYING_CARD_KING_OF_SPADES: char = '🂮';
    /// \u{1f0b1}: '🂱'
    pub const PLAYING_CARD_ACE_OF_HEARTS: char = '🂱';
    /// \u{1f0b2}: '🂲'
    pub const PLAYING_CARD_TWO_OF_HEARTS: char = '🂲';
    /// \u{1f0b3}: '🂳'
    pub const PLAYING_CARD_THREE_OF_HEARTS: char = '🂳';
    /// \u{1f0b4}: '🂴'
    pub const PLAYING_CARD_FOUR_OF_HEARTS: char = '🂴';
    /// \u{1f0b5}: '🂵'
    pub const PLAYING_CARD_FIVE_OF_HEARTS: char = '🂵';
    /// \u{1f0b6}: '🂶'
    pub const PLAYING_CARD_SIX_OF_HEARTS: char = '🂶';
    /// \u{1f0b7}: '🂷'
    pub const PLAYING_CARD_SEVEN_OF_HEARTS: char = '🂷';
    /// \u{1f0b8}: '🂸'
    pub const PLAYING_CARD_EIGHT_OF_HEARTS: char = '🂸';
    /// \u{1f0b9}: '🂹'
    pub const PLAYING_CARD_NINE_OF_HEARTS: char = '🂹';
    /// \u{1f0ba}: '🂺'
    pub const PLAYING_CARD_TEN_OF_HEARTS: char = '🂺';
    /// \u{1f0bb}: '🂻'
    pub const PLAYING_CARD_JACK_OF_HEARTS: char = '🂻';
    /// \u{1f0bc}: '🂼'
    pub const PLAYING_CARD_KNIGHT_OF_HEARTS: char = '🂼';
    /// \u{1f0bd}: '🂽'
    pub const PLAYING_CARD_QUEEN_OF_HEARTS: char = '🂽';
    /// \u{1f0be}: '🂾'
    pub const PLAYING_CARD_KING_OF_HEARTS: char = '🂾';
    /// \u{1f0bf}: '🂿'
    pub const PLAYING_CARD_RED_JOKER: char = '🂿';
    /// \u{1f0c1}: '🃁'
    pub const PLAYING_CARD_ACE_OF_DIAMONDS: char = '🃁';
    /// \u{1f0c2}: '🃂'
    pub const PLAYING_CARD_TWO_OF_DIAMONDS: char = '🃂';
    /// \u{1f0c3}: '🃃'
    pub const PLAYING_CARD_THREE_OF_DIAMONDS: char = '🃃';
    /// \u{1f0c4}: '🃄'
    pub const PLAYING_CARD_FOUR_OF_DIAMONDS: char = '🃄';
    /// \u{1f0c5}: '🃅'
    pub const PLAYING_CARD_FIVE_OF_DIAMONDS: char = '🃅';
    /// \u{1f0c6}: '🃆'
    pub const PLAYING_CARD_SIX_OF_DIAMONDS: char = '🃆';
    /// \u{1f0c7}: '🃇'
    pub const PLAYING_CARD_SEVEN_OF_DIAMONDS: char = '🃇';
    /// \u{1f0c8}: '🃈'
    pub const PLAYING_CARD_EIGHT_OF_DIAMONDS: char = '🃈';
    /// \u{1f0c9}: '🃉'
    pub const PLAYING_CARD_NINE_OF_DIAMONDS: char = '🃉';
    /// \u{1f0ca}: '🃊'
    pub const PLAYING_CARD_TEN_OF_DIAMONDS: char = '🃊';
    /// \u{1f0cb}: '🃋'
    pub const PLAYING_CARD_JACK_OF_DIAMONDS: char = '🃋';
    /// \u{1f0cc}: '🃌'
    pub const PLAYING_CARD_KNIGHT_OF_DIAMONDS: char = '🃌';
    /// \u{1f0cd}: '🃍'
    pub const PLAYING_CARD_QUEEN_OF_DIAMONDS: char = '🃍';
    /// \u{1f0ce}: '🃎'
    pub const PLAYING_CARD_KING_OF_DIAMONDS: char = '🃎';
    /// \u{1f0cf}: '🃏'
    pub const PLAYING_CARD_BLACK_JOKER: char = '🃏';
    /// \u{1f0d1}: '🃑'
    pub const PLAYING_CARD_ACE_OF_CLUBS: char = '🃑';
    /// \u{1f0d2}: '🃒'
    pub const PLAYING_CARD_TWO_OF_CLUBS: char = '🃒';
    /// \u{1f0d3}: '🃓'
    pub const PLAYING_CARD_THREE_OF_CLUBS: char = '🃓';
    /// \u{1f0d4}: '🃔'
    pub const PLAYING_CARD_FOUR_OF_CLUBS: char = '🃔';
    /// \u{1f0d5}: '🃕'
    pub const PLAYING_CARD_FIVE_OF_CLUBS: char = '🃕';
    /// \u{1f0d6}: '🃖'
    pub const PLAYING_CARD_SIX_OF_CLUBS: char = '🃖';
    /// \u{1f0d7}: '🃗'
    pub const PLAYING_CARD_SEVEN_OF_CLUBS: char = '🃗';
    /// \u{1f0d8}: '🃘'
    pub const PLAYING_CARD_EIGHT_OF_CLUBS: char = '🃘';
    /// \u{1f0d9}: '🃙'
    pub const PLAYING_CARD_NINE_OF_CLUBS: char = '🃙';
    /// \u{1f0da}: '🃚'
    pub const PLAYING_CARD_TEN_OF_CLUBS: char = '🃚';
    /// \u{1f0db}: '🃛'
    pub const PLAYING_CARD_JACK_OF_CLUBS: char = '🃛';
    /// \u{1f0dc}: '🃜'
    pub const PLAYING_CARD_KNIGHT_OF_CLUBS: char = '🃜';
    /// \u{1f0dd}: '🃝'
    pub const PLAYING_CARD_QUEEN_OF_CLUBS: char = '🃝';
    /// \u{1f0de}: '🃞'
    pub const PLAYING_CARD_KING_OF_CLUBS: char = '🃞';
    /// \u{1f0df}: '🃟'
    pub const PLAYING_CARD_WHITE_JOKER: char = '🃟';
    /// \u{1f0e0}: '🃠'
    pub const PLAYING_CARD_FOOL: char = '🃠';
    /// \u{1f0e1}: '🃡'
    pub const PLAYING_CARD_TRUMP_DASH_1: char = '🃡';
    /// \u{1f0e2}: '🃢'
    pub const PLAYING_CARD_TRUMP_DASH_2: char = '🃢';
    /// \u{1f0e3}: '🃣'
    pub const PLAYING_CARD_TRUMP_DASH_3: char = '🃣';
    /// \u{1f0e4}: '🃤'
    pub const PLAYING_CARD_TRUMP_DASH_4: char = '🃤';
    /// \u{1f0e5}: '🃥'
    pub const PLAYING_CARD_TRUMP_DASH_5: char = '🃥';
    /// \u{1f0e6}: '🃦'
    pub const PLAYING_CARD_TRUMP_DASH_6: char = '🃦';
    /// \u{1f0e7}: '🃧'
    pub const PLAYING_CARD_TRUMP_DASH_7: char = '🃧';
    /// \u{1f0e8}: '🃨'
    pub const PLAYING_CARD_TRUMP_DASH_8: char = '🃨';
    /// \u{1f0e9}: '🃩'
    pub const PLAYING_CARD_TRUMP_DASH_9: char = '🃩';
    /// \u{1f0ea}: '🃪'
    pub const PLAYING_CARD_TRUMP_DASH_10: char = '🃪';
    /// \u{1f0eb}: '🃫'
    pub const PLAYING_CARD_TRUMP_DASH_11: char = '🃫';
    /// \u{1f0ec}: '🃬'
    pub const PLAYING_CARD_TRUMP_DASH_12: char = '🃬';
    /// \u{1f0ed}: '🃭'
    pub const PLAYING_CARD_TRUMP_DASH_13: char = '🃭';
    /// \u{1f0ee}: '🃮'
    pub const PLAYING_CARD_TRUMP_DASH_14: char = '🃮';
    /// \u{1f0ef}: '🃯'
    pub const PLAYING_CARD_TRUMP_DASH_15: char = '🃯';
    /// \u{1f0f0}: '🃰'
    pub const PLAYING_CARD_TRUMP_DASH_16: char = '🃰';
    /// \u{1f0f1}: '🃱'
    pub const PLAYING_CARD_TRUMP_DASH_17: char = '🃱';
    /// \u{1f0f2}: '🃲'
    pub const PLAYING_CARD_TRUMP_DASH_18: char = '🃲';
    /// \u{1f0f3}: '🃳'
    pub const PLAYING_CARD_TRUMP_DASH_19: char = '🃳';
    /// \u{1f0f4}: '🃴'
    pub const PLAYING_CARD_TRUMP_DASH_20: char = '🃴';
    /// \u{1f0f5}: '🃵'
    pub const PLAYING_CARD_TRUMP_DASH_21: char = '🃵';
}

/// An enum to represent all characters in the PlayingCards block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum PlayingCards {
    /// \u{1f0a0}: '🂠'
    PlayingCardBack,
    /// \u{1f0a1}: '🂡'
    PlayingCardAceOfSpades,
    /// \u{1f0a2}: '🂢'
    PlayingCardTwoOfSpades,
    /// \u{1f0a3}: '🂣'
    PlayingCardThreeOfSpades,
    /// \u{1f0a4}: '🂤'
    PlayingCardFourOfSpades,
    /// \u{1f0a5}: '🂥'
    PlayingCardFiveOfSpades,
    /// \u{1f0a6}: '🂦'
    PlayingCardSixOfSpades,
    /// \u{1f0a7}: '🂧'
    PlayingCardSevenOfSpades,
    /// \u{1f0a8}: '🂨'
    PlayingCardEightOfSpades,
    /// \u{1f0a9}: '🂩'
    PlayingCardNineOfSpades,
    /// \u{1f0aa}: '🂪'
    PlayingCardTenOfSpades,
    /// \u{1f0ab}: '🂫'
    PlayingCardJackOfSpades,
    /// \u{1f0ac}: '🂬'
    PlayingCardKnightOfSpades,
    /// \u{1f0ad}: '🂭'
    PlayingCardQueenOfSpades,
    /// \u{1f0ae}: '🂮'
    PlayingCardKingOfSpades,
    /// \u{1f0b1}: '🂱'
    PlayingCardAceOfHearts,
    /// \u{1f0b2}: '🂲'
    PlayingCardTwoOfHearts,
    /// \u{1f0b3}: '🂳'
    PlayingCardThreeOfHearts,
    /// \u{1f0b4}: '🂴'
    PlayingCardFourOfHearts,
    /// \u{1f0b5}: '🂵'
    PlayingCardFiveOfHearts,
    /// \u{1f0b6}: '🂶'
    PlayingCardSixOfHearts,
    /// \u{1f0b7}: '🂷'
    PlayingCardSevenOfHearts,
    /// \u{1f0b8}: '🂸'
    PlayingCardEightOfHearts,
    /// \u{1f0b9}: '🂹'
    PlayingCardNineOfHearts,
    /// \u{1f0ba}: '🂺'
    PlayingCardTenOfHearts,
    /// \u{1f0bb}: '🂻'
    PlayingCardJackOfHearts,
    /// \u{1f0bc}: '🂼'
    PlayingCardKnightOfHearts,
    /// \u{1f0bd}: '🂽'
    PlayingCardQueenOfHearts,
    /// \u{1f0be}: '🂾'
    PlayingCardKingOfHearts,
    /// \u{1f0bf}: '🂿'
    PlayingCardRedJoker,
    /// \u{1f0c1}: '🃁'
    PlayingCardAceOfDiamonds,
    /// \u{1f0c2}: '🃂'
    PlayingCardTwoOfDiamonds,
    /// \u{1f0c3}: '🃃'
    PlayingCardThreeOfDiamonds,
    /// \u{1f0c4}: '🃄'
    PlayingCardFourOfDiamonds,
    /// \u{1f0c5}: '🃅'
    PlayingCardFiveOfDiamonds,
    /// \u{1f0c6}: '🃆'
    PlayingCardSixOfDiamonds,
    /// \u{1f0c7}: '🃇'
    PlayingCardSevenOfDiamonds,
    /// \u{1f0c8}: '🃈'
    PlayingCardEightOfDiamonds,
    /// \u{1f0c9}: '🃉'
    PlayingCardNineOfDiamonds,
    /// \u{1f0ca}: '🃊'
    PlayingCardTenOfDiamonds,
    /// \u{1f0cb}: '🃋'
    PlayingCardJackOfDiamonds,
    /// \u{1f0cc}: '🃌'
    PlayingCardKnightOfDiamonds,
    /// \u{1f0cd}: '🃍'
    PlayingCardQueenOfDiamonds,
    /// \u{1f0ce}: '🃎'
    PlayingCardKingOfDiamonds,
    /// \u{1f0cf}: '🃏'
    PlayingCardBlackJoker,
    /// \u{1f0d1}: '🃑'
    PlayingCardAceOfClubs,
    /// \u{1f0d2}: '🃒'
    PlayingCardTwoOfClubs,
    /// \u{1f0d3}: '🃓'
    PlayingCardThreeOfClubs,
    /// \u{1f0d4}: '🃔'
    PlayingCardFourOfClubs,
    /// \u{1f0d5}: '🃕'
    PlayingCardFiveOfClubs,
    /// \u{1f0d6}: '🃖'
    PlayingCardSixOfClubs,
    /// \u{1f0d7}: '🃗'
    PlayingCardSevenOfClubs,
    /// \u{1f0d8}: '🃘'
    PlayingCardEightOfClubs,
    /// \u{1f0d9}: '🃙'
    PlayingCardNineOfClubs,
    /// \u{1f0da}: '🃚'
    PlayingCardTenOfClubs,
    /// \u{1f0db}: '🃛'
    PlayingCardJackOfClubs,
    /// \u{1f0dc}: '🃜'
    PlayingCardKnightOfClubs,
    /// \u{1f0dd}: '🃝'
    PlayingCardQueenOfClubs,
    /// \u{1f0de}: '🃞'
    PlayingCardKingOfClubs,
    /// \u{1f0df}: '🃟'
    PlayingCardWhiteJoker,
    /// \u{1f0e0}: '🃠'
    PlayingCardFool,
    /// \u{1f0e1}: '🃡'
    PlayingCardTrumpDash1,
    /// \u{1f0e2}: '🃢'
    PlayingCardTrumpDash2,
    /// \u{1f0e3}: '🃣'
    PlayingCardTrumpDash3,
    /// \u{1f0e4}: '🃤'
    PlayingCardTrumpDash4,
    /// \u{1f0e5}: '🃥'
    PlayingCardTrumpDash5,
    /// \u{1f0e6}: '🃦'
    PlayingCardTrumpDash6,
    /// \u{1f0e7}: '🃧'
    PlayingCardTrumpDash7,
    /// \u{1f0e8}: '🃨'
    PlayingCardTrumpDash8,
    /// \u{1f0e9}: '🃩'
    PlayingCardTrumpDash9,
    /// \u{1f0ea}: '🃪'
    PlayingCardTrumpDash10,
    /// \u{1f0eb}: '🃫'
    PlayingCardTrumpDash11,
    /// \u{1f0ec}: '🃬'
    PlayingCardTrumpDash12,
    /// \u{1f0ed}: '🃭'
    PlayingCardTrumpDash13,
    /// \u{1f0ee}: '🃮'
    PlayingCardTrumpDash14,
    /// \u{1f0ef}: '🃯'
    PlayingCardTrumpDash15,
    /// \u{1f0f0}: '🃰'
    PlayingCardTrumpDash16,
    /// \u{1f0f1}: '🃱'
    PlayingCardTrumpDash17,
    /// \u{1f0f2}: '🃲'
    PlayingCardTrumpDash18,
    /// \u{1f0f3}: '🃳'
    PlayingCardTrumpDash19,
    /// \u{1f0f4}: '🃴'
    PlayingCardTrumpDash20,
    /// \u{1f0f5}: '🃵'
    PlayingCardTrumpDash21,
}

impl Into<char> for PlayingCards {
    fn into(self) -> char {
        use constants::*;
        match self {
            PlayingCards::PlayingCardBack => PLAYING_CARD_BACK,
            PlayingCards::PlayingCardAceOfSpades => PLAYING_CARD_ACE_OF_SPADES,
            PlayingCards::PlayingCardTwoOfSpades => PLAYING_CARD_TWO_OF_SPADES,
            PlayingCards::PlayingCardThreeOfSpades => PLAYING_CARD_THREE_OF_SPADES,
            PlayingCards::PlayingCardFourOfSpades => PLAYING_CARD_FOUR_OF_SPADES,
            PlayingCards::PlayingCardFiveOfSpades => PLAYING_CARD_FIVE_OF_SPADES,
            PlayingCards::PlayingCardSixOfSpades => PLAYING_CARD_SIX_OF_SPADES,
            PlayingCards::PlayingCardSevenOfSpades => PLAYING_CARD_SEVEN_OF_SPADES,
            PlayingCards::PlayingCardEightOfSpades => PLAYING_CARD_EIGHT_OF_SPADES,
            PlayingCards::PlayingCardNineOfSpades => PLAYING_CARD_NINE_OF_SPADES,
            PlayingCards::PlayingCardTenOfSpades => PLAYING_CARD_TEN_OF_SPADES,
            PlayingCards::PlayingCardJackOfSpades => PLAYING_CARD_JACK_OF_SPADES,
            PlayingCards::PlayingCardKnightOfSpades => PLAYING_CARD_KNIGHT_OF_SPADES,
            PlayingCards::PlayingCardQueenOfSpades => PLAYING_CARD_QUEEN_OF_SPADES,
            PlayingCards::PlayingCardKingOfSpades => PLAYING_CARD_KING_OF_SPADES,
            PlayingCards::PlayingCardAceOfHearts => PLAYING_CARD_ACE_OF_HEARTS,
            PlayingCards::PlayingCardTwoOfHearts => PLAYING_CARD_TWO_OF_HEARTS,
            PlayingCards::PlayingCardThreeOfHearts => PLAYING_CARD_THREE_OF_HEARTS,
            PlayingCards::PlayingCardFourOfHearts => PLAYING_CARD_FOUR_OF_HEARTS,
            PlayingCards::PlayingCardFiveOfHearts => PLAYING_CARD_FIVE_OF_HEARTS,
            PlayingCards::PlayingCardSixOfHearts => PLAYING_CARD_SIX_OF_HEARTS,
            PlayingCards::PlayingCardSevenOfHearts => PLAYING_CARD_SEVEN_OF_HEARTS,
            PlayingCards::PlayingCardEightOfHearts => PLAYING_CARD_EIGHT_OF_HEARTS,
            PlayingCards::PlayingCardNineOfHearts => PLAYING_CARD_NINE_OF_HEARTS,
            PlayingCards::PlayingCardTenOfHearts => PLAYING_CARD_TEN_OF_HEARTS,
            PlayingCards::PlayingCardJackOfHearts => PLAYING_CARD_JACK_OF_HEARTS,
            PlayingCards::PlayingCardKnightOfHearts => PLAYING_CARD_KNIGHT_OF_HEARTS,
            PlayingCards::PlayingCardQueenOfHearts => PLAYING_CARD_QUEEN_OF_HEARTS,
            PlayingCards::PlayingCardKingOfHearts => PLAYING_CARD_KING_OF_HEARTS,
            PlayingCards::PlayingCardRedJoker => PLAYING_CARD_RED_JOKER,
            PlayingCards::PlayingCardAceOfDiamonds => PLAYING_CARD_ACE_OF_DIAMONDS,
            PlayingCards::PlayingCardTwoOfDiamonds => PLAYING_CARD_TWO_OF_DIAMONDS,
            PlayingCards::PlayingCardThreeOfDiamonds => PLAYING_CARD_THREE_OF_DIAMONDS,
            PlayingCards::PlayingCardFourOfDiamonds => PLAYING_CARD_FOUR_OF_DIAMONDS,
            PlayingCards::PlayingCardFiveOfDiamonds => PLAYING_CARD_FIVE_OF_DIAMONDS,
            PlayingCards::PlayingCardSixOfDiamonds => PLAYING_CARD_SIX_OF_DIAMONDS,
            PlayingCards::PlayingCardSevenOfDiamonds => PLAYING_CARD_SEVEN_OF_DIAMONDS,
            PlayingCards::PlayingCardEightOfDiamonds => PLAYING_CARD_EIGHT_OF_DIAMONDS,
            PlayingCards::PlayingCardNineOfDiamonds => PLAYING_CARD_NINE_OF_DIAMONDS,
            PlayingCards::PlayingCardTenOfDiamonds => PLAYING_CARD_TEN_OF_DIAMONDS,
            PlayingCards::PlayingCardJackOfDiamonds => PLAYING_CARD_JACK_OF_DIAMONDS,
            PlayingCards::PlayingCardKnightOfDiamonds => PLAYING_CARD_KNIGHT_OF_DIAMONDS,
            PlayingCards::PlayingCardQueenOfDiamonds => PLAYING_CARD_QUEEN_OF_DIAMONDS,
            PlayingCards::PlayingCardKingOfDiamonds => PLAYING_CARD_KING_OF_DIAMONDS,
            PlayingCards::PlayingCardBlackJoker => PLAYING_CARD_BLACK_JOKER,
            PlayingCards::PlayingCardAceOfClubs => PLAYING_CARD_ACE_OF_CLUBS,
            PlayingCards::PlayingCardTwoOfClubs => PLAYING_CARD_TWO_OF_CLUBS,
            PlayingCards::PlayingCardThreeOfClubs => PLAYING_CARD_THREE_OF_CLUBS,
            PlayingCards::PlayingCardFourOfClubs => PLAYING_CARD_FOUR_OF_CLUBS,
            PlayingCards::PlayingCardFiveOfClubs => PLAYING_CARD_FIVE_OF_CLUBS,
            PlayingCards::PlayingCardSixOfClubs => PLAYING_CARD_SIX_OF_CLUBS,
            PlayingCards::PlayingCardSevenOfClubs => PLAYING_CARD_SEVEN_OF_CLUBS,
            PlayingCards::PlayingCardEightOfClubs => PLAYING_CARD_EIGHT_OF_CLUBS,
            PlayingCards::PlayingCardNineOfClubs => PLAYING_CARD_NINE_OF_CLUBS,
            PlayingCards::PlayingCardTenOfClubs => PLAYING_CARD_TEN_OF_CLUBS,
            PlayingCards::PlayingCardJackOfClubs => PLAYING_CARD_JACK_OF_CLUBS,
            PlayingCards::PlayingCardKnightOfClubs => PLAYING_CARD_KNIGHT_OF_CLUBS,
            PlayingCards::PlayingCardQueenOfClubs => PLAYING_CARD_QUEEN_OF_CLUBS,
            PlayingCards::PlayingCardKingOfClubs => PLAYING_CARD_KING_OF_CLUBS,
            PlayingCards::PlayingCardWhiteJoker => PLAYING_CARD_WHITE_JOKER,
            PlayingCards::PlayingCardFool => PLAYING_CARD_FOOL,
            PlayingCards::PlayingCardTrumpDash1 => PLAYING_CARD_TRUMP_DASH_1,
            PlayingCards::PlayingCardTrumpDash2 => PLAYING_CARD_TRUMP_DASH_2,
            PlayingCards::PlayingCardTrumpDash3 => PLAYING_CARD_TRUMP_DASH_3,
            PlayingCards::PlayingCardTrumpDash4 => PLAYING_CARD_TRUMP_DASH_4,
            PlayingCards::PlayingCardTrumpDash5 => PLAYING_CARD_TRUMP_DASH_5,
            PlayingCards::PlayingCardTrumpDash6 => PLAYING_CARD_TRUMP_DASH_6,
            PlayingCards::PlayingCardTrumpDash7 => PLAYING_CARD_TRUMP_DASH_7,
            PlayingCards::PlayingCardTrumpDash8 => PLAYING_CARD_TRUMP_DASH_8,
            PlayingCards::PlayingCardTrumpDash9 => PLAYING_CARD_TRUMP_DASH_9,
            PlayingCards::PlayingCardTrumpDash10 => PLAYING_CARD_TRUMP_DASH_10,
            PlayingCards::PlayingCardTrumpDash11 => PLAYING_CARD_TRUMP_DASH_11,
            PlayingCards::PlayingCardTrumpDash12 => PLAYING_CARD_TRUMP_DASH_12,
            PlayingCards::PlayingCardTrumpDash13 => PLAYING_CARD_TRUMP_DASH_13,
            PlayingCards::PlayingCardTrumpDash14 => PLAYING_CARD_TRUMP_DASH_14,
            PlayingCards::PlayingCardTrumpDash15 => PLAYING_CARD_TRUMP_DASH_15,
            PlayingCards::PlayingCardTrumpDash16 => PLAYING_CARD_TRUMP_DASH_16,
            PlayingCards::PlayingCardTrumpDash17 => PLAYING_CARD_TRUMP_DASH_17,
            PlayingCards::PlayingCardTrumpDash18 => PLAYING_CARD_TRUMP_DASH_18,
            PlayingCards::PlayingCardTrumpDash19 => PLAYING_CARD_TRUMP_DASH_19,
            PlayingCards::PlayingCardTrumpDash20 => PLAYING_CARD_TRUMP_DASH_20,
            PlayingCards::PlayingCardTrumpDash21 => PLAYING_CARD_TRUMP_DASH_21,
        }
    }
}

impl std::convert::TryFrom<char> for PlayingCards {
    type Error = ();
    fn try_from(c: char) -> Result<Self, Self::Error> {
        use constants::*;
        match c {
            PLAYING_CARD_BACK => Ok(PlayingCards::PlayingCardBack),
            PLAYING_CARD_ACE_OF_SPADES => Ok(PlayingCards::PlayingCardAceOfSpades),
            PLAYING_CARD_TWO_OF_SPADES => Ok(PlayingCards::PlayingCardTwoOfSpades),
            PLAYING_CARD_THREE_OF_SPADES => Ok(PlayingCards::PlayingCardThreeOfSpades),
            PLAYING_CARD_FOUR_OF_SPADES => Ok(PlayingCards::PlayingCardFourOfSpades),
            PLAYING_CARD_FIVE_OF_SPADES => Ok(PlayingCards::PlayingCardFiveOfSpades),
            PLAYING_CARD_SIX_OF_SPADES => Ok(PlayingCards::PlayingCardSixOfSpades),
            PLAYING_CARD_SEVEN_OF_SPADES => Ok(PlayingCards::PlayingCardSevenOfSpades),
            PLAYING_CARD_EIGHT_OF_SPADES => Ok(PlayingCards::PlayingCardEightOfSpades),
            PLAYING_CARD_NINE_OF_SPADES => Ok(PlayingCards::PlayingCardNineOfSpades),
            PLAYING_CARD_TEN_OF_SPADES => Ok(PlayingCards::PlayingCardTenOfSpades),
            PLAYING_CARD_JACK_OF_SPADES => Ok(PlayingCards::PlayingCardJackOfSpades),
            PLAYING_CARD_KNIGHT_OF_SPADES => Ok(PlayingCards::PlayingCardKnightOfSpades),
            PLAYING_CARD_QUEEN_OF_SPADES => Ok(PlayingCards::PlayingCardQueenOfSpades),
            PLAYING_CARD_KING_OF_SPADES => Ok(PlayingCards::PlayingCardKingOfSpades),
            PLAYING_CARD_ACE_OF_HEARTS => Ok(PlayingCards::PlayingCardAceOfHearts),
            PLAYING_CARD_TWO_OF_HEARTS => Ok(PlayingCards::PlayingCardTwoOfHearts),
            PLAYING_CARD_THREE_OF_HEARTS => Ok(PlayingCards::PlayingCardThreeOfHearts),
            PLAYING_CARD_FOUR_OF_HEARTS => Ok(PlayingCards::PlayingCardFourOfHearts),
            PLAYING_CARD_FIVE_OF_HEARTS => Ok(PlayingCards::PlayingCardFiveOfHearts),
            PLAYING_CARD_SIX_OF_HEARTS => Ok(PlayingCards::PlayingCardSixOfHearts),
            PLAYING_CARD_SEVEN_OF_HEARTS => Ok(PlayingCards::PlayingCardSevenOfHearts),
            PLAYING_CARD_EIGHT_OF_HEARTS => Ok(PlayingCards::PlayingCardEightOfHearts),
            PLAYING_CARD_NINE_OF_HEARTS => Ok(PlayingCards::PlayingCardNineOfHearts),
            PLAYING_CARD_TEN_OF_HEARTS => Ok(PlayingCards::PlayingCardTenOfHearts),
            PLAYING_CARD_JACK_OF_HEARTS => Ok(PlayingCards::PlayingCardJackOfHearts),
            PLAYING_CARD_KNIGHT_OF_HEARTS => Ok(PlayingCards::PlayingCardKnightOfHearts),
            PLAYING_CARD_QUEEN_OF_HEARTS => Ok(PlayingCards::PlayingCardQueenOfHearts),
            PLAYING_CARD_KING_OF_HEARTS => Ok(PlayingCards::PlayingCardKingOfHearts),
            PLAYING_CARD_RED_JOKER => Ok(PlayingCards::PlayingCardRedJoker),
            PLAYING_CARD_ACE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardAceOfDiamonds),
            PLAYING_CARD_TWO_OF_DIAMONDS => Ok(PlayingCards::PlayingCardTwoOfDiamonds),
            PLAYING_CARD_THREE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardThreeOfDiamonds),
            PLAYING_CARD_FOUR_OF_DIAMONDS => Ok(PlayingCards::PlayingCardFourOfDiamonds),
            PLAYING_CARD_FIVE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardFiveOfDiamonds),
            PLAYING_CARD_SIX_OF_DIAMONDS => Ok(PlayingCards::PlayingCardSixOfDiamonds),
            PLAYING_CARD_SEVEN_OF_DIAMONDS => Ok(PlayingCards::PlayingCardSevenOfDiamonds),
            PLAYING_CARD_EIGHT_OF_DIAMONDS => Ok(PlayingCards::PlayingCardEightOfDiamonds),
            PLAYING_CARD_NINE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardNineOfDiamonds),
            PLAYING_CARD_TEN_OF_DIAMONDS => Ok(PlayingCards::PlayingCardTenOfDiamonds),
            PLAYING_CARD_JACK_OF_DIAMONDS => Ok(PlayingCards::PlayingCardJackOfDiamonds),
            PLAYING_CARD_KNIGHT_OF_DIAMONDS => Ok(PlayingCards::PlayingCardKnightOfDiamonds),
            PLAYING_CARD_QUEEN_OF_DIAMONDS => Ok(PlayingCards::PlayingCardQueenOfDiamonds),
            PLAYING_CARD_KING_OF_DIAMONDS => Ok(PlayingCards::PlayingCardKingOfDiamonds),
            PLAYING_CARD_BLACK_JOKER => Ok(PlayingCards::PlayingCardBlackJoker),
            PLAYING_CARD_ACE_OF_CLUBS => Ok(PlayingCards::PlayingCardAceOfClubs),
            PLAYING_CARD_TWO_OF_CLUBS => Ok(PlayingCards::PlayingCardTwoOfClubs),
            PLAYING_CARD_THREE_OF_CLUBS => Ok(PlayingCards::PlayingCardThreeOfClubs),
            PLAYING_CARD_FOUR_OF_CLUBS => Ok(PlayingCards::PlayingCardFourOfClubs),
            PLAYING_CARD_FIVE_OF_CLUBS => Ok(PlayingCards::PlayingCardFiveOfClubs),
            PLAYING_CARD_SIX_OF_CLUBS => Ok(PlayingCards::PlayingCardSixOfClubs),
            PLAYING_CARD_SEVEN_OF_CLUBS => Ok(PlayingCards::PlayingCardSevenOfClubs),
            PLAYING_CARD_EIGHT_OF_CLUBS => Ok(PlayingCards::PlayingCardEightOfClubs),
            PLAYING_CARD_NINE_OF_CLUBS => Ok(PlayingCards::PlayingCardNineOfClubs),
            PLAYING_CARD_TEN_OF_CLUBS => Ok(PlayingCards::PlayingCardTenOfClubs),
            PLAYING_CARD_JACK_OF_CLUBS => Ok(PlayingCards::PlayingCardJackOfClubs),
            PLAYING_CARD_KNIGHT_OF_CLUBS => Ok(PlayingCards::PlayingCardKnightOfClubs),
            PLAYING_CARD_QUEEN_OF_CLUBS => Ok(PlayingCards::PlayingCardQueenOfClubs),
            PLAYING_CARD_KING_OF_CLUBS => Ok(PlayingCards::PlayingCardKingOfClubs),
            PLAYING_CARD_WHITE_JOKER => Ok(PlayingCards::PlayingCardWhiteJoker),
            PLAYING_CARD_FOOL => Ok(PlayingCards::PlayingCardFool),
            PLAYING_CARD_TRUMP_DASH_1 => Ok(PlayingCards::PlayingCardTrumpDash1),
            PLAYING_CARD_TRUMP_DASH_2 => Ok(PlayingCards::PlayingCardTrumpDash2),
            PLAYING_CARD_TRUMP_DASH_3 => Ok(PlayingCards::PlayingCardTrumpDash3),
            PLAYING_CARD_TRUMP_DASH_4 => Ok(PlayingCards::PlayingCardTrumpDash4),
            PLAYING_CARD_TRUMP_DASH_5 => Ok(PlayingCards::PlayingCardTrumpDash5),
            PLAYING_CARD_TRUMP_DASH_6 => Ok(PlayingCards::PlayingCardTrumpDash6),
            PLAYING_CARD_TRUMP_DASH_7 => Ok(PlayingCards::PlayingCardTrumpDash7),
            PLAYING_CARD_TRUMP_DASH_8 => Ok(PlayingCards::PlayingCardTrumpDash8),
            PLAYING_CARD_TRUMP_DASH_9 => Ok(PlayingCards::PlayingCardTrumpDash9),
            PLAYING_CARD_TRUMP_DASH_10 => Ok(PlayingCards::PlayingCardTrumpDash10),
            PLAYING_CARD_TRUMP_DASH_11 => Ok(PlayingCards::PlayingCardTrumpDash11),
            PLAYING_CARD_TRUMP_DASH_12 => Ok(PlayingCards::PlayingCardTrumpDash12),
            PLAYING_CARD_TRUMP_DASH_13 => Ok(PlayingCards::PlayingCardTrumpDash13),
            PLAYING_CARD_TRUMP_DASH_14 => Ok(PlayingCards::PlayingCardTrumpDash14),
            PLAYING_CARD_TRUMP_DASH_15 => Ok(PlayingCards::PlayingCardTrumpDash15),
            PLAYING_CARD_TRUMP_DASH_16 => Ok(PlayingCards::PlayingCardTrumpDash16),
            PLAYING_CARD_TRUMP_DASH_17 => Ok(PlayingCards::PlayingCardTrumpDash17),
            PLAYING_CARD_TRUMP_DASH_18 => Ok(PlayingCards::PlayingCardTrumpDash18),
            PLAYING_CARD_TRUMP_DASH_19 => Ok(PlayingCards::PlayingCardTrumpDash19),
            PLAYING_CARD_TRUMP_DASH_20 => Ok(PlayingCards::PlayingCardTrumpDash20),
            PLAYING_CARD_TRUMP_DASH_21 => Ok(PlayingCards::PlayingCardTrumpDash21),
            _ => Err(()),
        }
    }
}

impl Into<u32> for PlayingCards {
    fn into(self) -> u32 {
        let c: char = self.into();
        let hex = c
            .escape_unicode()
            .to_string()
            .replace("\\u{", "")
            .replace("}", "");
        u32::from_str_radix(&hex, 16).unwrap()
    }
}

impl std::convert::TryFrom<u32> for PlayingCards {
    type Error = ();
    fn try_from(u: u32) -> Result<Self, Self::Error> {
        if let Ok(c) = char::try_from(u) {
            Self::try_from(c)
        } else {
            Err(())
        }
    }
}

impl Iterator for PlayingCards {
    type Item = Self;
    fn next(&mut self) -> Option<Self> {
        let index: u32 = (*self).into();
        use std::convert::TryFrom;
        Self::try_from(index + 1).ok()
    }
}

impl PlayingCards {
    /// The character with the lowest index in this unicode block
    pub fn new() -> Self {
        PlayingCards::PlayingCardBack
    }

    /// The character's name, all lowercase and space-separated
    pub fn name(&self) -> &str {
        match self {
            PlayingCards::PlayingCardBack => "playing card back",
            PlayingCards::PlayingCardAceOfSpades => "playing card ace of spades",
            PlayingCards::PlayingCardTwoOfSpades => "playing card two of spades",
            PlayingCards::PlayingCardThreeOfSpades => "playing card three of spades",
            PlayingCards::PlayingCardFourOfSpades => "playing card four of spades",
            PlayingCards::PlayingCardFiveOfSpades => "playing card five of spades",
            PlayingCards::PlayingCardSixOfSpades => "playing card six of spades",
            PlayingCards::PlayingCardSevenOfSpades => "playing card seven of spades",
            PlayingCards::PlayingCardEightOfSpades => "playing card eight of spades",
            PlayingCards::PlayingCardNineOfSpades => "playing card nine of spades",
            PlayingCards::PlayingCardTenOfSpades => "playing card ten of spades",
            PlayingCards::PlayingCardJackOfSpades => "playing card jack of spades",
            PlayingCards::PlayingCardKnightOfSpades => "playing card knight of spades",
            PlayingCards::PlayingCardQueenOfSpades => "playing card queen of spades",
            PlayingCards::PlayingCardKingOfSpades => "playing card king of spades",
            PlayingCards::PlayingCardAceOfHearts => "playing card ace of hearts",
            PlayingCards::PlayingCardTwoOfHearts => "playing card two of hearts",
            PlayingCards::PlayingCardThreeOfHearts => "playing card three of hearts",
            PlayingCards::PlayingCardFourOfHearts => "playing card four of hearts",
            PlayingCards::PlayingCardFiveOfHearts => "playing card five of hearts",
            PlayingCards::PlayingCardSixOfHearts => "playing card six of hearts",
            PlayingCards::PlayingCardSevenOfHearts => "playing card seven of hearts",
            PlayingCards::PlayingCardEightOfHearts => "playing card eight of hearts",
            PlayingCards::PlayingCardNineOfHearts => "playing card nine of hearts",
            PlayingCards::PlayingCardTenOfHearts => "playing card ten of hearts",
            PlayingCards::PlayingCardJackOfHearts => "playing card jack of hearts",
            PlayingCards::PlayingCardKnightOfHearts => "playing card knight of hearts",
            PlayingCards::PlayingCardQueenOfHearts => "playing card queen of hearts",
            PlayingCards::PlayingCardKingOfHearts => "playing card king of hearts",
            PlayingCards::PlayingCardRedJoker => "playing card red joker",
            PlayingCards::PlayingCardAceOfDiamonds => "playing card ace of diamonds",
            PlayingCards::PlayingCardTwoOfDiamonds => "playing card two of diamonds",
            PlayingCards::PlayingCardThreeOfDiamonds => "playing card three of diamonds",
            PlayingCards::PlayingCardFourOfDiamonds => "playing card four of diamonds",
            PlayingCards::PlayingCardFiveOfDiamonds => "playing card five of diamonds",
            PlayingCards::PlayingCardSixOfDiamonds => "playing card six of diamonds",
            PlayingCards::PlayingCardSevenOfDiamonds => "playing card seven of diamonds",
            PlayingCards::PlayingCardEightOfDiamonds => "playing card eight of diamonds",
            PlayingCards::PlayingCardNineOfDiamonds => "playing card nine of diamonds",
            PlayingCards::PlayingCardTenOfDiamonds => "playing card ten of diamonds",
            PlayingCards::PlayingCardJackOfDiamonds => "playing card jack of diamonds",
            PlayingCards::PlayingCardKnightOfDiamonds => "playing card knight of diamonds",
            PlayingCards::PlayingCardQueenOfDiamonds => "playing card queen of diamonds",
            PlayingCards::PlayingCardKingOfDiamonds => "playing card king of diamonds",
            PlayingCards::PlayingCardBlackJoker => "playing card black joker",
            PlayingCards::PlayingCardAceOfClubs => "playing card ace of clubs",
            PlayingCards::PlayingCardTwoOfClubs => "playing card two of clubs",
            PlayingCards::PlayingCardThreeOfClubs => "playing card three of clubs",
            PlayingCards::PlayingCardFourOfClubs => "playing card four of clubs",
            PlayingCards::PlayingCardFiveOfClubs => "playing card five of clubs",
            PlayingCards::PlayingCardSixOfClubs => "playing card six of clubs",
            PlayingCards::PlayingCardSevenOfClubs => "playing card seven of clubs",
            PlayingCards::PlayingCardEightOfClubs => "playing card eight of clubs",
            PlayingCards::PlayingCardNineOfClubs => "playing card nine of clubs",
            PlayingCards::PlayingCardTenOfClubs => "playing card ten of clubs",
            PlayingCards::PlayingCardJackOfClubs => "playing card jack of clubs",
            PlayingCards::PlayingCardKnightOfClubs => "playing card knight of clubs",
            PlayingCards::PlayingCardQueenOfClubs => "playing card queen of clubs",
            PlayingCards::PlayingCardKingOfClubs => "playing card king of clubs",
            PlayingCards::PlayingCardWhiteJoker => "playing card white joker",
            PlayingCards::PlayingCardFool => "playing card fool",
            PlayingCards::PlayingCardTrumpDash1 => "playing card trump-1",
            PlayingCards::PlayingCardTrumpDash2 => "playing card trump-2",
            PlayingCards::PlayingCardTrumpDash3 => "playing card trump-3",
            PlayingCards::PlayingCardTrumpDash4 => "playing card trump-4",
            PlayingCards::PlayingCardTrumpDash5 => "playing card trump-5",
            PlayingCards::PlayingCardTrumpDash6 => "playing card trump-6",
            PlayingCards::PlayingCardTrumpDash7 => "playing card trump-7",
            PlayingCards::PlayingCardTrumpDash8 => "playing card trump-8",
            PlayingCards::PlayingCardTrumpDash9 => "playing card trump-9",
            PlayingCards::PlayingCardTrumpDash10 => "playing card trump-10",
            PlayingCards::PlayingCardTrumpDash11 => "playing card trump-11",
            PlayingCards::PlayingCardTrumpDash12 => "playing card trump-12",
            PlayingCards::PlayingCardTrumpDash13 => "playing card trump-13",
            PlayingCards::PlayingCardTrumpDash14 => "playing card trump-14",
            PlayingCards::PlayingCardTrumpDash15 => "playing card trump-15",
            PlayingCards::PlayingCardTrumpDash16 => "playing card trump-16",
            PlayingCards::PlayingCardTrumpDash17 => "playing card trump-17",
            PlayingCards::PlayingCardTrumpDash18 => "playing card trump-18",
            PlayingCards::PlayingCardTrumpDash19 => "playing card trump-19",
            PlayingCards::PlayingCardTrumpDash20 => "playing card trump-20",
            PlayingCards::PlayingCardTrumpDash21 => "playing card trump-21",
        }
    }
}