Jump to content

Murchu

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Murchu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All I wish to create an Associative array of a deck of cards, the user $_GET's from radio buttons a sequences of 3 colors, red, red, black for example. the program also picks a sequences of colors while there are cards in the deck , i wish to write a program that records which sequence is encountered the most, and out put the winner by how much ?? $suits = array ( "Spades", "Hearts", "Clubs", "Diamonds"); $cards = array ("2", "3", "4", "5", "6", "7", "8","9", "10", "Jack", "Queen", "King", "Ace"); $deck = array(); foreach ($suits as $suit) { foreach ($cards as $card) { $deck[ ] = array ("Card" => $card, "Suit" => $suit); } } how should i continue and how to attach colors to this array ?? Thanks for any advice offered ☺
  2. Hi friends basic question for the community I want to generate a checkered flag but im unsure how to achieve this with for loops ? each box is of side 40 and width over all = $n any help would be great thanks $height = $n * 40; $width = $height; $im = imagecreatetruecolor($width, $height); $white = imagecolorallocate($im, 255, 255, 255); $red = imagecolorallocate($im, 255, 0, 0); for($i = 0; $i <= $width; $i += 40) { for($j = 0; $j <= $n; $j += $n) { if(( $i + $j ) % 2 == 0) { imagefilledrectangle ( $im , 0, $j, 0 , $width , $red ); } else { imagefilledrectangle ( $im , $j, $j , 0 , $width , $white ); } } } header('Content-type: image/png'); imagepng($im); imagedestroy($im);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.