mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
Merge branch 'coding-horror:main' into main
This commit is contained in:
55
00_Utilities/yatol.pl
Executable file
55
00_Utilities/yatol.pl
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/perl
|
||||
#YATOL: Yet Another TOdo List
|
||||
use strict;
|
||||
|
||||
#REM: Get list of basic files ordered by number of lines.
|
||||
#REM: This way you can do the easier ones first.
|
||||
my @Ret=`find .. -iname '*.bas' -exec wc -l \{\} \\; | sort -h`;
|
||||
|
||||
|
||||
my @Langs= qw(PL JS VB PAS RB C# JAVA PY);
|
||||
my @Dirs= qw(perl javascript vbnet pascal ruby csharp java python);
|
||||
my %Sum;
|
||||
|
||||
print " "x 25 ."BAS\t";
|
||||
foreach my $Dir (@Langs) {
|
||||
print "$Dir\t";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
my $Count;
|
||||
foreach my $Lin (@Ret) {
|
||||
$Count++;
|
||||
chomp $Lin;
|
||||
my ($Num, $File)= split (" ", $Lin);
|
||||
my @Parts= split(/\//, $File);
|
||||
my $Base= $Parts[1];
|
||||
|
||||
my $Tab= 25-length($Base);
|
||||
print "$Base".(" "x$Tab)."$Num\t";
|
||||
|
||||
foreach my $Dir (@Dirs) {
|
||||
my $Path= "../$Base/$Dir/";
|
||||
my $Ret= `ls $Path | wc -l`;
|
||||
if ($Ret>1) { print "YES"; $Sum{$Dir}++; }
|
||||
else { print " ";}
|
||||
print "\t";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
}
|
||||
|
||||
print "\t\tFILES:\t\t";
|
||||
foreach my $Dir (@Dirs) {
|
||||
print "$Sum{$Dir}\t";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
print "\t\tADVANCE:\t";
|
||||
foreach my $Dir (@Dirs) {
|
||||
my $Per= int($Sum{$Dir}/$Count*100)."%";
|
||||
print "$Per\t";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
74
01_Acey_Ducey/kotlin/aceyducey.kt
Normal file
74
01_Acey_Ducey/kotlin/aceyducey.kt
Normal file
@@ -0,0 +1,74 @@
|
||||
import java.util.Random
|
||||
|
||||
fun printCard(a: Int) {
|
||||
if (a < 11) println(a)
|
||||
if (a == 11) println("JACK")
|
||||
if (a == 12) println("QUEEN")
|
||||
if (a == 13) println("KING")
|
||||
if (a == 14) println("ACE")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
println("ACEY DUCEY CARD GAME")
|
||||
println("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
|
||||
println()
|
||||
println()
|
||||
println("ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER ")
|
||||
println("THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP")
|
||||
println("YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING")
|
||||
println("ON WHETHER OR NOT YOU FEEL THE CARD WILL HAVE")
|
||||
println("A VALUE BETWEEN THE FIRST TWO.")
|
||||
println("IF YOU DO NOT WANT TO BET, INPUT A 0")
|
||||
var random = Random()
|
||||
do {
|
||||
var q = 100
|
||||
var a : Int
|
||||
var b : Int
|
||||
var m : Int
|
||||
println("YOU NOW HAVE " + q + " DOLLARS.")
|
||||
println()
|
||||
do {
|
||||
do {
|
||||
do {
|
||||
println("HERE ARE YOUR NEXT TWO CARDS: ")
|
||||
do {
|
||||
a = random.nextInt(12) + 2
|
||||
b = random.nextInt(12) + 2
|
||||
} while (a >= b);
|
||||
printCard(a)
|
||||
printCard(b)
|
||||
println()
|
||||
println()
|
||||
print("WHAT IS YOUR BET")
|
||||
m = readLine()!!.toInt()
|
||||
if (m == 0) {
|
||||
println("CHICKEN!!")
|
||||
println()
|
||||
}
|
||||
} while (m == 0);
|
||||
if (m > q) {
|
||||
println("SORRY, MY FRIEND, BUT YOU BET TOO MUCH.")
|
||||
println("YOU HAVE ONLY " + q + " DOLLARS TO BET.")
|
||||
}
|
||||
} while (m > q);
|
||||
var c = random.nextInt(12) + 2
|
||||
printCard(c)
|
||||
println()
|
||||
if (c > a && c < b) {
|
||||
println("YOU WIN!!!")
|
||||
q += m
|
||||
}
|
||||
else {
|
||||
println("SORRY, YOU LOSE")
|
||||
if (m < q) q -= m
|
||||
}
|
||||
} while (m < q);
|
||||
println()
|
||||
println()
|
||||
println("SORRY, FRIEND, BUT YOU BLEW YOUR WAD.")
|
||||
println()
|
||||
println()
|
||||
println("TRY AGAIN (YES OR NO)")
|
||||
} while (readLine() == "YES");
|
||||
println("O.K., HOPE YOU HAD FUN!")
|
||||
}
|
||||
165
09_Battle/python/battle.py
Normal file
165
09_Battle/python/battle.py
Normal file
@@ -0,0 +1,165 @@
|
||||
#!/usr/bin/env python3
|
||||
from random import randrange
|
||||
from typing import List, Tuple
|
||||
|
||||
PointType = Tuple[int, int]
|
||||
VectorType = PointType
|
||||
SeaType = Tuple[List[int], ...]
|
||||
|
||||
SEA_WIDTH = 6
|
||||
DESTROYER_LENGTH = 2
|
||||
CRUISER_LENGTH = 3
|
||||
AIRCRAFT_CARRIER_LENGTH = 4
|
||||
|
||||
|
||||
def random_vector() -> Tuple[int, int]:
|
||||
while True:
|
||||
vector = (randrange(-1, 2), randrange(-1, 2))
|
||||
|
||||
if vector == (0, 0):
|
||||
# We can't have a zero vector, so try again
|
||||
continue
|
||||
|
||||
return vector
|
||||
|
||||
|
||||
def add_vector(point: PointType, vector: VectorType) -> PointType:
|
||||
return (point[0] + vector[0], point[1] + vector[1])
|
||||
|
||||
|
||||
def place_ship(sea: SeaType, size: int, code: int) -> None:
|
||||
while True:
|
||||
start = (randrange(1, SEA_WIDTH + 1), randrange(1, SEA_WIDTH + 1))
|
||||
vector = random_vector()
|
||||
|
||||
# Get potential ship points
|
||||
point = start
|
||||
points = []
|
||||
|
||||
for _ in range(size):
|
||||
point = add_vector(point, vector)
|
||||
points.append(point)
|
||||
|
||||
if not (all([is_within_sea(point, sea) for point in points]) and
|
||||
all([value_at(point, sea) == 0 for point in points])):
|
||||
# ship out of bounds or crosses other ship, trying again
|
||||
continue
|
||||
|
||||
# We found a valid spot, so actually place it now
|
||||
for point in points:
|
||||
set_value_at(code, point, sea)
|
||||
|
||||
break
|
||||
|
||||
|
||||
def print_encoded_sea(sea: SeaType) -> None:
|
||||
for x in range(len(sea)):
|
||||
print(' '.join([str(sea[y][x]) for y in range(len(sea) - 1, -1, -1)]))
|
||||
|
||||
|
||||
def is_within_sea(point: PointType, sea: SeaType) -> bool:
|
||||
return (1 <= point[0] <= len(sea)) and (1 <= point[1] <= len(sea))
|
||||
|
||||
|
||||
def has_ship(sea: SeaType, code: int) -> bool:
|
||||
return any(code in row for row in sea)
|
||||
|
||||
|
||||
def count_sunk(sea: SeaType, codes: Tuple[int, ...]) -> int:
|
||||
return sum(not has_ship(sea, code) for code in codes)
|
||||
|
||||
|
||||
def value_at(point: PointType, sea: SeaType) -> int:
|
||||
return sea[point[1] - 1][point[0] -1]
|
||||
|
||||
|
||||
def set_value_at(value: int, point: PointType, sea: SeaType) -> None:
|
||||
sea[point[1] - 1][point[0] -1] = value
|
||||
|
||||
|
||||
def get_next_target(sea: SeaType) -> PointType:
|
||||
while True:
|
||||
try:
|
||||
guess = input('? ')
|
||||
point = guess.split(',')
|
||||
|
||||
if len(point) != 2:
|
||||
raise ValueError()
|
||||
|
||||
point = (int(point[0]), int(point[1]))
|
||||
|
||||
if not is_within_sea(point, sea):
|
||||
raise ValueError()
|
||||
|
||||
return point
|
||||
except ValueError:
|
||||
print(f'INVALID. SPECIFY TWO NUMBERS FROM 1 TO {len(sea)}, SEPARATED BY A COMMA.')
|
||||
|
||||
|
||||
def setup_ships(sea: SeaType):
|
||||
place_ship(sea, DESTROYER_LENGTH, 1)
|
||||
place_ship(sea, DESTROYER_LENGTH, 2)
|
||||
place_ship(sea, CRUISER_LENGTH, 3)
|
||||
place_ship(sea, CRUISER_LENGTH, 4)
|
||||
place_ship(sea, AIRCRAFT_CARRIER_LENGTH, 5)
|
||||
place_ship(sea, AIRCRAFT_CARRIER_LENGTH, 6)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print(' BATTLE')
|
||||
print('CREATIVE COMPUTING MORRISTOWN, NEW JERSEY')
|
||||
print()
|
||||
sea = tuple(([0 for _ in range(SEA_WIDTH)] for _ in range(SEA_WIDTH)))
|
||||
setup_ships(sea)
|
||||
print('THE FOLLOWING CODE OF THE BAD GUYS\' FLEET DISPOSITION')
|
||||
print('HAS BEEN CAPTURED BUT NOT DECODED:')
|
||||
print()
|
||||
print_encoded_sea(sea)
|
||||
print()
|
||||
print('DE-CODE IT AND USE IT IF YOU CAN')
|
||||
print('BUT KEEP THE DE-CODING METHOD A SECRET.')
|
||||
print()
|
||||
print('START GAME')
|
||||
splashes = 0
|
||||
hits = 0
|
||||
|
||||
while True:
|
||||
target = get_next_target(sea)
|
||||
target_value = value_at(target, sea)
|
||||
|
||||
if target_value < 0:
|
||||
print(f'YOU ALREADY PUT A HOLE IN SHIP NUMBER {abs(target_value)} AT THAT POINT.')
|
||||
|
||||
if target_value <= 0:
|
||||
print('SPLASH! TRY AGAIN.')
|
||||
splashes += 1
|
||||
continue
|
||||
|
||||
print(f'A DIRECT HIT ON SHIP NUMBER {target_value}')
|
||||
hits += 1
|
||||
set_value_at(-target_value, target, sea)
|
||||
|
||||
if not has_ship(sea, target_value):
|
||||
print('AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.')
|
||||
print('SO FAR, THE BAD GUYS HAVE LOST')
|
||||
print(f'{count_sunk(sea, (1, 2))} DESTROYER(S),',
|
||||
f'{count_sunk(sea, (3, 4))} CRUISER(S),',
|
||||
f'AND {count_sunk(sea, (5, 6))} AIRCRAFT CARRIER(S).')
|
||||
|
||||
if any(has_ship(sea, code) for code in range(1, SEA_WIDTH + 1)):
|
||||
print(f'YOUR CURRENT SPLASH/HIT RATIO IS {splashes}/{hits}')
|
||||
continue
|
||||
|
||||
print('YOU HAVE TOTALLY WIPED OUT THE BAD GUYS\' FLEET '
|
||||
f'WITH A FINAL SPLASH/HIT RATIO OF {splashes}/{hits}')
|
||||
|
||||
if not splashes:
|
||||
print('CONGRATULATIONS -- A DIRECT HIT EVERY TIME.')
|
||||
|
||||
print()
|
||||
print('****************************')
|
||||
break
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
95
55_Life/perl/life.pl
Normal file
95
55_Life/perl/life.pl
Normal file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/perl
|
||||
#use strict;
|
||||
|
||||
print ' 'x 34 . "LIFE\n";
|
||||
print ' 'x 15 . "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n";
|
||||
print "\n"; print "\n"; print "\n";
|
||||
print "ENTER YOUR PATTERN; \n";
|
||||
$X1=1; $Y1=1; $X2=24; $Y2=70;
|
||||
@A;
|
||||
$C=1;
|
||||
|
||||
@B;
|
||||
Line30:
|
||||
print "? "; chomp($B[$C] = uc(<STDIN>));
|
||||
if ($B[$C] eq "DONE") { $B[$C]=""; goto Line80; }
|
||||
$B[$C]=~ s/\./ /g;
|
||||
$C=$C+1;
|
||||
goto Line30;
|
||||
|
||||
|
||||
Line80:
|
||||
|
||||
$C=$C-1; $L=0; $G=0;
|
||||
for ($X=1; $X<=$C-1; $X++) {
|
||||
if (length($B[$X])>$L) { $L=length($B[$X]); }
|
||||
}
|
||||
|
||||
$X1=11-$C/2;
|
||||
$Y1=33-$L/2;
|
||||
for ($X=1; $X<=$C; $X++) {
|
||||
for ($Y=1; $Y<=length($B[$X]); $Y++) {
|
||||
if (substr($B[$X],$Y-1,1) ne " ") { $A[$X1+$X][$Y1+$Y]=1; $P=$P+1; }
|
||||
}
|
||||
}
|
||||
print "\n"; print "\n"; print "\n";
|
||||
|
||||
Line210:
|
||||
print "GENERATION: ".$G."\t\tPOPULATION: ".$P; if ($I9) { print "\tINVALID!"; }
|
||||
print "\n";
|
||||
$X3=24; $Y3=70; $X4=1; $Y4=1; $P=0;
|
||||
$G=$G+1;
|
||||
for ($X=1; $X<=$X1-1; $X++) { print "\n"; }
|
||||
for ($X=$X1; $X<=$X2; $X++) {
|
||||
$Row= " "x 80;
|
||||
for ($Y=$Y1; $Y<=$Y2; $Y++) {
|
||||
if ($A[$X][$Y]==2) { $A[$X][$Y]=0; goto Line270; }
|
||||
if ($A[$X][$Y]==3) { $A[$X][$Y]=1; goto Line261; }
|
||||
if ($A[$X][$Y]!=1) { goto Line270; }
|
||||
|
||||
Line261:
|
||||
substr($Row, $Y, 1, "*");
|
||||
if ($X<$X3) { $X3=$X; }
|
||||
if ($X>$X4) { $X4=$X; }
|
||||
if ($Y<$Y3) { $Y3=$Y; }
|
||||
if ($Y>$Y4) { $Y4=$Y; }
|
||||
|
||||
Line270:
|
||||
}
|
||||
print "$Row\n";
|
||||
}
|
||||
|
||||
for ($X=$X2+1; $X<=24; $X++) { print "\n"; }
|
||||
$X1=$X3; $X2=$X4; $Y1=$Y3; $Y2=$Y4;
|
||||
if ($X1<3) { $X1=3; $I9=-1; }
|
||||
if ($X2>22) { $X2=22; $I9=-1; }
|
||||
if ($Y1<3) { $Y1=3; $I9=-1; }
|
||||
if ($Y2>68) { $Y2=68; $I9=-1; }
|
||||
$P=0;
|
||||
|
||||
for ($X=$X1-1; $X<=$X2+1; $X++) {
|
||||
for ($Y=$Y1-1; $Y<=$Y2+1; $Y++) {
|
||||
$C=0;
|
||||
for ($I=$X-1; $I<=$X+1; $I++) {
|
||||
for ($J=$Y-1; $J<=$Y+1; $J++) {
|
||||
if ($A[$I][$J]==1 || $A[$I][$J]==2) { $C=$C+1; }
|
||||
}
|
||||
}
|
||||
if ($A[$X][$Y]==0) { goto Line610; }
|
||||
if ($C<3 || $C>4) { $A[$X][$Y]=2; goto Line600; }
|
||||
$P=$P+1;
|
||||
|
||||
Line600:
|
||||
goto Line620;
|
||||
|
||||
Line610:
|
||||
if ($C==3) { $A[$X][$Y]=3; $P=$P+1; }
|
||||
|
||||
Line620:
|
||||
}
|
||||
}
|
||||
$X1=$X1-1; $Y1=$Y1-1; $X2=$X2+1; $Y2=$Y2+1;
|
||||
goto Line210;
|
||||
exit;
|
||||
|
||||
|
||||
@@ -6,6 +6,15 @@ Each move is indicated by a 3-digit number (digits not separated by commas), wit
|
||||
|
||||
This version of 3-D TIC-TAC-TOE is from Dartmouth College.
|
||||
|
||||
### Conversion notes
|
||||
|
||||
The AI code for TicTacToe2 depends quite heavily on the non-structured GOTO (I can almost hear Dijkstra now) and translation is quite challenging. This code relies very heavily on GOTOs that bind the code tightly together. Comments explain where that happens in the original.
|
||||
|
||||
There are at least two bugs from the original BASIC:
|
||||
|
||||
1. Code should only allow player to input valid 3D coordinates where every digit is between 1 and 4, but the original code allows any value between 111 and 444 (such as 297, for instance).
|
||||
2. If the player moves first and the game ends in a draw, the original program will still prompt the player for a move instead of calling for a draw.
|
||||
|
||||
---
|
||||
|
||||
As published in Basic Computer Games (1978):
|
||||
|
||||
10
88_3-D_Tic-Tac-Toe/csharp/Program.cs
Normal file
10
88_3-D_Tic-Tac-Toe/csharp/Program.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace ThreeDTicTacToe
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
new Qubic().Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
1192
88_3-D_Tic-Tac-Toe/csharp/Qubic.cs
Normal file
1192
88_3-D_Tic-Tac-Toe/csharp/Qubic.cs
Normal file
File diff suppressed because it is too large
Load Diff
559
88_3-D_Tic-Tac-Toe/csharp/QubicData.cs
Normal file
559
88_3-D_Tic-Tac-Toe/csharp/QubicData.cs
Normal file
@@ -0,0 +1,559 @@
|
||||
namespace ThreeDTicTacToe
|
||||
{
|
||||
/// <summary>
|
||||
/// Data in this class was originally given by the following DATA section in
|
||||
/// the BASIC program:
|
||||
///
|
||||
/// 2030 DATA 1,49,52,4,13,61,64,16,22,39,23,38,26,42,27,43
|
||||
/// 2040 DATA 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
|
||||
/// 2050 DATA 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38
|
||||
/// 2060 DATA 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56
|
||||
/// 2070 DATA 57,58,59,60,61,62,63,64
|
||||
/// 2080 DATA 1,17,33,49,5,21,37,53,9,25,41,57,13,29,45,61
|
||||
/// 2090 DATA 2,18,34,50,6,22,38,54,10,26,42,58,14,30,46,62
|
||||
/// 2100 DATA 3,19,35,51,7,23,39,55,11,27,43,59,15,31,47,63
|
||||
/// 2110 DATA 4,20,36,52,8,24,40,56,12,28,44,60,16,32,48,64
|
||||
/// 2120 DATA 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
|
||||
/// 2130 DATA 2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62
|
||||
/// 2140 DATA 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63
|
||||
/// 2150 DATA 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64
|
||||
/// 2160 DATA 1,6,11,16,17,22,27,32,33,38,43,48,49,54,59,64
|
||||
/// 2170 DATA 13,10,7,4,29,26,23,20,45,42,39,36,61,58,55,52
|
||||
/// 2180 DATA 1,21,41,61,2,22,42,62,3,23,43,63,4,24,44,64
|
||||
/// 2190 DATA 49,37,25,13,50,38,26,14,51,39,27,15,52,40,28,16
|
||||
/// 2200 DATA 1,18,35,52,5,22,39,56,9,26,43,60,13,30,47,64
|
||||
/// 2210 DATA 49,34,19,4,53,38,23,8,57,42,27,12,61,46,31,16
|
||||
/// 2220 DATA 1,22,43,64,16,27,38,49,4,23,42,61,13,26,39,52
|
||||
///
|
||||
/// In short, each number is an index into the board. The data in this class
|
||||
/// is zero-indexed, as opposed to the original data which was one-indexed.
|
||||
/// </summary>
|
||||
internal static class QubicData
|
||||
{
|
||||
/// <summary>
|
||||
/// The corners and centers of the Qubic board. They correspond to the
|
||||
/// following coordinates:
|
||||
///
|
||||
/// [
|
||||
/// 111, 411, 414, 114, 141, 441, 444, 144,
|
||||
/// 222, 323, 223, 322, 232, 332, 233, 333
|
||||
/// ]
|
||||
/// </summary>
|
||||
public static readonly int[] CornersAndCenters = new int[16]
|
||||
{
|
||||
// (X) ( ) ( ) (X)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (X) ( ) ( ) (X)
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) (X) (X) ( )
|
||||
// ( ) (X) (X) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) (X) (X) ( )
|
||||
// ( ) (X) (X) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// (X) ( ) ( ) (X)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (X) ( ) ( ) (X)
|
||||
|
||||
0,48,51,3,12,60,63,15,21,38,22,37,25,41,26,42
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A list of all "winning" rows in the Qubic board; that is, sets of
|
||||
/// four spaces that, if filled entirely by the player (or machine),
|
||||
/// would result in a win.
|
||||
///
|
||||
/// Each group of four rows in the list corresponds to a plane in the
|
||||
/// cube, and each plane is organized so that the first and last rows
|
||||
/// are on the plane's edges, while the second and third rows are in
|
||||
/// the middle of the plane. The only exception is the last group of
|
||||
/// rows, which contains the corners and centers rather than a plane.
|
||||
///
|
||||
/// The order of the rows in this list is key to how the Qubic AI
|
||||
/// decides its next move.
|
||||
/// </summary>
|
||||
public static readonly int[,] RowsByPlane = new int[76, 4]
|
||||
{
|
||||
// (1) (1) (1) (1)
|
||||
// (2) (2) (2) (2)
|
||||
// (3) (3) (3) (3)
|
||||
// (4) (4) (4) (4)
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
{ 0, 1, 2, 3, },
|
||||
{ 4, 5, 6, 7, },
|
||||
{ 8, 9, 10,11, },
|
||||
{ 12,13,14,15, },
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// (1) (1) (1) (1)
|
||||
// (2) (2) (2) (2)
|
||||
// (3) (3) (3) (3)
|
||||
// (4) (4) (4) (4)
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
{ 16,17,18,19, },
|
||||
{ 20,21,22,23, },
|
||||
{ 24,25,26,27, },
|
||||
{ 28,29,30,31, },
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// (1) (1) (1) (1)
|
||||
// (2) (2) (2) (2)
|
||||
// (3) (3) (3) (3)
|
||||
// (4) (4) (4) (4)
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
{ 32,33,34,35, },
|
||||
{ 36,37,38,39, },
|
||||
{ 40,41,42,43, },
|
||||
{ 44,45,46,47, },
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// (1) (1) (1) (1)
|
||||
// (2) (2) (2) (2)
|
||||
// (3) (3) (3) (3)
|
||||
// (4) (4) (4) (4)
|
||||
|
||||
{ 48,49,50,51, },
|
||||
{ 52,53,54,55, },
|
||||
{ 56,57,58,59, },
|
||||
{ 60,61,62,63, },
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
{ 0, 16,32,48, },
|
||||
{ 4, 20,36,52, },
|
||||
{ 8, 24,40,56, },
|
||||
{ 12,28,44,60, },
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
{ 1, 17,33,49, },
|
||||
{ 5, 21,37,53, },
|
||||
{ 9, 25,41,57, },
|
||||
{ 13,29,45,61, },
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
{ 2, 18,34,50, },
|
||||
{ 6, 22,38,54, },
|
||||
{ 10,26,42,58, },
|
||||
{ 14,30,46,62, },
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
{ 3, 19,35,51, },
|
||||
{ 7, 23,39,55, },
|
||||
{ 11,27,43,59, },
|
||||
{ 15,31,47,63, },
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (1) ( ) ( ) ( )
|
||||
// (1) ( ) ( ) ( )
|
||||
// (1) ( ) ( ) ( )
|
||||
|
||||
// (2) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
|
||||
// (3) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
|
||||
// (4) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
{ 0, 4, 8, 12, },
|
||||
{ 16,20,24,28, },
|
||||
{ 32,36,40,44, },
|
||||
{ 48,52,56,60, },
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (1) ( ) ( )
|
||||
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
|
||||
// ( ) (4) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
{ 1, 5, 9, 13, },
|
||||
{ 17,21,25,29, },
|
||||
{ 33,37,41,45, },
|
||||
{ 49,53,57,61, },
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (1) ( )
|
||||
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
|
||||
// ( ) ( ) (4) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
{ 2, 6, 10,14, },
|
||||
{ 18,22,26,30, },
|
||||
{ 34,38,42,46, },
|
||||
{ 50,54,58,62, },
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (1)
|
||||
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (2)
|
||||
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (3)
|
||||
|
||||
// ( ) ( ) ( ) (4)
|
||||
// ( ) ( ) ( ) (4)
|
||||
// ( ) ( ) ( ) (4)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
{ 3, 7, 11,15, },
|
||||
{ 19,23,27,31, },
|
||||
{ 35,39,43,47, },
|
||||
{ 51,55,59,63, },
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) ( ) (1)
|
||||
|
||||
// (2) ( ) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) ( ) (2)
|
||||
|
||||
// (3) ( ) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) ( ) (3)
|
||||
|
||||
// (4) ( ) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
{ 0, 5, 10,15, },
|
||||
{ 16,21,26,31, },
|
||||
{ 32,37,42,47, },
|
||||
{ 48,53,58,63, },
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) (1) ( ) ( )
|
||||
// (1) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) (4)
|
||||
// ( ) ( ) (4) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
{ 12,9, 6, 3, },
|
||||
{ 28,25,22,19, },
|
||||
{ 44,41,38,35, },
|
||||
{ 60,57,54,51, },
|
||||
|
||||
// (1) (2) (3) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (1) (2) (3) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (1) (2) (3) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (1) (2) (3) (4)
|
||||
|
||||
{ 0, 20,40,60, },
|
||||
{ 1, 21,41,61, },
|
||||
{ 2, 22,42,62, },
|
||||
{ 3, 23,43,63, },
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (1) (2) (3) (4)
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (1) (2) (3) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (1) (2) (3) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// (1) (2) (3) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
{ 48,36,24,12, },
|
||||
{ 49,37,25,13, },
|
||||
{ 50,38,26,14, },
|
||||
{ 51,39,27,15, },
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
{ 0, 17,34,51, },
|
||||
{ 4, 21,38,55, },
|
||||
{ 8, 25,42,59, },
|
||||
{ 12,29,46,63, },
|
||||
|
||||
// ( ) ( ) ( ) (1)
|
||||
// ( ) ( ) ( ) (2)
|
||||
// ( ) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) (4)
|
||||
|
||||
// ( ) ( ) (1) ( )
|
||||
// ( ) ( ) (2) ( )
|
||||
// ( ) ( ) (3) ( )
|
||||
// ( ) ( ) (4) ( )
|
||||
|
||||
// ( ) (1) ( ) ( )
|
||||
// ( ) (2) ( ) ( )
|
||||
// ( ) (3) ( ) ( )
|
||||
// ( ) (4) ( ) ( )
|
||||
|
||||
// (1) ( ) ( ) ( )
|
||||
// (2) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) ( )
|
||||
|
||||
{ 48,33,18,3, },
|
||||
{ 52,37,22,7, },
|
||||
{ 56,41,26,11, },
|
||||
{ 60,45,30,15, },
|
||||
|
||||
// (1) ( ) ( ) (3)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (4) ( ) ( ) (2)
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) (1) (3) ( )
|
||||
// ( ) (4) (2) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) (2) (4) ( )
|
||||
// ( ) (3) (1) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
|
||||
// (2) ( ) ( ) (4)
|
||||
// ( ) ( ) ( ) ( )
|
||||
// ( ) ( ) ( ) ( )
|
||||
// (3) ( ) ( ) (1)
|
||||
|
||||
{ 0, 21,42,63, },
|
||||
{ 15,26,37,48, },
|
||||
{ 3, 22,41,60, },
|
||||
{ 12,25,38,51, },
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user