%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Name : Kavinda Weerakoon
% The Hockey Card Game Culminating Assignment
% Course: ICS2O1
% Date: January 14th, 2014
% Description: This program replicates the card game "Hockey", primarily popular in Canada. This is a player vs. computer competition.
% This game is played mainly in Canada, and seems to have originated there in the 1960's or earlier.
% It is normally thought of as a simulation of Hockey as a card game for two players, one representing each team.
% In Hockey, points are scored by matching the card played by your opponent to create a "breakaway" and then also matching the opponent's following play to score.
% These points are known as "goals" and the object is of course to score more goals than your opponent.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Program Variables
var x, y, button : int
var r : int := 0
var deck := "AAAA22223333444455556666777788889999TTTTJJJJQQQQKKKK"
var save : string
var messageTextNumber : int
var messageIdentifier : int
var font1 : int
font1 := Font.New ("couriernew:12")
% setscreen
setscreen ("graphics: max, max")
% Introduction
locate (1, 1)
put "Welcome to the Hockey Card Game!"
delay (3000)
locate (2, 1)
put "How to play: The players pick up the cards they are dealt, look at them, and play in turn. The first card is played by the non-dealer."
locate (3, 1)
put "A turn consists of playing one card from your hand face up to the centre of the table. "
locate (4, 1)
put "The cards played by both players are stacked in a single pile so that only the most recently played card is visible."
locate (5, 1)
put "If a card is played which matches the rank of the top card of the pile"
locate (6, 1)
put "(for example an 8 is played on an 8), this creates a breakaway for the person who played the matching card. "
locate (7, 1)
put "Also, any time that a Jack is played, this creates a breakaway for the player of the Jack. "
locate (8, 1)
put "If a player who creates a breakaway then matches the next card played by the opponent, the player scores a goal."
locate (9, 1)
put "A goal itself is not a breakaway. After a goal a new breakaway is needed before a new goal can be scored. "
locate (10, 1)
put "However, a breakaway can be created by matching the card used to score a goal. "
locate (11, 1)
delay (3000)
put "Ready to play?"
locate (12, 1)
delay (2000)
put "Press any button to continue..."
loop
exit when hasch
end loop
cls
put "Starting in 3..."
delay (1000)
cls
put "Starting in 2..."
delay (1000)
cls
put "Starting in 1..."
delay (1000)
cls
put "Starting in 0..."
delay (1000)
cls
% Main code
% Logic
% Shuffling
for i : 1 .. 10000
randint (r, 1, 20)
save := deck (1 .. r)
deck := deck (r + 1 .. *)
deck := deck (r + 1 .. *) + deck (1 .. r) + save
end for
cls
put deck
% Graphics
% Layout
% Cards
% Player
% Player Card #1
Draw.Box (5, 25, 105, 175, black)
% Player Card #2
Draw.Box (125, 25, 225, 175, black)
% Player Card #3
Draw.Box (245, 25, 345, 175, black)
% Player Card #4
Draw.Box (365, 25, 465, 175, black)
% Player Card #5
Draw.Box (485, 25, 585, 175, black)
% Opponent
% Opponent Card #1
Draw.Box (5, 905, 105, 755, black)
Draw.Line (5, 905, 105, 755, black)
Draw.Line (5, 755, 105, 905, black)
% Opponent Card #2
Draw.Box (125, 905, 225, 755, black)
Draw.Line (125, 905, 225, 755, black)
Draw.Line (125, 755, 225, 905, black)
% Opponent Card #3
Draw.Box (245, 905, 345, 755, black)
Draw.Line (245, 905, 345, 755, black)
Draw.Line (245, 755, 345, 905, black)
% Opponent Card #4
Draw.Box (365, 905, 465, 755, black)
Draw.Line (365, 905, 465, 755, black)
Draw.Line (365, 755, 465, 905, black)
% Opponent Card #5
Draw.Box (485, 905, 585, 755, black)
Draw.Line (485, 905, 585, 755, black)
Draw.Line (485, 755, 585, 905, black)
% Random Message
Draw.Box (1020, 920, 1260, 660, black)
loop
Font.Draw ("Tip: ", 1025, 895, font1, black)
% Point system
% mousewhere
loop
mousewhere (x, y, button)
locate ((maxrow - 1), (maxcol- 25))
if button = 0 then
put x : 4, " ", y : 4, " button up"
else
put x : 4, " ", y : 4, " button down"
end if
% random message text
loop
randint (messageTextNumber, 1, 5)
if messageTextNumber = 1 then
locate (2, 133)
delay (100)
put "Did you know?"
locate (3, 129)
put " "
elsif messageTextNumber = 2 then
locate (2, 133)
delay (100)
put " "
locate (3, 129)
put " "
elsif messageTextNumber = 3 then
locate (2, 133)
delay (100)
put "fhgf "
locate (3, 129)
put " "
elsif messageTextNumber = 4 then
locate (2, 133)
delay (100)
put "uioipiopiop "
locate (3, 129)
put " "
elsif messageTextNumber = 5 then
locate (2, 133)
delay (100)
put "v dfgfthtukhkffserf "
locate (3, 129)
put " "
end if
end loop
end loop
end loop
|