[Game]Scopa [V1.0]

scopa

Scopa_V1_Pokitto.bin.1

ScopaPopBannerv2

Scopa


Italy's favourite card game!

Graphics    @vampirics
Code          @filmote
Tester         Jessica

Source        Source Code
ZIP              Scopa.zip (1.3 MB)

Playing Instructions

Scopa is a favorite game of Italians. Scopa, in Italian, means broom. In the game of Scopa, you are awarded points in a variety of ways, but one of the best methods is to sweep the board. This is known as a Scopa !

A Scopa Deck has 4 suits. (Coins, Swords, Batons / Clubs, Cups) within each Italian suit there is the 1-7, Fante (an infantry man worth 8), Cavallo (calvary man worth 9) and the King (worth 10). These values are important for making Scopa tricks.

Game Play:

Players draw a card to see who plays first. Once decided, each player is dealt three cards and four cards are dealt, face-up onto the table.

When it is your turn, you have two options - either place a card on the table, or play a card to take a scopa trick. A trick is taken by matching a card in your hand to a card of the same value on the table, or if that is not possible, by matching a card in your hand to the sum of the values of two or more cards on the table. In both cases, both the card from your hand and the captured card(s) are removed from play.

These cards are now out of play until scores are calculated at the end of the round.

Example: The player’s hand contains the 2 of coins, 5 of swords, and 7 of clubs (or batons). On the table are the ace of coins, 5 of cups, and 6 of swords. The player’s options are:

  • place the 2 of coins on the table
  • take the 5 of cups fromthe table using the 5 of swords from their hand
  • take the 6 of swords and ace of coins from the table using the 7 of clubs from their hand

As you will see in the scoring section below, you are rewarded for capturing the coin cards, the sevens and the prized seven of coins (or Sette Bello). You are also rewarded a point for clearing all cards from the table - this is known as a Scopa.

Play alternates until both players have used all of their cards. Three more cards are dealt to each player and play continues. No additional cards are dealt to the table.

After the dealer has played the final card of the final hand of the round, the player who most recently took a trick is awarded any remaining cards on the table. After the last card of the round has been played, points are calculated for each. If no one has won the game, the players swap positions and a new set of cards are dealt and play continues as described above.

Additional Rules

Single Card Trick Rule: In any circumstance in which a played card may capture either a single or multiple cards, the player is forced to capture only the single card. If the table has contains a 1, 3, 4, and 8 (Fante), and the player plays a Fante of a different suit, the player is not allowed to capture the 1, 3, and 4, even though their total does add up to 8. Instead, the player is only allowed to capture the fante.

You cannot simply discard a card that has the ability to take a trick. If, for example, a 2 and 4 are on the table, and a player holds a 6, the player must either take that trick, or play a different card from his hand.

Scoring

Points are awarded at the completion of each deal. Players get one point for each “Scopa”.

In addition, there are up to four points available for the following, each worth 1 point apiece:

  • captured the greatest number of cards (in the case of a tie, no one receives a point)
  • captured the greatest number of cards in the suit of coins (in the case of a tie, no one receives a point)
  • captured the seven of coins (the “sette bello”)
  • obtained the highest “Premiera” hand.

Scopa - Determining the Premiera

The “prime” for each player is determined by selecting the player’s “best” card in each of the four suits, and totaling those four cards’ point values. When calculating the prime, a separate point scale is used. The player with the highest number of points using this separate point scale gets one point toward the game score.

Our game uses the most common version of the premiera scale is where Seven = 21 points, Six (sei) = 18 points, Ace = 16 points, Five = 15 points, Four = 14 points, Three = 13 points, Two = 12 points, King = 10 points. For example, if one player captures the sevens of cups and coins, the six of clubs and the ace of swords, that player’s prime is (21 + 21 + 18 + 16) = 76.

Winning the Game

The game is played until one player has at least 11 points and has a greater total than any other player. It is important to note that no points, including scopa points, are awarded mid-round; they are all calculated upon completion of the round. For that reason, if the current score is 10 to 9, and the team with 10 points captures the seven of coins or a scopa, the team cannot immediately claim victory. It is still possible that the opposing team could end up with a tied or higher score once all points are calculated.

Enjoy Playing Scopa!



Installation Instructions

This game consists of a POP file and supporting sound assets packaged in a .zip file. Please expand the contents into a directory on you computer - you will see a POP file and a sub-directory called music. Please ensure both the .POP file and folder are copied to the root directory of your SD card.

Depending on what other games are installed on your Pokitto, you may already have a sub-directory called /music on your machine. If prompted, simply merge the contents of the Scopa directory with the folder already on your machine. The names of the file are unique and should not clash!


Screenshot_01  Screenshot_02

Screenshot_03  Screenshot_04

Screenshot_05  Screenshot_06

12 Likes

Looks beautiful!

6 Likes

Thanks @hanski. Its @Vampirics’s work!

Not sure if you have played Scopa before but its a deceptively simple game to learn.

2 Likes

Beautiful graphics. I hope to have some time to play this today

1 Like

I hope you have a decent SD card … most of the graphics are streamed from SD and a cheap card can give average results.

2 Likes

Ok, never played before - perfect time to change this

2 Likes

After the inital confusion I started to play Scopa. The rules remind a normal card game, “Casino”, IIRC.

Btw: The card animation looks really nice.

1 Like

I had not heard of the card game casino but it does share some similar rules.

What was your initial confusion?

Out of curiosity, how does it perform on you Pokitto / SD card combination? Some SD cards do not perform that well.

Just the normal hassle when getting familiar to rules. The same applies to playing real card games etc.

The only place I noticed slowness was in the initial raffle about who will start. The “hand” moves a bit slow horizontally over the crads.

2 Likes

It took me a minute to realize the controls, because I am not a smart man and skipped reading the instructions :laughing: but this is a lot of fun! And yes, the animations and graphics look incredible! And they work alright with my SD card Pokitto combo (the SD card that came with the unit)

3 Likes

Excellent. You will be glad to know that the instructions just tell you how to play the game - not what controls to use!

1 Like

The game is a 10/10 in all aspects. I’m used to the game rules so it was an instant jump in a typical Italian Osteria to play with some old friends.
The cards animations and the lovely graphics ares an eye candy.

From a tech point of view I’d like to know how the cards are rendered. Seems like the images are packed inside a file in “/music/SCOP_CDS.img” . How that file was created?

5 Likes

I have a NodeJS routine that I adapted that turns a PNG into a binary stream:

const fs = require("fs"); 
const Canvas = require('canvas'); 
const Image = Canvas.Image;

/* Pico-8 */
const palette = [ 
0, 0, 0, 29, 43, 83, 126, 37, 83, 0, 135, 81,
171, 82, 54, 95, 87, 79, 194, 195, 199, 255, 241, 232,
255, 0, 77, 255, 163, 0, 255, 236, 39, 0, 228, 54,
41, 173, 255, 131, 118, 156, 255, 119, 168, 255, 204, 170
]; 

let file = process.argv[2]; w = parseInt(process.argv[3]); h = parseInt(process.argv[4]);


if (!file) { 
  console.log("Usage: node gfx.js file.png w h output"); }
else { 
  fs.appendFileSync( `SCOP_CDS.img`, Buffer.from( img4bpp( file, w, h ) ) ); 
}

function img4bpp( path, w, h ){ 

	const canvas = Canvas.createCanvas(w, h); 
	const ctx = canvas.getContext('2d'); 
	const image = new Image(); image.src = fs.readFileSync( path );

    ctx.drawImage( image, 0, 0, w, h ); 
    const buf = canvas.toBuffer('raw'); 
    const pixel = [0,0,0]; 
    const infl = [];


	infl.push( w / 16 ); infl.push( w % 16 ); infl.push( h / 16 ); infl.push( h % 16 );


    let line = '';

    for( let i=0; i<buf.length; ++i ){

		let j;

		pixel[2] = buf[i++]; 
		pixel[1] = buf[i++]; 
		pixel[0] = buf[i++];

		let minind = 999;

		for( j=0; j<palette.length / 3; ++j ){
			if (Math.abs(pixel[0] - palette[j * 3]) < 4 && Math.abs(pixel[1] - palette[(j * 3) + 1]) < 4 && Math.abs(pixel[2] - palette[(j * 3) + 2]) < 4) {
				minind = j; 
				break; 
			}
		}

		if (minind == 999) { 
			console.log("I: %i, X: %i, Y: %i - %i,%i,%i", i, 		((i/4)%w), ((i/4)/w), pixel[0], pixel[1], pixel[2] );
		}

		infl.push( minind );
		line += minind.toString(16); if (line.length == w ){ if (w % 2 == 1) {
		infl.push( 0 ); }
	    line = ''; }

    }

    const out = [];

    for( let i=0; i<infl.length; ){ let hi = infl[i++]; let lo = infl[i++]; out.push( (hi<<4) | lo ); }

    return out;

}

Then I call this with a batch file to convert all the assets one be one …

rm SCOP_CDS.img

node ConvertImg2.js SCOP_C00.png 70 98 
node ConvertImg2.js SCOP_C01.png 64 98 
node ConvertImg2.js SCOP_C02.png 56 98 
node ConvertImg2.js SCOP_C03.png 50 98 
node ConvertImg2.js SCOP_C04.png 42 98 
...

It creates one big file.

Then in my code, I just position to the start of the image and read it into a buffer I have predefined:

uint8_t imgBuffer[1000];
constexpr uint32_t SDCardStart = 1234;
constexpr uint32_t SDCardLength = 2 + (90 * 90 / 2); 
//  Width, height and full screen. 16 colours so 2 pixels per byte

file.openRO("/music/SCOP_CDS.img");
file.seek(SDCardStart); 
file.read(this->imgBuffer, SDCardLength);

PD::drawBitmap(30, 43, this->imgBuffer);

Or the screen buffer directly:

constexpr uint32_t SDTitleStart = 1234;
constexpr uint32_t SDTitleLength = 2 + (220 * 176 / 2); 
//  Width, height and full screen. 16 colours so 2 pixels per byte

file.openRO("/music/SCOP_CDS.img");
file.seek(SDTitleStart + 2);  // + 2 to skip width and height
file.read(PD::getBuffer(), SDTitleLength - 2);
5 Likes

Thanks for clarification of the missing piece of puzzle. That scripts looks familiar :grin:.
Are the original cards images available?

The script should look familiar :slight_smile: After all it came from you!

They could be but I better check with @Vampirics … what are you thinking of using them for?

2 Likes

Actually nothing really planned. Just the cards are so nice that they worth at last another couple of games :grin:

3 Likes

Having Briscola in mind? Anyway you know that i cant say no to you, just mention who made them, thats all.

2 Likes

I have added you to the repo, @HomineLudens … do I need to learn how to play Briscola?

2 Likes

Good job guys !

4 Likes